Skip to content

Commit

Permalink
fix(wdio): amend test runner usage and update outdated chromedriver (#…
Browse files Browse the repository at this point in the history
…179)

* simplify

* fix(wdio): amend test runner usagee and update outdated chromedriver

* Apply feedback from Dan

Co-authored-by: Dan Bjorge <[email protected]>

---------

Co-authored-by: Dan Bjorge <[email protected]>
  • Loading branch information
Zidious and dbjorge authored Mar 7, 2024
1 parent 19b63e1 commit 2ce7c2d
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 26 deletions.
6 changes: 4 additions & 2 deletions wdio/test-runner/typescript/forgot-password.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ describe('forgot password', () => {
await expect($('button[type="submit"]')).toBeDisplayed()
await $('#email').setValue('[email protected]')
await $('button[type="submit"]').click()
await browser.waitUntil(() => {
document.body.innerHTML.includes('Internal Server Error')
await browser.waitUntil(async () => {
const h1 = await $('h1')
const h1text = await h1.getText()
return h1text.includes('Internal Server Error')
})
})
})
Expand Down
2 changes: 1 addition & 1 deletion wdio/test-runner/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@wdio/mocha-framework": "^8.11.0",
"@wdio/spec-reporter": "^8.11.2",
"chai": "^4.3.7",
"chromedriver": "^114.0.2",
"chromedriver": "^122.0.4",
"ts-node": "^10.9.1",
"typescript": "^5.1.3",
"wdio-chromedriver-service": "^8.1.1"
Expand Down
29 changes: 12 additions & 17 deletions wdio/test-runner/typescript/wdio.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,16 @@ import { wdioTestRunner } from '@axe-core/watcher'
/* Get your configuration from environment variables. */
const { API_KEY, SERVER_URL = 'https://axe.deque.com' } = process.env

export const config = wdioTestRunner(
{
apiKey: API_KEY as string,
serverURL: SERVER_URL
},
{
specs: ['*.test.ts'],
capabilities: [{ browserName: 'chrome' }],
baseUrl: 'https://the-internet.herokuapp.com',
services: ['chromedriver'],
framework: 'mocha',
reporters: ['spec'],
maxInstances: 5,
mochaOpts: {
timeout: 10000
}
export const config = wdioTestRunner({
axe: { apiKey: API_KEY as string, serverURL: SERVER_URL },
specs: ['forgot-password.test.ts', 'login.test.ts', 'home.test.ts'],
capabilities: [{ browserName: 'chrome' }],
baseUrl: 'https://the-internet.herokuapp.com',
services: ['chromedriver'],
framework: 'mocha',
reporters: ['spec'],
maxInstances: 5,
mochaOpts: {
timeout: 10000
}
)
})
4 changes: 2 additions & 2 deletions wdio/typescript-multi-page/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
"name": "typescript-multi-page",
"private": true,
"scripts": {
"test": "mocha --require ts-node/register --timeout 10s login.test.ts"
"test": "mocha --require ts-node/register --timeout 10s '*.test.ts'"
},
"devDependencies": {
"@axe-core/watcher": "^3.5.0",
"@types/chai": "^4.3.5",
"@types/mocha": "^10.0.1",
"@types/node": "^20.3.1",
"chai": "^4.3.7",
"chromedriver": "^114.0.2",
"chromedriver": "^122.0.4",
"mocha": "^10.2.0",
"ts-node": "^10.9.1",
"typescript": "^5.1.3",
Expand Down
8 changes: 4 additions & 4 deletions wdio/typescript-multi-page/setup.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import 'mocha'
import { wdioConfig, WdioController, wrapWdio } from '@axe-core/watcher'
import { remote, type Browser } from 'webdriverio'
import { remote } from 'webdriverio'

/* Get your configuration from environment variables. */
const { API_KEY, SERVER_URL = 'https://axe.deque.com' } = process.env

let browser: Browser
let browser: WebdriverIO.Browser
let controller: WdioController

before(async () => {
browser = (await remote(
browser = await remote(
wdioConfig({
axe: {
apiKey: API_KEY as string,
Expand All @@ -19,7 +19,7 @@ before(async () => {
browserName: 'chrome'
}
})
)) as Browser // Type assertion for better compatibility.
)

controller = new WdioController(browser)
wrapWdio(browser, controller)
Expand Down

0 comments on commit 2ce7c2d

Please sign in to comment.