This repository has been archived by the owner on May 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
/
index.js
172 lines (158 loc) · 4.81 KB
/
index.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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
const TestRunner = require('./test-runner');
const cli = {
command: 'wdio',
describe: 'Run wdio tests',
builder: (yargs) => (
yargs.options({
assetServerPort: {
type: 'number',
describe: 'The port to run the webpack and express asset services on.',
default: () => {
if (process.env.WDIO_INTERNAL_PORT) {
return process.env.WDIO_INTERNAL_PORT;
}
return 8080;
},
},
browsers: {
type: 'array',
describe: 'A list of browsers for the test run.',
default: () => {
let browsers = process.env.BROWSERS;
if (browsers) {
// Remove the brackets if BROWSERS is set as an array like ['chrome, firefox, ie'] or ['chrome','firefox','ie'] in Jenkinsfile.
browsers = browsers.replace('[', '');
browsers = browsers.replace(']', '');
// Split the list of BROWSERS into an array if it is set in the string form like 'chrome,firefox,ie'.
if (browsers.includes(',')) {
return browsers.split(',');
}
return [browsers];
}
return [];
},
},
c: {
type: 'string',
alias: 'config',
describe: 'A file path to the test runner configuration.',
},
disableSeleniumService: {
type: 'boolean',
describe: 'A flag to disable the selenium docker service.',
default: false,
},
ignoreScreenshotMismatch: {
type: 'boolean',
describe: 'A flag to ignore screenshot mismatch.',
default: false,
},
externalHost: {
type: 'string',
describe: 'The host address the testing environment is connected to.',
default: () => {
if (process.env.WDIO_EXTERNAL_HOST) {
return process.env.WDIO_EXTERNAL_HOST;
}
return undefined;
},
},
externalPort: {
type: 'number',
describe: 'The port mapping from the host to the container.',
default: () => {
if (process.env.WDIO_EXTERNAL_PORT) {
return process.env.WDIO_EXTERNAL_PORT;
}
return undefined;
},
},
formFactors: {
type: 'array',
describe: 'A list of form factors for the test run.',
default: () => {
if (process.env.FORM_FACTOR) {
return [process.env.FORM_FACTOR];
}
return [];
},
},
gridUrl: {
type: 'string',
describe: 'The remote selenium grid address.',
default: () => {
if (process.env.SELENIUM_GRID_URL) {
return process.env.SELENIUM_GRID_URL;
}
return undefined;
},
},
keepAliveSeleniumDockerService: {
type: 'boolean',
describe: 'Determines to keep the selenium docker service running upon test completion.',
default: false,
},
locales: {
type: 'array',
describe: 'A list of language locales for the test run.',
default: () => {
if (process.env.LOCALE) {
return [process.env.LOCALE];
}
return ['en'];
},
},
screenshotUrl: {
type: 'string',
describe: 'The url to the registry that stores the screenshots',
default: () => {
if (process.env.SCREENSHOT_URL) {
return process.env.SCREENSHOT_URL;
}
return undefined;
},
},
site: {
type: 'string',
describe: 'A file path to a static directory of assets. When defined, an express server will launch to serve the assets and disable running webpack.',
default: () => {
if (process.env.SITE) {
return process.env.SITE;
}
return undefined;
},
},
spec: {
type: 'array',
describe: 'A list of spec file paths.',
},
suite: {
type: 'array',
describe: 'Overrides specs and runs only the defined suites.',
},
themes: {
type: 'array',
describe: 'A list of themes for the test run.',
default: () => {
if (process.env.THEME) {
return [process.env.THEME];
}
return [undefined];
},
},
u: {
type: 'boolean',
alias: 'updateScreenshots',
describe: 'Whether or not to automatically update all reference screenshots with the latest screenshots.',
default: false,
},
useSeleniumStandaloneService: {
type: 'boolean',
describe: 'A flag to use the selenium standalone service instead of the selenium docker service.',
default: process.env.USE_SELENIUM_STANDALONE_SERVICE === 'true',
},
})
),
handler: TestRunner.start,
};
module.exports = cli;