From v5 to v6
This tutorial is for people who are still using v5
of WebdriverIO and want to migrate to v6
or to the latest version of WebdriverIO. As mentioned in our release blog post the changes for this version upgrade can be summarised as following:
-
we consolidated the parameters for some commands (e.g.
newWindow
,react$
,react$$
,waitUntil
,dragAndDrop
,moveTo
,waitForDisplayed
,waitForEnabled
,waitForExist
) and moved all optional parameters into a single object, e.g.// v5
browser.newWindow(
'https://webdriver.io',
'WebdriverIO window',
'width=420,height=230,resizable,scrollbars=yes,status=1'
)
// v6
browser.newWindow('https://webdriver.io', {
windowName: 'WebdriverIO window',
windowFeature: 'width=420,height=230,resizable,scrollbars=yes,status=1'
}) -
configurations for services moved into the service list, e.g.
// v5
exports.config = {
services: ['sauce'],
sauceConnect: true,
sauceConnectOpts: { foo: 'bar' },
}
// v6
exports.config = {
services: [['sauce', {
sauceConnect: true,
sauceConnectOpts: { foo: 'bar' }
}]],
} -
some service options were renamed for simplification purposes
-
we renamed command
launchApp
tolaunchChromeApp
for Chrome WebDriver sessions
If you are using WebdriverIO v4
or below, please upgrade to v5
first.
While we would love to have a fully automated process for this the reality looks different. Everyone has a different setup. Every step should be seen as guidance and less like a step by step instruction. If you have issues with the migration, don't hesitate to contact us.
Setup
Similar to other migrations we can use the WebdriverIO codemod. To install the codemod, run:
npm install jscodeshift @wdio/codemod