Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(wdio): amend test runner usage and update outdated chromedriver #179

Merged
merged 4 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example was using our outdated and deprecated wdioTestRunner - Updated to use the more update to configuration

{
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
Loading