-
Notifications
You must be signed in to change notification settings - Fork 13
/
nightwatch.conf.js
129 lines (113 loc) · 2.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
const SauceLabs = require('saucelabs')
const chromedriver = require('chromedriver')
// Base
let nightwatchConfig = {
src_folders: ['tests'],
output_folder: false,
}
// Local
if (!process.env.TRAVIS) {
nightwatchConfig = Object.assign({}, nightwatchConfig, {
selenium: {
start_process: true,
server_path: 'node_modules/selenium-server/lib/runner/selenium-server-standalone-3.141.5.jar',
host: '127.0.0.1',
port: 4444,
cli_args: {
'webdriver.chrome.driver': chromedriver.path
}
},
test_settings: {
default: {
silent: true,
launch_url: 'http://ckan-dev:5000',
selenium_port: 4444,
selenium_host: 'localhost',
desiredCapabilities: {
javascriptEnabled: true,
acceptSslCerts: true
},
globals: {
report,
},
desiredCapabilities: {
browserName: 'chrome',
}
},
}
})
// Remote
} else {
nightwatchConfig = Object.assign({}, nightwatchConfig, {
selenium: {
start_process: false,
server_path: '',
host: '127.0.0.1',
port: 4444,
cli_args: {
'webdriver.chrome.driver': '',
'webdriver.ie.driver': '',
}
},
test_workers: {
enabled: true,
workers: 'auto',
},
test_settings: {
default: {
silent: true,
launch_url: 'http://localhost:9090',
selenium_port: 80,
selenium_host: 'ondemand.saucelabs.com',
username : process.env.SAUCE_USERNAME,
access_key : process.env.SAUCE_ACCESS_KEY,
desiredCapabilities: {
build: `build-${process.env.TRAVIS_JOB_NUMBER}`,
'tunnel-identifier': process.env.TRAVIS_JOB_NUMBER,
javascriptEnabled: true,
acceptSslCerts: true
},
globals: {
report,
},
},
chrome: {
desiredCapabilities: {
browserName: 'chrome',
platform: 'Linux',
version: 'latest',
},
},
safari: {
desiredCapabilities: {
browserName: 'safari',
platform: 'Mac 10.11',
},
},
edge: {
desiredCapabilities: {
browserName: 'microsoftedge',
},
},
}
})
}
// Globals
function report(client, done) {
if (!process.env.TRAVIS) {
done()
return
}
const saucelabs = new SauceLabs({
username: process.env.SAUCE_USERNAME,
password: process.env.SAUCE_ACCESS_KEY
})
const sessionid = client.capabilities['webdriver.remote.sessionid']
const jobName = client.currentTest.name
saucelabs.updateJob(sessionid, {
passed: client.currentTest.results.failed === 0,
name: jobName
}, done)
}
// Module API
module.exports = nightwatchConfig