From Protractor
This tutorial is for people who are using Protractor and want to migrate their framework to WebdriverIO. It was initiated after the Angular team has announced that Protractor won't be longer supported. WebdriverIO has been influenced by a lot of Protractors design decisions which is why it is probably the closest framework to migrate over. The WebdriverIO team appreciates the work of every single Protractor contributor and hopes that this tutorial makes the transition to WebdriverIO easy and straightforward.
While we would love to have a fully automated process for this the reality looks different. Everyone has a different setup and uses Protractor in different ways. 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
The Protractor and WebdriverIO API is actually very similar, to a point where the majority of commands can be rewritten in an automted way through a codemod.
To install the codemod, run:
npm install jscodeshift @wdio/codemod
Strategy
There are many migration strategies. Depending on the size of your team, amount of test files and the urgency to migrate you can try to transform all tests at once or file by file. Given that Protractor will continued to be maintained until Angular version 15 (end of 2022) you still have enough time. You can have Protractor and WebdriverIO tests running at the same time and start writing new tests in WebdriverIO. Given your time budget you can then start migrating the important test cases first and work your way down to tests you might even can delete.
First the Config File
After we have installed the codemod we can start transforming the first file. Have a look first into WebdriverIOs configuration options. Config files can become very complex and it might make sense to only port the essential parts and see how the rest can be added once the corresponding tests that need certain options are being migrated.
For the first migration we only transform the config file and run:
npx jscodeshift -t ./node_modules/@wdio/codemod/protractor ./conf.ts
Your config can be named differently, however the principle should be the same: start migration the config first.
Install WebdriverIO Dependencies
Next step is to configure a minimal WebdriverIO setup that we start building up as we migrate from one framework to another. First we install the WebdriverIO CLI via:
npm install --save-dev @wdio/cli
Next we run the configuration wizard:
npx wdio config