@wdio/cli 7.17.0 → 7.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/@types/yarn-install.d.ts +16 -0
- package/build/@types/yarn-install.d.ts.map +1 -0
- package/build/@types/yarn-install.js +1 -0
- package/build/commands/config.d.ts +64 -0
- package/build/commands/config.d.ts.map +1 -0
- package/build/commands/config.js +236 -0
- package/build/commands/install.d.ts +18 -0
- package/build/commands/install.d.ts.map +1 -0
- package/build/commands/install.js +112 -0
- package/build/commands/repl.d.ts +36 -0
- package/build/commands/repl.d.ts.map +1 -0
- package/build/commands/repl.js +62 -0
- package/build/commands/run.d.ts +172 -0
- package/build/commands/run.d.ts.map +1 -0
- package/build/commands/run.js +172 -0
- package/build/constants.d.ts +485 -0
- package/build/constants.d.ts.map +1 -0
- package/build/constants.js +370 -0
- package/build/index.d.ts +5 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +88 -0
- package/build/interface.d.ts +77 -0
- package/build/interface.d.ts.map +1 -0
- package/build/interface.js +248 -0
- package/build/launcher.d.ts +96 -0
- package/build/launcher.d.ts.map +1 -0
- package/build/launcher.js +436 -0
- package/build/templates/afterTest.ejs +20 -0
- package/build/templates/exampleFiles/cucumber/features/login.feature +12 -0
- package/build/templates/exampleFiles/cucumber/step_definitions/steps.js.ejs +52 -0
- package/build/templates/exampleFiles/jasmine/example.e2e.js.ejs +42 -0
- package/build/templates/exampleFiles/mocha/example.e2e.js.ejs +42 -0
- package/build/templates/exampleFiles/pageobjects/login.page.js.ejs +44 -0
- package/build/templates/exampleFiles/pageobjects/page.js.ejs +13 -0
- package/build/templates/exampleFiles/pageobjects/secure.page.js.ejs +19 -0
- package/build/templates/reporters.ejs +14 -0
- package/build/templates/wdio.conf.tpl.ejs +457 -0
- package/build/types.d.ts +110 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +2 -0
- package/build/utils.d.ts +87 -0
- package/build/utils.d.ts.map +1 -0
- package/build/utils.js +360 -0
- package/build/watcher.d.ts +34 -0
- package/build/watcher.d.ts.map +1 -0
- package/build/watcher.js +150 -0
- package/package.json +7 -7
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QUESTIONNAIRE = exports.REGION_OPTION = exports.PROTOCOL_OPTIONS = exports.BACKEND_CHOICES = exports.SUPPORTED_PACKAGES = exports.TS_COMPILER_INSTRUCTIONS = exports.COMPILER_OPTIONS = exports.COMPILER_OPTION_ANSWERS = exports.IOS_CONFIG = exports.ANDROID_CONFIG = exports.NPM_INSTALL = exports.DEPENDENCIES_INSTALLATION_MESSAGE = exports.CONFIG_HELPER_SUCCESS_MESSAGE = exports.CONFIG_HELPER_INTRO = exports.EXCLUSIVE_SERVICES = exports.CLI_EPILOGUE = void 0;
|
|
4
|
+
const utils_1 = require("./utils");
|
|
5
|
+
const pkg = require('../package.json');
|
|
6
|
+
exports.CLI_EPILOGUE = `Documentation: https://webdriver.io\n@wdio/cli (v${pkg.version})`;
|
|
7
|
+
exports.EXCLUSIVE_SERVICES = {
|
|
8
|
+
'wdio-chromedriver-service': {
|
|
9
|
+
services: ['@wdio/selenium-standalone-service'],
|
|
10
|
+
message: '@wdio/selenium-standalone-service already includes chromedriver'
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
exports.CONFIG_HELPER_INTRO = `
|
|
14
|
+
=========================
|
|
15
|
+
WDIO Configuration Helper
|
|
16
|
+
=========================
|
|
17
|
+
`;
|
|
18
|
+
exports.CONFIG_HELPER_SUCCESS_MESSAGE = `
|
|
19
|
+
Configuration file was created successfully!
|
|
20
|
+
To run your tests, execute:
|
|
21
|
+
$ npx wdio run %swdio.conf.%s
|
|
22
|
+
`;
|
|
23
|
+
exports.DEPENDENCIES_INSTALLATION_MESSAGE = `
|
|
24
|
+
To install dependencies, execute:
|
|
25
|
+
%s
|
|
26
|
+
`;
|
|
27
|
+
exports.NPM_INSTALL = '';
|
|
28
|
+
exports.ANDROID_CONFIG = {
|
|
29
|
+
platformName: 'Android',
|
|
30
|
+
automationName: 'UiAutomator2',
|
|
31
|
+
deviceName: 'Test'
|
|
32
|
+
};
|
|
33
|
+
exports.IOS_CONFIG = {
|
|
34
|
+
platformName: 'iOS',
|
|
35
|
+
automationName: 'XCUITest',
|
|
36
|
+
deviceName: 'iPhone Simulator'
|
|
37
|
+
};
|
|
38
|
+
exports.COMPILER_OPTION_ANSWERS = [
|
|
39
|
+
'Babel (https://babeljs.io/)',
|
|
40
|
+
'TypeScript (https://www.typescriptlang.org/)',
|
|
41
|
+
'No!'
|
|
42
|
+
];
|
|
43
|
+
exports.COMPILER_OPTIONS = {
|
|
44
|
+
babel: exports.COMPILER_OPTION_ANSWERS[0],
|
|
45
|
+
ts: exports.COMPILER_OPTION_ANSWERS[1],
|
|
46
|
+
nil: exports.COMPILER_OPTION_ANSWERS[2]
|
|
47
|
+
};
|
|
48
|
+
exports.TS_COMPILER_INSTRUCTIONS = `To have TypeScript support please add the following packages to your "types" list:
|
|
49
|
+
{
|
|
50
|
+
"compilerOptions": {
|
|
51
|
+
"types": ["node", %s]
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
For for information on TypeScript integration check out: https://webdriver.io/docs/typescript
|
|
56
|
+
`;
|
|
57
|
+
/**
|
|
58
|
+
* We have to use a string hash for value because InquirerJS default values do not work if we have
|
|
59
|
+
* objects as a `value` to be stored from the user's answers.
|
|
60
|
+
*/
|
|
61
|
+
exports.SUPPORTED_PACKAGES = {
|
|
62
|
+
runner: [
|
|
63
|
+
{ name: 'local', value: '@wdio/local-runner$--$local' }
|
|
64
|
+
],
|
|
65
|
+
framework: [
|
|
66
|
+
{ name: 'mocha', value: '@wdio/mocha-framework$--$mocha' },
|
|
67
|
+
{ name: 'jasmine', value: '@wdio/jasmine-framework$--$jasmine' },
|
|
68
|
+
{ name: 'cucumber', value: '@wdio/cucumber-framework$--$cucumber' }
|
|
69
|
+
],
|
|
70
|
+
reporter: [
|
|
71
|
+
{ name: 'spec', value: '@wdio/spec-reporter$--$spec' },
|
|
72
|
+
{ name: 'dot', value: '@wdio/dot-reporter$--$dot' },
|
|
73
|
+
{ name: 'junit', value: '@wdio/junit-reporter$--$junit' },
|
|
74
|
+
{ name: 'allure', value: '@wdio/allure-reporter$--$allure' },
|
|
75
|
+
{ name: 'sumologic', value: '@wdio/sumologic-reporter$--$sumologic' },
|
|
76
|
+
{ name: 'concise', value: '@wdio/concise-reporter$--$concise' },
|
|
77
|
+
// external
|
|
78
|
+
{ name: 'reportportal', value: 'wdio-reportportal-reporter$--$reportportal' },
|
|
79
|
+
{ name: 'video', value: 'wdio-video-reporter$--$video' },
|
|
80
|
+
{ name: 'json', value: 'wdio-json-reporter$--$json' },
|
|
81
|
+
{ name: 'cucumber', value: 'wdio-cucumber-reporter$--$cucumber' },
|
|
82
|
+
{ name: 'mochawesome', value: 'wdio-mochawesome-reporter$--$mochawesome' },
|
|
83
|
+
{ name: 'timeline', value: 'wdio-timeline-reporter$--$timeline' },
|
|
84
|
+
{ name: 'html', value: '@rpii/wdio-html-reporter$--$html' },
|
|
85
|
+
{ name: 'markdown', value: 'carmenmitru/wdio-markdown-reporter' },
|
|
86
|
+
{ name: 'delta', value: '@delta-reporter/wdio-delta-reporter-service' },
|
|
87
|
+
{ name: 'tesults', value: 'wdio-tesults-reporter$--$tesults' }
|
|
88
|
+
],
|
|
89
|
+
plugin: [
|
|
90
|
+
{ name: 'wait-for', value: 'wdio-wait-for$--$wait-for' },
|
|
91
|
+
{ name: 'angular-component-harnesses', value: '@badisi/wdio-harness$--$harness' }
|
|
92
|
+
],
|
|
93
|
+
service: [
|
|
94
|
+
// inquirerjs shows list as its orderer in array
|
|
95
|
+
// put chromedriver first as it is the default option
|
|
96
|
+
{ name: 'chromedriver', value: 'wdio-chromedriver-service$--$chromedriver' },
|
|
97
|
+
// internal
|
|
98
|
+
{ name: 'sauce', value: '@wdio/sauce-service$--$sauce' },
|
|
99
|
+
{ name: 'testingbot', value: '@wdio/testingbot-service$--$testingbot' },
|
|
100
|
+
{ name: 'selenium-standalone', value: '@wdio/selenium-standalone-service$--$selenium-standalone' },
|
|
101
|
+
{ name: 'devtools', value: '@wdio/devtools-service$--$devtools' },
|
|
102
|
+
{ name: 'browserstack', value: '@wdio/browserstack-service$--$browserstack' },
|
|
103
|
+
{ name: 'appium', value: '@wdio/appium-service$--$appium' },
|
|
104
|
+
{ name: 'firefox-profile', value: '@wdio/firefox-profile-service$--$firefox-profile' },
|
|
105
|
+
{ name: 'crossbrowsertesting', value: '@wdio/crossbrowsertesting-service$--$crossbrowsertesting' },
|
|
106
|
+
// external
|
|
107
|
+
{ name: 'eslinter-service', value: 'wdio-eslinter-service$--$eslinter' },
|
|
108
|
+
{ name: 'lambdatest', value: 'wdio-lambdatest-service$--$lambdatest' },
|
|
109
|
+
{ name: 'zafira-listener', value: 'wdio-zafira-listener-service$--$zafira-listener' },
|
|
110
|
+
{ name: 'reportportal', value: 'wdio-reportportal-service$--$reportportal' },
|
|
111
|
+
{ name: 'docker', value: 'wdio-docker-service$--$docker' },
|
|
112
|
+
{ name: 'ui5', value: 'wdio-ui5-service$--$ui5' },
|
|
113
|
+
{ name: 'wiremock', value: 'wdio-wiremock-service$--$wiremock' },
|
|
114
|
+
{ name: 'ng-apimock', value: 'wdio-ng-apimock-service$--ng-apimock' },
|
|
115
|
+
{ name: 'slack', value: 'wdio-slack-service$--$slack' },
|
|
116
|
+
{ name: 'intercept', value: 'wdio-intercept-service$--$intercept' },
|
|
117
|
+
{ name: 'docker', value: 'wdio-docker-service$--$docker' },
|
|
118
|
+
{ name: 'image-comparison', value: 'wdio-image-comparison-service$--$image-comparison' },
|
|
119
|
+
{ name: 'novus-visual-regression', value: 'wdio-novus-visual-regression-service$--$novus-visual-regression' },
|
|
120
|
+
{ name: 'rerun', value: 'wdio-rerun-service$--$rerun' },
|
|
121
|
+
{ name: 'winappdriver', value: 'wdio-winappdriver-service$--$winappdriver' },
|
|
122
|
+
{ name: 'ywinappdriver', value: 'wdio-ywinappdriver-service$--$ywinappdriver' },
|
|
123
|
+
{ name: 'performancetotal', value: 'wdio-performancetotal-service$--$performancetotal' },
|
|
124
|
+
{ name: 'cleanuptotal', value: 'wdio-cleanuptotal-service$--$cleanuptotal' },
|
|
125
|
+
{ name: 'aws-device-farm', value: 'wdio-aws-device-farm-service$--$aws-device-farm' },
|
|
126
|
+
{ name: 'ocr-native-apps', value: 'wdio-ocr-service$--$ocr-native-apps' },
|
|
127
|
+
{ name: 'ms-teams', value: 'wdio-ms-teams-service$--$ms-teams' },
|
|
128
|
+
]
|
|
129
|
+
};
|
|
130
|
+
exports.BACKEND_CHOICES = [
|
|
131
|
+
'On my local machine',
|
|
132
|
+
'In the cloud using Experitest',
|
|
133
|
+
'In the cloud using Sauce Labs',
|
|
134
|
+
'In the cloud using Browserstack or Testingbot or LambdaTest or a different service',
|
|
135
|
+
'I have my own Selenium cloud'
|
|
136
|
+
];
|
|
137
|
+
exports.PROTOCOL_OPTIONS = [
|
|
138
|
+
'https',
|
|
139
|
+
'http'
|
|
140
|
+
];
|
|
141
|
+
exports.REGION_OPTION = [
|
|
142
|
+
'us',
|
|
143
|
+
'eu',
|
|
144
|
+
'apac'
|
|
145
|
+
];
|
|
146
|
+
exports.QUESTIONNAIRE = [{
|
|
147
|
+
type: 'list',
|
|
148
|
+
name: 'runner',
|
|
149
|
+
message: 'Where should your tests be launched?',
|
|
150
|
+
choices: exports.SUPPORTED_PACKAGES.runner,
|
|
151
|
+
// only ask if there are more than 1 runner to pick from
|
|
152
|
+
when: /* istanbul ignore next */ () => exports.SUPPORTED_PACKAGES.runner.length > 1
|
|
153
|
+
}, {
|
|
154
|
+
type: 'list',
|
|
155
|
+
name: 'backend',
|
|
156
|
+
message: 'Where is your automation backend located?',
|
|
157
|
+
choices: exports.BACKEND_CHOICES
|
|
158
|
+
}, {
|
|
159
|
+
type: 'input',
|
|
160
|
+
name: 'hostname',
|
|
161
|
+
message: 'What is the host address of that cloud service?',
|
|
162
|
+
when: /* istanbul ignore next */ (answers) => answers.backend.toString().indexOf('different service') > -1
|
|
163
|
+
}, {
|
|
164
|
+
type: 'input',
|
|
165
|
+
name: 'port',
|
|
166
|
+
message: 'What is the port on which that service is running?',
|
|
167
|
+
default: '80',
|
|
168
|
+
when: /* istanbul ignore next */ (answers) => answers.backend.toString().indexOf('different service') > -1
|
|
169
|
+
}, {
|
|
170
|
+
type: 'input',
|
|
171
|
+
name: 'expEnvAccessKey',
|
|
172
|
+
message: 'Access key from Experitest Cloud',
|
|
173
|
+
default: 'EXPERITEST_ACCESS_KEY',
|
|
174
|
+
when: /* istanbul ignore next */ (answers) => answers.backend === 'In the cloud using Experitest'
|
|
175
|
+
}, {
|
|
176
|
+
type: 'input',
|
|
177
|
+
name: 'expEnvHostname',
|
|
178
|
+
message: 'Environment variable for cloud url',
|
|
179
|
+
default: 'example.experitest.com',
|
|
180
|
+
when: /* istanbul ignore next */ (answers) => answers.backend === 'In the cloud using Experitest'
|
|
181
|
+
}, {
|
|
182
|
+
type: 'input',
|
|
183
|
+
name: 'expEnvPort',
|
|
184
|
+
message: 'Environment variable for port',
|
|
185
|
+
default: '443',
|
|
186
|
+
when: /* istanbul ignore next */ (answers) => answers.backend === 'In the cloud using Experitest'
|
|
187
|
+
}, {
|
|
188
|
+
type: 'list',
|
|
189
|
+
name: 'expEnvProtocol',
|
|
190
|
+
message: 'Choose a protocol for environment variable',
|
|
191
|
+
default: 'https',
|
|
192
|
+
choices: exports.PROTOCOL_OPTIONS,
|
|
193
|
+
when: /* istanbul ignore next */ (answers) => {
|
|
194
|
+
return answers.backend === 'In the cloud using Experitest' && answers.expEnvPort !== '80' && answers.expEnvPort !== '443';
|
|
195
|
+
}
|
|
196
|
+
}, {
|
|
197
|
+
type: 'input',
|
|
198
|
+
name: 'env_user',
|
|
199
|
+
message: 'Environment variable for username',
|
|
200
|
+
default: 'LT_USERNAME',
|
|
201
|
+
when: /* istanbul ignore next */ (answers) => (answers.backend.toString().indexOf('LambdaTest') > -1 &&
|
|
202
|
+
answers.hostname.indexOf('lambdatest.com') > -1)
|
|
203
|
+
}, {
|
|
204
|
+
type: 'input',
|
|
205
|
+
name: 'env_key',
|
|
206
|
+
message: 'Environment variable for access key',
|
|
207
|
+
default: 'LT_ACCESS_KEY',
|
|
208
|
+
when: /* istanbul ignore next */ (answers) => (answers.backend.toString().indexOf('LambdaTest') > -1 &&
|
|
209
|
+
answers.hostname.indexOf('lambdatest.com') > -1)
|
|
210
|
+
}, {
|
|
211
|
+
type: 'input',
|
|
212
|
+
name: 'env_user',
|
|
213
|
+
message: 'Environment variable for username',
|
|
214
|
+
default: 'BROWSERSTACK_USER',
|
|
215
|
+
when: /* istanbul ignore next */ (answers) => answers.backend.toString().startsWith('In the cloud using Browserstack')
|
|
216
|
+
}, {
|
|
217
|
+
type: 'input',
|
|
218
|
+
name: 'env_key',
|
|
219
|
+
message: 'Environment variable for access key',
|
|
220
|
+
default: 'BROWSERSTACK_ACCESS_KEY',
|
|
221
|
+
when: /* istanbul ignore next */ (answers) => answers.backend.toString().startsWith('In the cloud using Browserstack')
|
|
222
|
+
}, {
|
|
223
|
+
type: 'input',
|
|
224
|
+
name: 'env_user',
|
|
225
|
+
message: 'Environment variable for username',
|
|
226
|
+
default: 'SAUCE_USERNAME',
|
|
227
|
+
when: /* istanbul ignore next */ (answers) => answers.backend === 'In the cloud using Sauce Labs'
|
|
228
|
+
}, {
|
|
229
|
+
type: 'input',
|
|
230
|
+
name: 'env_key',
|
|
231
|
+
message: 'Environment variable for access key',
|
|
232
|
+
default: 'SAUCE_ACCESS_KEY',
|
|
233
|
+
when: /* istanbul ignore next */ (answers) => answers.backend === 'In the cloud using Sauce Labs'
|
|
234
|
+
}, {
|
|
235
|
+
type: 'confirm',
|
|
236
|
+
name: 'headless',
|
|
237
|
+
message: 'Do you want to run your test on Sauce Headless? (https://saucelabs.com/products/web-testing/sauce-headless)',
|
|
238
|
+
default: false,
|
|
239
|
+
when: /* istanbul ignore next */ (answers) => answers.backend === 'In the cloud using Sauce Labs'
|
|
240
|
+
}, {
|
|
241
|
+
type: 'list',
|
|
242
|
+
name: 'region',
|
|
243
|
+
message: 'In which region do you want to run your Sauce Labs tests in?',
|
|
244
|
+
choices: exports.REGION_OPTION,
|
|
245
|
+
when: /* istanbul ignore next */ (answers) => !answers.headless && answers.backend === 'In the cloud using Sauce Labs'
|
|
246
|
+
}, {
|
|
247
|
+
type: 'input',
|
|
248
|
+
name: 'hostname',
|
|
249
|
+
message: 'What is the IP or URI to your Selenium standalone or grid server?',
|
|
250
|
+
default: 'localhost',
|
|
251
|
+
when: /* istanbul ignore next */ (answers) => answers.backend.toString().indexOf('own Selenium cloud') > -1
|
|
252
|
+
}, {
|
|
253
|
+
type: 'input',
|
|
254
|
+
name: 'port',
|
|
255
|
+
message: 'What is the port which your Selenium standalone or grid server is running on?',
|
|
256
|
+
default: '4444',
|
|
257
|
+
when: /* istanbul ignore next */ (answers) => answers.backend.toString().indexOf('own Selenium cloud') > -1
|
|
258
|
+
}, {
|
|
259
|
+
type: 'input',
|
|
260
|
+
name: 'path',
|
|
261
|
+
message: 'What is the path to your browser driver or grid server?',
|
|
262
|
+
default: '/',
|
|
263
|
+
when: /* istanbul ignore next */ (answers) => answers.backend.toString().indexOf('own Selenium cloud') > -1
|
|
264
|
+
}, {
|
|
265
|
+
type: 'list',
|
|
266
|
+
name: 'framework',
|
|
267
|
+
message: 'Which framework do you want to use?',
|
|
268
|
+
choices: exports.SUPPORTED_PACKAGES.framework,
|
|
269
|
+
}, {
|
|
270
|
+
type: 'list',
|
|
271
|
+
name: 'isUsingCompiler',
|
|
272
|
+
message: 'Do you want to use a compiler?',
|
|
273
|
+
choices: exports.COMPILER_OPTION_ANSWERS,
|
|
274
|
+
default: /* istanbul ignore next */ () => (0, utils_1.hasFile)('babel.config.js')
|
|
275
|
+
? exports.COMPILER_OPTIONS.babel // default to Babel
|
|
276
|
+
: (0, utils_1.hasFile)('tsconfig.json')
|
|
277
|
+
? exports.COMPILER_OPTIONS.ts // default to TypeScript
|
|
278
|
+
: exports.COMPILER_OPTIONS.nil // default to no compiler
|
|
279
|
+
}, {
|
|
280
|
+
type: 'input',
|
|
281
|
+
name: 'specs',
|
|
282
|
+
message: 'Where are your test specs located?',
|
|
283
|
+
default: (answers) => (0, utils_1.getDefaultFiles)(answers, './test/specs/**/*'),
|
|
284
|
+
when: /* istanbul ignore next */ (answers) => answers.framework.match(/(mocha|jasmine)/)
|
|
285
|
+
}, {
|
|
286
|
+
type: 'input',
|
|
287
|
+
name: 'specs',
|
|
288
|
+
message: 'Where are your feature files located?',
|
|
289
|
+
default: './features/**/*.feature',
|
|
290
|
+
when: /* istanbul ignore next */ (answers) => answers.framework.includes('cucumber')
|
|
291
|
+
}, {
|
|
292
|
+
type: 'input',
|
|
293
|
+
name: 'stepDefinitions',
|
|
294
|
+
message: 'Where are your step definitions located?',
|
|
295
|
+
default: (answers) => (0, utils_1.getDefaultFiles)(answers, './features/step-definitions/steps'),
|
|
296
|
+
when: /* istanbul ignore next */ (answers) => answers.framework.includes('cucumber')
|
|
297
|
+
}, {
|
|
298
|
+
type: 'confirm',
|
|
299
|
+
name: 'generateTestFiles',
|
|
300
|
+
message: 'Do you want WebdriverIO to autogenerate some test files?',
|
|
301
|
+
default: true
|
|
302
|
+
}, {
|
|
303
|
+
type: 'confirm',
|
|
304
|
+
name: 'usePageObjects',
|
|
305
|
+
message: 'Do you want to use page objects (https://martinfowler.com/bliki/PageObject.html)?',
|
|
306
|
+
default: true,
|
|
307
|
+
when: /* istanbul ignore next */ (answers) => answers.generateTestFiles
|
|
308
|
+
}, {
|
|
309
|
+
type: 'input',
|
|
310
|
+
name: 'pages',
|
|
311
|
+
message: 'Where are your page objects located?',
|
|
312
|
+
default: /* istanbul ignore next */ (answers) => (answers.framework.match(/(mocha|jasmine)/)
|
|
313
|
+
? (0, utils_1.getDefaultFiles)(answers, './test/pageobjects/**/*')
|
|
314
|
+
: (0, utils_1.getDefaultFiles)(answers, './features/pageobjects/**/*')),
|
|
315
|
+
when: /* istanbul ignore next */ (answers) => answers.generateTestFiles && answers.usePageObjects
|
|
316
|
+
}, {
|
|
317
|
+
type: 'checkbox',
|
|
318
|
+
name: 'reporters',
|
|
319
|
+
message: 'Which reporter do you want to use?',
|
|
320
|
+
choices: exports.SUPPORTED_PACKAGES.reporter,
|
|
321
|
+
// @ts-ignore
|
|
322
|
+
default: [exports.SUPPORTED_PACKAGES.reporter.find(
|
|
323
|
+
/* istanbul ignore next */
|
|
324
|
+
({ name }) => name === 'spec').value
|
|
325
|
+
]
|
|
326
|
+
}, {
|
|
327
|
+
type: 'checkbox',
|
|
328
|
+
name: 'plugins',
|
|
329
|
+
message: 'Do you want to add a plugin to your test setup?',
|
|
330
|
+
choices: exports.SUPPORTED_PACKAGES.plugin
|
|
331
|
+
}, {
|
|
332
|
+
type: 'checkbox',
|
|
333
|
+
name: 'services',
|
|
334
|
+
message: 'Do you want to add a service to your test setup?',
|
|
335
|
+
choices: exports.SUPPORTED_PACKAGES.service,
|
|
336
|
+
// @ts-ignore
|
|
337
|
+
default: [exports.SUPPORTED_PACKAGES.service.find(
|
|
338
|
+
/* istanbul ignore next */
|
|
339
|
+
({ name }) => name === 'chromedriver').value
|
|
340
|
+
],
|
|
341
|
+
validate: /* istanbul ignore next */ (answers) => (0, utils_1.validateServiceAnswers)(answers)
|
|
342
|
+
}, {
|
|
343
|
+
type: 'input',
|
|
344
|
+
name: 'outputDir',
|
|
345
|
+
message: 'In which directory should the xunit reports get stored?',
|
|
346
|
+
default: './',
|
|
347
|
+
when: /* istanbul ignore next */ (answers) => answers.reporters.includes('junit')
|
|
348
|
+
}, {
|
|
349
|
+
type: 'input',
|
|
350
|
+
name: 'outputDir',
|
|
351
|
+
message: 'In which directory should the json reports get stored?',
|
|
352
|
+
default: './',
|
|
353
|
+
when: /* istanbul ignore next */ (answers) => answers.reporters.includes('json')
|
|
354
|
+
}, {
|
|
355
|
+
type: 'input',
|
|
356
|
+
name: 'outputDir',
|
|
357
|
+
message: 'In which directory should the mochawesome json reports get stored?',
|
|
358
|
+
default: './',
|
|
359
|
+
when: /* istanbul ignore next */ (answers) => answers.reporters.includes('mochawesome')
|
|
360
|
+
}, {
|
|
361
|
+
type: 'input',
|
|
362
|
+
name: 'baseUrl',
|
|
363
|
+
message: 'What is the base url?',
|
|
364
|
+
default: 'http://localhost'
|
|
365
|
+
}, {
|
|
366
|
+
type: 'confirm',
|
|
367
|
+
name: 'npmInstall',
|
|
368
|
+
message: 'Do you want me to run `npm install`',
|
|
369
|
+
default: true
|
|
370
|
+
}];
|
package/build/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,QAAQ,MAAM,YAAY,CAAA;AAkBjC,eAAO,MAAM,GAAG,qBAyDf,CAAA;AAED,eAAe,QAAQ,CAAA;AACvB,cAAc,SAAS,CAAA"}
|
package/build/index.js
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.run = void 0;
|
|
21
|
+
const fs_1 = __importDefault(require("fs"));
|
|
22
|
+
const path_1 = __importDefault(require("path"));
|
|
23
|
+
const yargs_1 = __importDefault(require("yargs"));
|
|
24
|
+
const launcher_1 = __importDefault(require("./launcher"));
|
|
25
|
+
const run_1 = require("./commands/run");
|
|
26
|
+
const constants_1 = require("./constants");
|
|
27
|
+
const DEFAULT_CONFIG_FILENAME = 'wdio.conf.js';
|
|
28
|
+
const DESCRIPTION = [
|
|
29
|
+
'The `wdio` command allows you run and manage your WebdriverIO test suite.',
|
|
30
|
+
'If no command is provided it calls the `run` command by default, so:',
|
|
31
|
+
'',
|
|
32
|
+
'$ wdio wdio.conf.js',
|
|
33
|
+
'',
|
|
34
|
+
'is the same as:',
|
|
35
|
+
'$ wdio run wdio.conf.js',
|
|
36
|
+
'',
|
|
37
|
+
'For more information, visit: https://webdriver.io/docs/clioptions'
|
|
38
|
+
];
|
|
39
|
+
const run = async () => {
|
|
40
|
+
const argv = yargs_1.default
|
|
41
|
+
.commandDir('commands')
|
|
42
|
+
.example('$0 run wdio.conf.js --suite foobar', 'Run suite on testsuite "foobar"')
|
|
43
|
+
.example('$0 run wdio.conf.js --spec ./tests/e2e/a.js --spec ./tests/e2e/b.js', 'Run suite on specific specs')
|
|
44
|
+
.example('$0 run wdio.conf.js --spec ./tests/e2e/a.feature:5', 'Run scenario by line number')
|
|
45
|
+
.example('$0 run wdio.conf.js --spec ./tests/e2e/a.feature:5:10', 'Run scenarios by line number')
|
|
46
|
+
.example('$0 run wdio.conf.js --spec ./tests/e2e/a.feature:5:10 --spec ./test/e2e/b.feature', 'Run scenarios by line number in single feature and another complete feature')
|
|
47
|
+
.example('$0 install reporter spec', 'Install @wdio/spec-reporter')
|
|
48
|
+
.example('$0 repl chrome -u <SAUCE_USERNAME> -k <SAUCE_ACCESS_KEY>', 'Run repl in Sauce Labs cloud')
|
|
49
|
+
.updateStrings({ 'Commands:': `${DESCRIPTION.join('\n')}\n\nCommands:` })
|
|
50
|
+
.epilogue(constants_1.CLI_EPILOGUE);
|
|
51
|
+
/**
|
|
52
|
+
* parse CLI arguments according to what run expects, without this adding
|
|
53
|
+
* `--spec ./test.js` results in propagating the spec parameter as a
|
|
54
|
+
* string while in reality is should be parsed into a array of strings
|
|
55
|
+
*/
|
|
56
|
+
if (!process.argv.find((arg) => arg === '--help')) {
|
|
57
|
+
argv.options(run_1.cmdArgs);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The only way we reach this point is if the user runs the binary without a command (i.e. wdio wdio.conf.js)
|
|
61
|
+
* We can safely assume that if this is the case, the user is trying to execute the `run` command as it
|
|
62
|
+
* was previous to https://github.com/webdriverio/webdriverio/pull/4402
|
|
63
|
+
*
|
|
64
|
+
* Since the `run` command verifies if the configuration file exists before executing
|
|
65
|
+
* we don't have to check that again here.
|
|
66
|
+
*/
|
|
67
|
+
const params = { ...argv.argv };
|
|
68
|
+
const supportedCommands = fs_1.default
|
|
69
|
+
.readdirSync(path_1.default.join(__dirname, 'commands'))
|
|
70
|
+
.map((file) => file.slice(0, -3));
|
|
71
|
+
if (params._ && !params._.find((param) => supportedCommands.includes(param))) {
|
|
72
|
+
const args = {
|
|
73
|
+
...argv.argv,
|
|
74
|
+
configPath: path_1.default.resolve(process.cwd(), argv.argv._[0] && argv.argv._[0].toString() || DEFAULT_CONFIG_FILENAME)
|
|
75
|
+
};
|
|
76
|
+
return (0, run_1.handler)(args).catch(async (err) => {
|
|
77
|
+
const output = await new Promise((resolve) => (yargs_1.default.parse('--help', (err, argv, output) => resolve(output))));
|
|
78
|
+
console.error(`${output}\n\n${err.stack}`);
|
|
79
|
+
/* istanbul ignore if */
|
|
80
|
+
if (!process.env.JEST_WORKER_ID) {
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
exports.run = run;
|
|
87
|
+
exports.default = launcher_1.default;
|
|
88
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
3
|
+
import type { Options, Workers } from '@wdio/types';
|
|
4
|
+
import { HookError } from './utils';
|
|
5
|
+
interface TestError {
|
|
6
|
+
type: string;
|
|
7
|
+
message: string;
|
|
8
|
+
stack?: string;
|
|
9
|
+
}
|
|
10
|
+
interface CLIInterfaceEvent {
|
|
11
|
+
origin?: string;
|
|
12
|
+
name: string;
|
|
13
|
+
cid?: string;
|
|
14
|
+
fullTitle?: string;
|
|
15
|
+
content?: any;
|
|
16
|
+
params?: any;
|
|
17
|
+
error?: TestError;
|
|
18
|
+
}
|
|
19
|
+
export default class WDIOCLInterface extends EventEmitter {
|
|
20
|
+
private _config;
|
|
21
|
+
totalWorkerCnt: number;
|
|
22
|
+
private _isWatchMode;
|
|
23
|
+
hasAnsiSupport: boolean;
|
|
24
|
+
result: {
|
|
25
|
+
finished: number;
|
|
26
|
+
passed: number;
|
|
27
|
+
retries: number;
|
|
28
|
+
failed: number;
|
|
29
|
+
};
|
|
30
|
+
private _jobs;
|
|
31
|
+
private _specFileRetries;
|
|
32
|
+
private _specFileRetriesDelay;
|
|
33
|
+
private _skippedSpecs;
|
|
34
|
+
private _inDebugMode;
|
|
35
|
+
private _start;
|
|
36
|
+
private _messages;
|
|
37
|
+
constructor(_config: Options.Testrunner, totalWorkerCnt: number, _isWatchMode?: boolean);
|
|
38
|
+
setup(): void;
|
|
39
|
+
onStart(): void;
|
|
40
|
+
onSpecRunning(rid: string): void;
|
|
41
|
+
onSpecRetry(rid: string, job?: Workers.Job, retries?: number): void;
|
|
42
|
+
onSpecPass(rid: string, job?: Workers.Job, retries?: number): void;
|
|
43
|
+
onSpecFailure(rid: string, job?: Workers.Job, retries?: number): void;
|
|
44
|
+
onSpecSkip(rid: string, job?: Workers.Job): void;
|
|
45
|
+
onJobComplete(cid: string, job?: Workers.Job, retries?: number, message?: string, _logger?: Function): any;
|
|
46
|
+
onTestError(payload: CLIInterfaceEvent): any[];
|
|
47
|
+
getFilenames(specs?: string[]): string;
|
|
48
|
+
/**
|
|
49
|
+
* add job to interface
|
|
50
|
+
*/
|
|
51
|
+
addJob({ cid, caps, specs, hasTests }: Workers.Job & {
|
|
52
|
+
cid: string;
|
|
53
|
+
}): void;
|
|
54
|
+
/**
|
|
55
|
+
* clear job from interface
|
|
56
|
+
*/
|
|
57
|
+
clearJob({ cid, passed, retries }: {
|
|
58
|
+
cid: string;
|
|
59
|
+
passed: boolean;
|
|
60
|
+
retries: number;
|
|
61
|
+
}): void;
|
|
62
|
+
/**
|
|
63
|
+
* for testing purposes call console log in a static method
|
|
64
|
+
*/
|
|
65
|
+
log(...args: any[]): any[];
|
|
66
|
+
logHookError(error: HookError): any[];
|
|
67
|
+
/**
|
|
68
|
+
* event handler that is triggered when runner sends up events
|
|
69
|
+
*/
|
|
70
|
+
onMessage(event: CLIInterfaceEvent): boolean | void | any[];
|
|
71
|
+
sigintTrigger(): false | any[];
|
|
72
|
+
printReporters(): void;
|
|
73
|
+
printSummary(): any[];
|
|
74
|
+
finalise(): void;
|
|
75
|
+
}
|
|
76
|
+
export {};
|
|
77
|
+
//# sourceMappingURL=interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../src/interface.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAErC,OAAO,KAAK,EAAE,OAAO,EAAgB,OAAO,EAAE,MAAM,aAAa,CAAA;AAEjE,OAAO,EAAiB,SAAS,EAAE,MAAM,SAAS,CAAA;AAIlD,UAAU,SAAS;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,UAAU,iBAAiB;IACvB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,GAAG,CAAA;IACb,MAAM,CAAC,EAAE,GAAG,CAAA;IACZ,KAAK,CAAC,EAAE,SAAS,CAAA;CACpB;AAED,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,YAAY;IAyBjD,OAAO,CAAC,OAAO;IACR,cAAc,EAAE,MAAM;IAC7B,OAAO,CAAC,YAAY;IA1BjB,cAAc,EAAE,OAAO,CAAA;IACvB,MAAM;;;;;MAKZ;IAED,OAAO,CAAC,KAAK,CAAsC;IACnD,OAAO,CAAC,gBAAgB,CAAQ;IAChC,OAAO,CAAC,qBAAqB,CAAQ;IAErC,OAAO,CAAC,aAAa,CAAI;IACzB,OAAO,CAAC,YAAY,CAAQ;IAC5B,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,SAAS,CAMZ;gBAGO,OAAO,EAAE,OAAO,CAAC,UAAU,EAC5B,cAAc,EAAE,MAAM,EACrB,YAAY,UAAQ;IAuBhC,KAAK;IAqBL,OAAO;IAWP,aAAa,CAAE,GAAG,EAAE,MAAM;IAI1B,WAAW,CAAE,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,GAAG,EAAE,OAAO,SAAI;IAKxD,UAAU,CAAE,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,GAAG,EAAE,OAAO,SAAI;IAIvD,aAAa,CAAE,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,GAAG,EAAE,OAAO,SAAI;IAI1D,UAAU,CAAE,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,GAAG;IAI1C,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,OAAO,CAAC,GAAG,EAAE,OAAO,SAAI,EAAE,OAAO,SAAK,EAAE,OAAO,GAAE,QAAmB;IAYrG,WAAW,CAAE,OAAO,EAAE,iBAAiB;IAUvC,YAAY,CAAE,KAAK,GAAE,MAAM,EAAO;IAOlC;;OAEG;IACH,MAAM,CAAE,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,OAAO,CAAC,GAAG,GAAG;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE;IASrE;;OAEG;IACH,QAAQ,CAAE,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;IA2BrF;;OAEG;IACH,GAAG,CAAE,GAAG,IAAI,EAAE,GAAG,EAAE;IAMnB,YAAY,CAAE,KAAK,EAAE,SAAS;IAI9B;;OAEG;IACH,SAAS,CAAE,KAAK,EAAE,iBAAiB;IA8CnC,aAAa;IAgBb,cAAc;IAYd,YAAY;IAaZ,QAAQ;CAQX"}
|