Skip to content

Commit

Permalink
Upgrade e2e tests to Webdriver.io v6.
Browse files Browse the repository at this point in the history
  • Loading branch information
blueimp committed May 5, 2020
1 parent 3857404 commit fb7d5bb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
9 changes: 4 additions & 5 deletions wdio/hooks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,20 @@
const cmds = require('wdio-screen-commands')

/* eslint-disable jsdoc/valid-types */
/** @type WebdriverIO.Config */
/** @type WebdriverIO.HookFunctions */
const config = {
before: async () => {
global.Should = require('chai').should()
browser.addCommand('saveScreenshotByName', cmds.saveScreenshotByName)
browser.addCommand('saveAndDiffScreenshot', cmds.saveAndDiffScreenshot)
if (browser.config.maximizeWindow) await browser.maximizeWindow()
},
beforeTest: async test => {
await cmds.startScreenRecording(test)
},
afterTest: async test => {
afterTest: async (test, context, result) => {
await Promise.all([
cmds.stopScreenRecording(test),
cmds.saveScreenshotByTest(test)
cmds.stopScreenRecording(test, result),
cmds.saveScreenshotByTest(test, result)
])
}
}
Expand Down
15 changes: 7 additions & 8 deletions wdio/test/pages/file-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class FileUpload {
*/
open(timeout) {
browser.url('/')
this.fileinput.waitForExist(timeout)
this.fileinput.waitForExist({ timeout })
return this
}
/**
Expand All @@ -48,10 +48,10 @@ class FileUpload {
*/
upload(files, timeout) {
this.fileinput.addValue(files.join('\n'))
browser.waitUntil(() => !this.processing.length, timeout)
browser.waitUntil(() => !this.processing.length, { timeout })
this.start.click()
browser.waitUntil(() => !!this.downloads.length, timeout)
browser.waitUntil(() => !this.uploads.length, timeout)
browser.waitUntil(() => !!this.downloads.length, { timeout })
browser.waitUntil(() => !this.uploads.length, { timeout })
return this
}
/**
Expand All @@ -62,12 +62,11 @@ class FileUpload {
*/
delete(timeout) {
this.toggle.click()
browser.waitUntil(
() => this.downloads.length === this.checked.length,
browser.waitUntil(() => this.downloads.length === this.checked.length, {
timeout
)
})
this.remove.click()
browser.waitUntil(() => !this.downloads.length, timeout)
browser.waitUntil(() => !this.downloads.length, { timeout })
return this
}
}
Expand Down

0 comments on commit fb7d5bb

Please sign in to comment.