-
Notifications
You must be signed in to change notification settings - Fork 1
/
nightwatch.conf.js
89 lines (80 loc) · 2.56 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
'use strict';
const seleniumServer = require('selenium-server');
const phantomjs = require('phantomjs-prebuilt');
const chromedriver = require('chromedriver');
// assign a port number between 4-5k
const testUrl = process.env.TEST_URL || 'http://localhost';
const port = process.env.SELENIUM_PORT || Math.floor(Math.random() * (5000 - 4000) + 4000);
const host = process.env.SELENIUM_HOST || 'localhost';
/*eslint camelcase: 0*/
const screenshotSettings = function (folderName) {
return {
enabled: true,
on_failure: true,
on_error: false,
path: `acceptance_tests/screenshots/${folderName}`
};
};
/*eslint camelcase: 0*/
module.exports = {
src_folders: [require('nightwatch-cucumber')({
featureFiles: 'acceptance_tests/features',
stepDefinitions: 'acceptance_tests/features/step_definitions',
htmlReport: 'acceptance_tests/reports/index.html'
})],
output_folder: 'acceptance_tests/reports',
custom_commands_path: '',
custom_assertions_path: '',
page_objects_path: '',
live_output: false,
disable_colors: false,
// test_workers: {
// enabled: true,
// workers: 'auto'
// },
selenium: {
start_process: host === 'localhost' ? true : false,
server_path: seleniumServer.path,
log_path: '',
host: host,
port: port
},
/*eslint camelcase: 0 no-reserved-keys: 0*/
test_settings: {
default: {
launch_url: testUrl,
selenium_port: port,
selenium_host: host,
silent: true,
screenshots: screenshotSettings('phantomjs'),
desiredCapabilities: {
browserName: 'phantomjs',
javascriptEnabled: true,
acceptSslCerts: true,
'phantomjs.cli.args': ['--ignore-ssl-errors=true'],
'phantomjs.binary.path': phantomjs.path
}
},
chrome: {
desiredCapabilities: {
browserName: 'chrome',
javascriptEnabled: true,
acceptSslCerts: true
},
selenium: {
cli_args: {
'webdriver.chrome.driver': chromedriver.path
}
},
screenshots: screenshotSettings('chrome')
},
firefox: {
desiredCapabilities: {
browserName: 'firefox',
javascriptEnabled: true,
acceptSslCerts: true
},
screenshots: screenshotSettings('firefox')
}
}
};