Clean project running nightwatch js under Win 10 environment
- install jdk for running selenium server
- install node.js
- install python (2.x version)
- install Visual Studio and create and C++ project to install the necessary packages.(see the Install issue with NPM below.)
- download selenium standalone server
- download webdriver (chrome, firefox, IE)
$ npm install socket.io
$ npm install -g npm
$ npm install -g nightwatch
- Create
MyRepoName
- Copy npm & nightwatch folders into
MyRepoName
- Create folders
selenium
(for seleunim standalone jar file)reports
(for test reports )webdriver
(where you place the webdriver files)tests
(where you place your test scripts)
- copy
nightwatch.json
from nightwatch/bin intoMyRepoName
. - touch a file
nightwatch.js
points torunner.js
require('C:/MyRepoName/nightwatch/bin/runner.js');
- set selenium server
start_process
as true will automatically launch the selenium server. Otherwise you have to launch the selenium server manually by using command.
$ java -jar selenium/selenium-server-standalone.jar
- set
server_path
where you place the selenium standalone server file
"selenium": {
"start_process": true,
"server_path": "selenium/selenium-server-standalone.jar",
"log_path": "",
"host": "127.0.0.1",
"port": 4444,
"cli_args": {
"webdriver.chrome.driver": "webdriver/chromedriver.exe",
"webdriver.ie.driver": "",
"webdriver.firefox.profile": ""
}
},
- set browser as chrome
"desiredCapabilities" : {
"browserName" : "chrome",
"javascriptEnabled" : true,
"acceptSslCerts" : true,
"chromeOptions" : {
"args" : ["start-fullscreen"]
}
}
- for more browswer settings. please refereance [camel's Blog] Nightwatch.js debug 血淚史.
Copy google.js as test script from nightwatch\examples\tests
to tests
folder.
$ nightwatch tests/google.js
- windows 10
- Visual Studio 2015
- python v2.7.13
- npm 5.3.0
- nightwatch v0.9.16
- nodejs v8.0.0
Nightwatch.js installation on Windows 10