This project contains various codemods to help migrating from either one major WebdriverIO version to another or from a specific framework to WebdriverIO. It can be used with jscodeshift and currently supports the following migrations:
- v5
▶️ v6 (see migration guide) - v6
▶️ v7 (see migration guide) - Protractor
▶️ WebdriverIO (see migration guide) - Sync
▶️ Async (see migration guide) - more will eventually follow, let us know which ones you would like to see
If you run into any issues during your migration please let us know.
To transform your spec files, you need to install the following packages:
$ npm install jscodeshift @wdio/codemod
To transform you code, run:
$ npx jscodeshift -t ./node_modules/@wdio/codemod/<framework> <path>
# e.g. to migrate from v5 to v6
$ npx jscodeshift -t ./node_modules/@wdio/codemod/v6 ./e2e/
# e.g. to migrate from v6 to v7:
$ npx jscodeshift -t ./node_modules/@wdio/codemod/v7 ./e2e/
# e.g. to transform Protractor code:
$ npx jscodeshift -t ./node_modules/@wdio/codemod/protractor ./e2e/
# e.g. to tranform from sync to async
$ npx jscodeshift -t ./node_modules/@wdio/codemod/async ./e2e/
If you use TypeScript make sure you apply a different parser as parameter, e.g.:
$ npx jscodeshift -t ./node_modules/@wdio/codemod/protractor --parser=tsx ./e2e/*.ts
You can transform tests as well as config files, e.g.: