-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnightwatch.conf.js
More file actions
30 lines (26 loc) · 1.07 KB
/
Copy pathnightwatch.conf.js
File metadata and controls
30 lines (26 loc) · 1.07 KB
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
let defaultSettings = require('./nightwatch.json');
function setLocalRunSettings(settings) {
let chromedriver = require('chromedriver');
let geckodriver = require('geckodriver');
let dotenv = require('dotenv');
const dotenvConfig = dotenv.config()
if (dotenvConfig.error) {
throw dotenvConfig.error;
}
settings.test_settings.default.webdriver.server_path = chromedriver.path;
settings.test_settings.firefox.webdriver.server_path = geckodriver.path;
settings.dotenv = dotenvConfig;
if (process.env.TARGET_BROWSER === 'firefox') {
settings.test_settings.default = Object.assign({}, settings.test_settings.default, settings.test_settings.firefox);
}
}
function updateSettings(settings) {
if (process.env.RUN_ENV !== "ci") {
setLocalRunSettings(settings);
} else {
settings.test_settings.default = Object.assign({}, settings.test_settings.default, settings.test_settings.ci)
}
settings.test_settings.default.launch_url = process.env.LAUNCH_URL.trim() || "https://google.com/";
return settings;
}
module.exports = updateSettings(defaultSettings);