-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnightwatch.conf.js
148 lines (145 loc) · 4.75 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
const BINPATH = './node_modules/nightwatch/bin/';
const SAUCE_USERNAME = process.env.SAUCE_USERNAME;
const SAUCE_ACCESS_KEY = process.env.SAUCE_ACCESS_KEY;
const TRAVIS_BUILD_NUMBER = process.env.TRAVIS_BUILD_NUMBER;
const config = { // we use a nightwatch.conf.js file so we can include comments and helper functions
"src_folders": [
"test/e2e" // we use '/test' as the name of our test directory by default. So 'test/e2e' for 'e2e'.
],
"output_folder": "./reports", // reports (test outcome) output by Nightwatch
"custom_commands_path" : "custom_commands",
"selenium": {
"start_process": true,
"server_path": BINPATH + "selenium.jar", // downloaded by selenium-download module (see below)
"log_path": "",
"host": "127.0.0.1",
"port": 4444,
"cli_args": {
"webdriver.chrome.driver" : BINPATH + "chromedriver" // also downloaded by selenium-download
}
},
"test_workers" : {"enabled" : true, "workers" : "auto"}, // perform tests in parallel where possible
"test_settings": {
"default": {
"launch_url": "http://localhost", // we're testing a Public or "staging" site on Saucelabs
"selenium_port": 80,
"selenium_host": "ondemand.saucelabs.com",
"silent": true,
"screenshots": {
"enabled": false, // save screenshots to this directory (excluded by .gitignore)
"path": ""
},
"username" : "${SAUCE_USERNAME}",
"access_key" : "${SAUCE_ACCESS_KEY}",
"desiredCapabilities": {
"name": "test-from-travis-${TRAVIS_BUILD_NUMBER}",
"build": "build-${TRAVIS_BUILD_NUMBER}",
"browserName": "chrome",
"javascriptEnabled": true,
"webStorageEnabled": true,
"acceptSslCerts": true,
"chromeOptions": {
"args": [
`Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46
(KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3`,
"--window-size=640,1136" // iphone 5
]
}
},
"globals": {
"waitForConditionTimeout": 10000 // wait for content on the page before continuing
}
},
"local": {
"launch_url": "http://127.0.0.1:3000",
"selenium_port": 4444,
"selenium_host": "127.0.0.1",
"silent": true,
"screenshots": {
"enabled": false,
"path": ""
},
"globals": {
"waitForConditionTimeout": 15000 // on localhost sometimes internet is slow so wait...
},
"desiredCapabilities": {
"browserName": "chrome",
"chromeOptions": {
"args": [
`Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46
(KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3`,
"--window-size=640,1136" // iphone 5
]
},
"javascriptEnabled": true,
"acceptSslCerts": true
}
},
"chrome": { // your local Chrome browser (chromedriver)
"desiredCapabilities": {
"browserName": "chrome",
"javascriptEnabled": true,
"acceptSslCerts": true
}
},
"chromemac": { // browsers used on saucelabs:
"desiredCapabilities": {
"browserName": "chrome",
"platform": "OS X 10.11",
"version": "47"
}
},
"ie11": {
"desiredCapabilities": {
"browserName": "internet explorer",
"platform": "Windows 10",
"version": "11.0"
}
},
"firefox" : {
"desiredCapabilities": {
"platform": "XP",
"browserName": "firefox",
"version": "33"
}
},
"internet_explorer_10" : {
"desiredCapabilities": {
"platform": "Windows 7",
"browserName": "internet explorer",
"version": "10"
}
},
"android_s4_emulator": {
"desiredCapabilities": {
"browserName": "android",
"deviceOrientation": "portrait",
"deviceName": "Samsung Galaxy S4 Emulator",
"version": "4.4"
}
},
"iphone_6_simulator": {
"desiredCapabilities": {
"browserName": "iPhone",
"deviceOrientation": "portrait",
"deviceName": "iPhone 6",
"platform": "OSX 10.10",
"version": "8.4"
}
}
}
}
module.exports = config;
/**
* 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.
*/
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);
});
}
});