This project attempts to provide a quick working sample of Nightwatch tests.
Only tested with Chrome (58) and Firefox (54) on Windows.
Simply run :
npm install
In case of issues with proxies or anything else when installing, you can provide the urls or paths of the drivers.
Chromedriver AND NOW geckodriver support CDN Urls :
- GECKODRIVER_CDNURL
GECKODRIVER_CDNURL=https://INTERNAL_CDN/geckodriver/download
- more infos
- CHROMEDRIVER_CDNURL
CHROMEDRIVER_CDNURL=https://npm.taobao.org/mirrors/chromedriver npm install chromedriver
- with local file path :
CHROMEDRIVER_FILEPATH=/path/to/chromedriver_mac64.zip
On other platforms than Windows, for local tests, the paths indicated in the options of the nightwatch.conf.js
file need to be adapted with the linux equivalent (without the .cmd at the end of the filenames):
cli_args: {
'webdriver.gecko.driver': './node_modules/.bin/geckodriver.cmd',
'webdriver.chrome.driver': './node_modules/.bin/chromedriver.cmd',
},
to be replaced with :
cli_args: {
'webdriver.gecko.driver': './node_modules/.bin/geckodriver',
'webdriver.chrome.driver': './node_modules/.bin/chromedriver',
},
By default on Chrome local in standalone mode (no selenium server, no java required) :
npm run test
# equivalent
npm run test:localchrome
for firefox :
npm run test:localfirefox
npm run test:chrome
or
npm run test:firefox
those options are not used in case of localfirefox or localchrome profiles
Use env vars
SELENIUM_HOST=my_server_host SELENIUM_PORT=my_server_port npm test
or adapt the nightwatch.conf.js
file with your settings for more persistent changes :
// remote selenium server
nightwatchConf.test_settings.default.selenium_host = 'your_remote_selenium_server';
nightwatchConf.test_settings.default.selenium_port = 4444;
DEBUG=* npm run test