-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Migrating to Nightwatch v3
To migrate your existing project to Nightwatch v3:
- Install Nightwatch v3 from NPM:
npm i -D nightwatch@3
- Remove all webdriver packages:
npm un -D chromedriver geckodriver
(these are now automatically handled in Nightwatch) - Remove any imports of the above webdriver packages from
nightwatch.conf.js
file. See percy/percy-nightwatch#532 for reference.
- Follow the above steps.
- Remove
@types/nightwatch
package:npm un -D @types/nightwatch
(types are now natively shipped with Nightwatch)
-
browser.element()
command is now replaced with the new element API.
(To continue using the older version ofbrowser.element()
command, setbackwards_compatibility_mode
totrue
in Nightwatch config file.)
After following the above steps, if your types are not working as they should with Nightwatch v3, it's possible that your IDE is picking up types from someplace else (some other project you might have in the same directory as your current project, or from some cache), or not picking up the types at all. You can verify this by doing cmd
/ctrl
+ click
on any Nightwatch type and then looking at the path of the opened type declaration file.
While this is mostly fixed automatically in IDEs after some time, another way to fix this is to make the following changes to your root tsconfig.json
file:
{
"compilerOptions": {
// other configs
"types": ["node", "nightwatch"],
},
"include": ["test"] // location where your Nightwatch tests are present (setting this may/may not be required)
}
If you still face issues, please feel free to reach out to us on the #typescript channel of our Discord server, and we'd be happy to help.