This repository has been archived by the owner on Feb 22, 2024. It is now read-only.
/
nightwatch.conf.js
67 lines (61 loc) · 2.43 KB
/
nightwatch.conf.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
require('babel-core/register');
const SCREENSHOT_PATH = "./reports/screenshots/";
const BINPATH = './node_modules/nightwatch/bin/';
/**
* Set URL based on travis branch
*/
const url = 'http://localhost:3000';
// we use a nightwatch.conf.js file so we can include comments and helper functions
module.exports = {
"src_folders": [
"tests"// Where you are storing your Nightwatch e2e tests
],
"output_folder": "./reports", // reports (test outcome) output by nightwatch
"page_objects_path": './tests/pages',
"custom_commands_path": './tests/custom_commands',
"test_settings": {
"default": {
"selenium": { // downloaded by selenium-download module (see readme)
"start_process": true, // tells nightwatch to start/stop the selenium process
"server_path": "./node_modules/nightwatch/bin/selenium.jar",
"host": "127.0.0.1",
"port": 4444, // standard selenium port
"cli_args": { // chromedriver is downloaded by selenium-download (see readme)
"webdriver.chrome.driver": "./node_modules/nightwatch/bin/chromedriver"
}
},
"filter": "tests/\*/\*.test.js",
"screenshots": {
"enabled": true, // if you want to keep screenshots
"path": './reports/screenshots', // save screenshots here
"on_failure": true
},
"globals": {
"url": url,
"auth_url": process.env.AUTHENTICATION_URL,
"waitForConditionTimeout": 10000, // sometimes internet is slow so wait.
"waitForConditionPollInterval": 500
},
"desiredCapabilities": { // use Chrome as the default browser for tests
"browserName": "chrome",
"acceptSslCerts": true,
"javascriptEnabled": true // turn off to test progressive enhancement
}
},
}
}
/**
* selenium-download does exactly what it's name suggests;
* downloads (or updates) the version of Selenium (& chromedriver)
* on your localhost where it will be used by Nightwatch.
/the following code checks for the existence of `selenium.jar` before trying to run our tests.
*/
require('fs').stat(BINPATH + 'selenium.jar', function (err, stat) { // got it?
if (err || !stat || stat.size < 1) {
require('selenium-download').ensure(BINPATH, function (error) {
if (error) throw new Error(error); // no point continuing so exit!
console.log('✔ Selenium & Chromedriver downloaded to:', BINPATH);
});
}
});
module.exports.SCREENSHOT_PATH = SCREENSHOT_PATH;