-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Debugging Nightwatch tests in WebStorm
gwcgm1 edited this page Oct 13, 2016
·
7 revisions
You can setup Nightwatch to debug through WebStorm IDE. Here's how to do this:
- Click Run in the main toolbar
- Edit Configurations
- On the top left of the Run/Debug Configurations dialog, click the + sign.
- Choose Node.js
- Name the new configuration "Nightwatch"
- WebStorm should detect your node interpreter (probably in /usr/local/bin/node)
- Under "JavaScript file" enter node_modules/nightwatch/bin/runner.js
- Under "Application parameters" enter the config switch with the path to your nightwatch.json, e.g. "--config tests/integration/nightwatch.json"
- Click Apply.
- Click Run
- Debug "Nightwatch"
-- Debugging tests is not supported when running in parallel, since a test worker is a separate node process.
-- You can run or debug a single file through WebStorm using the context menu. For this to work with Nightwatch you need to change the config setup you have for the default Node.js (and can get rid of the Nightwatch config if you want too).
- Edit the default Node.js config
- Put all values in the "Node parameters" field instead, for example
C:\Users\tester\AppData\Roaming\npm\node_modules\nightwatch\bin\runner.js --config "D:\git\mytests\nightwatch.json" --env chrome
- Set the working directory to the location of your nightwatch/tests folder
From now on you can right click on a file in WebStorm to bring up the context menu and run/debug the individual file.