Run your Nightwatch.js tests with Grunt
Automatize your tests:
Write some tests:
$ grunt nightwatch # target: default$ grunt nightwatch:A # target: A$ grunt nightwatch:A:B # targets: A, B
grunt-nightwatch supports the same options as nwrun can handle.
Note that the nighwatch.json file settings is fully supported, but your task options will override them if needed.
grunt-nightwatch will pass
grunt.cli.options as the
argv option to
This means you can use
grunt nightwatch:A:B --group foo --tag bar directly on the CLI.
When running in parallel Nightwatch will copy the
process.argv and it may produce bugs if you expect a single boolean argument like
grunt nightwatch:A:B --standalone.
It will spawn
grunt nightwatch --standalone --env A and the argv will be erroneously parsed as
All options are the same as the main settings.
nightwatch:demo: /* see above */
Now you can execute
grunt nightwatch:demo to run your tests.
Note that your tests must be grouped together as follows:
nightwatch:options:// task optionsstandalone: true// download settingsjar_version: '2.53.0'jar_path: '../nightwatch/selenium-server-standalone-2.53.0.jar'// jar_url: '',src_folders: 'custom_tests/nightwatch'test_settings:phantom:"desiredCapabilities":"browserName": "phantomjs""phantomjs.binary.path": "binaries/nightwatch/phantomjs.exe"firefox:"desiredCapabilities":"browserName": "firefox"chrome:"desiredCapabilities":"browserName": "chrome""cli_args" :"webdriver.chrome.driver" : "binaries/nightwatch/chromedriver.exe"
This configuration allows you to run your tests against different browsers by calling
grunt nightwatch:chrome or
grunt nightwatch:phantom etc.