forked from uber/baseweb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nightwatch.conf.js
118 lines (104 loc) · 2.7 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
/*
Copyright (c) 2018 Uber Technologies, Inc.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
*/
/* eslint-env node */
/* eslint-disable flowtype/require-valid-file-annotation */
const {resolve} = require('path');
const jar = require('selenium-server-standalone-jar');
const JOB_IDENTIFIER = process.env.BUILDKITE_BUILD_NUMBER;
const buildSettings = {
'tunnel-identifier': JOB_IDENTIFIER,
// sauce lab does not support the concept of branches, so only reporting the master results
build: process.env.BUILDKITE_BRANCH === 'master' ? JOB_IDENTIFIER : undefined,
};
const environments = {
'chrome-mac': {
desiredCapabilities: {
browserName: 'chrome',
platform: 'macOS 10.12',
extendedDebugging: true,
...buildSettings,
},
},
'chrome-windows': {
desiredCapabilities: {
browserName: 'chrome',
platform: 'Windows 10',
...buildSettings,
},
},
'iPhone-X': {
desiredCapabilities: {
browserName: 'Safari',
deviceName: 'iPhone X Simulator',
deviceOrientation: 'portrait',
platformVersion: '11.0',
platformName: 'iOS',
...buildSettings,
},
},
};
const sauceLabsBaseConfig = {
launch_url: process.env.E2E_LAUNCH_URL || 'http://localhost:8080',
selenium_port: 80,
selenium_host: 'ondemand.saucelabs.com',
silent: true,
username: '${SAUCE_USERNAME}',
access_key: '${SAUCE_ACCESS_KEY}',
globals: {
waitForConditionTimeout: 20000,
},
desiredCapabilities: {
'tunnel-identifier': JOB_IDENTIFIER,
},
};
const sauceLabsEnvironments = Object.keys(environments).reduce(
(accumulator, current) => {
return Object.assign(accumulator, {
[current]: {
...sauceLabsBaseConfig,
...environments[current],
},
});
},
{},
);
module.exports = {
src_folders: ['src'],
output_folder: 'reports',
custom_assertions_path: [
resolve(__dirname, 'e2e/assertions'),
resolve(__dirname, 'node_modules/nightwatch-accessibility/assertions'),
],
custom_commands_path: [
resolve(__dirname, 'node_modules/nightwatch-accessibility/commands'),
],
selenium: {
start_process: process.env.SAUCE_USERNAME ? false : true,
server_path: jar.path,
port: 4444,
},
test_runner: {
type: 'mocha',
options: {
ui: 'bdd',
},
},
test_settings: {
default: {
launch_url: process.env.E2E_LAUNCH_URL || 'http://localhost:8080',
selenium_port: 4444,
selenium_host: 'localhost',
silent: true,
desiredCapabilities: {
browserName: 'chrome',
},
globals: {
waitForConditionTimeout: 10000,
},
},
...sauceLabsEnvironments,
},
};