There are two main aspects of running NightWatchJS tests in the grid. The first aspect is initiating a test session and the other is running a test in parallel on multiple browsers.
Initiating a Test Session
To initiate a test session and run a NightWatchJS test on the grid, certain capabilities must be specified in the Desired Capabilities object. The capabilities are:
- Authentication with NightWatchJS
- Cloud URL - the URL of the cloud.
In addition, the NightWatchJS test desired capabilities may include the following capabilities:
- testName - Specifies the test name. This name will appear in SeeTest Reporter and in the generated report
- generateReport - By default every NightWatchJS test generates a report and takes screenshots after each command. To disable reports (and screenshots) pass this capability with a false value
- takeScreenshots - take a screenshot of reports and the device reflection in the Grid page
- platformName - run the test on the specified platform (Mac, Windows, iOS, etc...)
- browserName - run the test on the specified browser (default is chrome)
- browserVersion - run the test on the specified browser version (check which version are supported in your lab)
newCommandTimeout - change the default timeout for each command in the test (default is 300 seconds)
- newSessionWaitTimeout - change the default timeout for creating a new driver (default is 300 seconds)
In order to use Continuous Testing additional capabilities, you should use the following format:
testName : 'here is the test name',
If the NightWatchJS test is configured to generate a report when the test is finished a detailed report will be created in SeeTest Reporter.
Below you can find an example written in Javascript specifying the capabilities above.
module.exports = { selenium : { start_process : false, selenium_host : '<cloudurl>', server_path:'/wd/hub', selenium_port : <port> }, test_settings : { default : { //default environment selenium_port : <port>, selenium_host : '<cloudurl>', use_ssl : true, //or false if the cloud doesn't use SSL desiredCapabilities : { browserName:'chrome', platformName:'mac', accessKey : '<ACCESS_KEY>', testName : 'NighwatchJSTest', javascriptEnabled : true, takeScreenshots : true, newCommandTimeout : 300, newSessionWaitTimeout : 300 } } } };