Migrate to synchronous style
Learn how to convert your asynchronous tests to the synchronous style
If you have any trouble with the migration, let us know via GitHub issue or Gitter chat.
1. Start Chimp with "--sync=false"
Start chimp with chimp --sync=false --watch
(add your other options).
This is you step definition before the migration:
this.When(/^I visit "([^"]*)"$/, function (url) {
return client.url(url);
});
this.When(/^I visit "([^"]*)"$/, function (url, callback) {
browser.url(url).call(callback);
});
2. Migrate all step definitions to synchronous style one by one
Use the WebDriver.io commands with the Sync postfix until you have migrated all step definitions to the synchronous style. This way you continuously get feedback from Cucumber if you make any migration errors.
this.When(/^I visit "([^"]*)"$/, function (url) {
client.urlSync(url);
});
We removed the callback parameter, no longer return anything and use urlSync
.
3. Remove all Sync postfixes
After you have migrated all step definitions to the synchronous style, you can remove all Sync postfixes.
Use search and replace with a regular expression. Search for (?:this\.)?((?:browser|client|driver|server|ddp)\.\w+)Sync
and replace it with $1
. It removes also the this.
prefix.
this.When(/^I visit "([^"]*)"$/, function (url) {
client.url(url);
});
4. Start Chimp without "--sync=false"
Finally, start Chimp without --sync=false
(the default is true).
Updated less than a minute ago