@wdio/cli 8.8.2 → 8.8.4
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/cjs/index.d.ts +2 -0
- package/build/cjs/index.d.ts.map +1 -0
- package/build/cjs/index.js +25 -0
- package/build/cjs/package.json +3 -0
- package/build/launcher.d.ts +20 -23
- package/build/launcher.d.ts.map +1 -1
- package/build/launcher.js +29 -29
- package/build/templates/afterTest.ejs +6 -6
- package/build/templates/wdio.conf.tpl.ejs +33 -33
- package/build/utils.d.ts +2 -2
- package/build/utils.js +2 -2
- package/package.json +17 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cjs/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
class Launcher {
|
|
2
|
+
configFilePath;
|
|
3
|
+
args;
|
|
4
|
+
isWatchMode;
|
|
5
|
+
#esmLauncher;
|
|
6
|
+
constructor(configFilePath, args = {}, isWatchMode = false) {
|
|
7
|
+
this.configFilePath = configFilePath;
|
|
8
|
+
this.args = args;
|
|
9
|
+
this.isWatchMode = isWatchMode;
|
|
10
|
+
import('../launcher.js').then(launcher => this.#esmLauncher = new launcher.default(this.configFilePath, this.args, this.isWatchMode));
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* run sequence
|
|
14
|
+
* @return {Promise} that only gets resolved with either an exitCode or an error
|
|
15
|
+
*/
|
|
16
|
+
async run() {
|
|
17
|
+
return this.#esmLauncher.run();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
async function run() {
|
|
21
|
+
const { run } = await import('../index.js');
|
|
22
|
+
return run();
|
|
23
|
+
}
|
|
24
|
+
module.exports = { Launcher, run };
|
|
25
|
+
|
package/build/launcher.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ConfigParser } from '@wdio/config';
|
|
2
|
-
import type {
|
|
2
|
+
import type { Services } from '@wdio/types';
|
|
3
3
|
import CLInterface from './interface.js';
|
|
4
4
|
import type { RunCommandArguments } from './types.js';
|
|
5
|
-
interface EndMessage {
|
|
5
|
+
export interface EndMessage {
|
|
6
6
|
cid: string;
|
|
7
7
|
exitCode: number;
|
|
8
8
|
specs: string[];
|
|
@@ -27,65 +27,62 @@ declare class Launcher {
|
|
|
27
27
|
constructor(_configFilePath: string, _args?: Partial<RunCommandArguments>, _isWatchMode?: boolean);
|
|
28
28
|
/**
|
|
29
29
|
* run sequence
|
|
30
|
-
* @return {Promise} that only gets
|
|
30
|
+
* @return {Promise} that only gets resolved with either an exitCode or an error
|
|
31
31
|
*/
|
|
32
|
-
run(): Promise<number>;
|
|
32
|
+
run(): Promise<undefined | number>;
|
|
33
33
|
/**
|
|
34
34
|
* run without triggering onPrepare/onComplete hooks
|
|
35
35
|
*/
|
|
36
|
-
|
|
36
|
+
private _runMode;
|
|
37
37
|
/**
|
|
38
38
|
* Format the specs into an array of objects with files and retries
|
|
39
39
|
*/
|
|
40
|
-
|
|
41
|
-
files: string[];
|
|
42
|
-
retries: number;
|
|
43
|
-
}[];
|
|
40
|
+
private _formatSpecs;
|
|
44
41
|
/**
|
|
45
42
|
* run multiple single remote tests
|
|
46
43
|
* @return {Boolean} true if all specs have been run and all instances have finished
|
|
47
44
|
*/
|
|
48
|
-
|
|
45
|
+
private _runSpecs;
|
|
49
46
|
/**
|
|
50
47
|
* gets number of all running instances
|
|
51
48
|
* @return {number} number of running instances
|
|
52
49
|
*/
|
|
53
|
-
|
|
50
|
+
private _getNumberOfRunningInstances;
|
|
54
51
|
/**
|
|
55
52
|
* get number of total specs left to complete whole suites
|
|
56
53
|
* @return {number} specs left to complete suite
|
|
57
54
|
*/
|
|
58
|
-
|
|
55
|
+
private _getNumberOfSpecsLeft;
|
|
59
56
|
/**
|
|
60
57
|
* Start instance in a child process.
|
|
61
58
|
* @param {Array} specs Specs to run
|
|
62
|
-
* @param {
|
|
63
|
-
* @param {
|
|
64
|
-
* @param {
|
|
59
|
+
* @param {number} cid Capabilities ID
|
|
60
|
+
* @param {string} rid Runner ID override
|
|
61
|
+
* @param {number} retries Number of retries remaining
|
|
65
62
|
*/
|
|
66
|
-
|
|
63
|
+
private _startInstance;
|
|
67
64
|
private _workerHookError;
|
|
68
65
|
/**
|
|
69
66
|
* generates a runner id
|
|
70
|
-
* @param {
|
|
67
|
+
* @param {number} cid capability id (unique identifier for a capability)
|
|
71
68
|
* @return {String} runner id (combination of cid and test id e.g. 0a, 0b, 1a, 1b ...)
|
|
72
69
|
*/
|
|
73
|
-
|
|
70
|
+
private _getRunnerId;
|
|
74
71
|
/**
|
|
75
72
|
* Close test runner process once all child processes have exited
|
|
76
|
-
* @param {
|
|
77
|
-
* @param {
|
|
73
|
+
* @param {number} cid Capabilities ID
|
|
74
|
+
* @param {number} exitCode exit code of child process
|
|
78
75
|
* @param {Array} specs Specs that were run
|
|
79
|
-
* @param {
|
|
76
|
+
* @param {number} retries Number or retries remaining
|
|
80
77
|
*/
|
|
81
|
-
|
|
78
|
+
private _endHandler;
|
|
82
79
|
/**
|
|
83
80
|
* We need exitHandler to catch SIGINT / SIGTERM events.
|
|
84
81
|
* Make sure all started selenium sessions get closed properly and prevent
|
|
85
82
|
* having dead driver processes. To do so let the runner end its Selenium
|
|
86
83
|
* session first before killing
|
|
87
84
|
*/
|
|
88
|
-
|
|
85
|
+
private _exitHandler;
|
|
89
86
|
/**
|
|
90
87
|
* returns true if user stopped watch mode, ex with ctrl+c
|
|
91
88
|
* @returns {boolean}
|
package/build/launcher.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAE3C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAE3C,OAAO,KAAK,EAAyB,QAAQ,EAAE,MAAM,aAAa,CAAA;AAElE,OAAO,WAAW,MAAM,gBAAgB,CAAA;AAGxC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAkBrD,MAAM,WAAW,UAAU;IACvB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,EAAE,MAAM,CAAA;CAClB;AAED,cAAM,QAAQ;IAiBN,OAAO,CAAC,eAAe;IACvB,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,YAAY;IAlBjB,YAAY,EAAE,YAAY,CAAA;IAC1B,aAAa,UAAQ;IACrB,MAAM,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAA;IAChC,SAAS,CAAC,EAAE,WAAW,CAAA;IAE9B,OAAO,CAAC,SAAS,CAAI;IACrB,OAAO,CAAC,wBAAwB,CAAQ;IACxC,OAAO,CAAC,SAAS,CAAiB;IAClC,OAAO,CAAC,IAAI,CAAe;IAC3B,OAAO,CAAC,cAAc,CAAI;IAC1B,OAAO,CAAC,aAAa,CAAI;IAEzB,OAAO,CAAC,SAAS,CAAC,CAA4B;IAC9C,OAAO,CAAC,QAAQ,CAAC,CAAU;gBAGf,eAAe,EAAE,MAAM,EACvB,KAAK,GAAE,OAAO,CAAC,mBAAmB,CAAM,EACxC,YAAY,UAAQ;IAKhC;;;OAGG;IACG,GAAG,IAAI,OAAO,CAAC,SAAS,GAAG,MAAM,CAAC;IAiGxC;;OAEG;IACH,OAAO,CAAC,QAAQ;IAyEhB;;OAEG;IACH,OAAO,CAAC,YAAY;IAepB;;;OAGG;IACH,OAAO,CAAC,SAAS;IAmEjB;;;OAGG;IACH,OAAO,CAAC,4BAA4B;IAIpC;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAI7B;;;;;;OAMG;YACW,cAAc;IA8F5B,OAAO,CAAC,gBAAgB;IAWxB;;;;OAIG;IACH,OAAO,CAAC,YAAY;IAOpB;;;;;;OAMG;YACW,WAAW;IA0DzB;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAcpB;;;OAGG;IACH,OAAO,CAAC,kBAAkB;CAG7B;AAED,eAAe,QAAQ,CAAA"}
|
package/build/launcher.js
CHANGED
|
@@ -31,7 +31,7 @@ class Launcher {
|
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* run sequence
|
|
34
|
-
* @return {Promise} that only gets
|
|
34
|
+
* @return {Promise} that only gets resolved with either an exitCode or an error
|
|
35
35
|
*/
|
|
36
36
|
async run() {
|
|
37
37
|
await this.configParser.initialize(this._args);
|
|
@@ -61,7 +61,7 @@ class Launcher {
|
|
|
61
61
|
/**
|
|
62
62
|
* catches ctrl+c event
|
|
63
63
|
*/
|
|
64
|
-
exitHook(this.
|
|
64
|
+
exitHook(this._exitHandler.bind(this));
|
|
65
65
|
let exitCode = 0;
|
|
66
66
|
let error = undefined;
|
|
67
67
|
try {
|
|
@@ -80,7 +80,7 @@ class Launcher {
|
|
|
80
80
|
log.info('Run onPrepare hook');
|
|
81
81
|
await runLauncherHook(config.onPrepare, config, caps);
|
|
82
82
|
await runServiceHook(this._launcher, 'onPrepare', config, caps);
|
|
83
|
-
exitCode = await this.
|
|
83
|
+
exitCode = await this._runMode(config, caps);
|
|
84
84
|
/**
|
|
85
85
|
* run onComplete hook
|
|
86
86
|
* Even if it fails we still want to see result and end logger stream.
|
|
@@ -117,7 +117,7 @@ class Launcher {
|
|
|
117
117
|
/**
|
|
118
118
|
* run without triggering onPrepare/onComplete hooks
|
|
119
119
|
*/
|
|
120
|
-
|
|
120
|
+
_runMode(config, caps) {
|
|
121
121
|
/**
|
|
122
122
|
* fail if no caps were found
|
|
123
123
|
*/
|
|
@@ -142,7 +142,7 @@ class Launcher {
|
|
|
142
142
|
this._schedule.push({
|
|
143
143
|
cid: cid++,
|
|
144
144
|
caps: caps,
|
|
145
|
-
specs: this.
|
|
145
|
+
specs: this._formatSpecs(caps, specFileRetries),
|
|
146
146
|
availableInstances: config.maxInstances || 1,
|
|
147
147
|
runningInstances: 0
|
|
148
148
|
});
|
|
@@ -161,7 +161,7 @@ class Launcher {
|
|
|
161
161
|
this._schedule.push({
|
|
162
162
|
cid: cid++,
|
|
163
163
|
caps: capabilities,
|
|
164
|
-
specs: this.
|
|
164
|
+
specs: this._formatSpecs(capabilities, specFileRetries),
|
|
165
165
|
availableInstances,
|
|
166
166
|
runningInstances: 0
|
|
167
167
|
});
|
|
@@ -179,7 +179,7 @@ class Launcher {
|
|
|
179
179
|
/**
|
|
180
180
|
* return immediately if no spec was run
|
|
181
181
|
*/
|
|
182
|
-
if (this.
|
|
182
|
+
if (this._runSpecs()) {
|
|
183
183
|
resolve(0);
|
|
184
184
|
}
|
|
185
185
|
});
|
|
@@ -187,7 +187,7 @@ class Launcher {
|
|
|
187
187
|
/**
|
|
188
188
|
* Format the specs into an array of objects with files and retries
|
|
189
189
|
*/
|
|
190
|
-
|
|
190
|
+
_formatSpecs(capabilities, specFileRetries) {
|
|
191
191
|
const files = this.configParser.getSpecs(capabilities.specs, capabilities.exclude);
|
|
192
192
|
return files.map(file => {
|
|
193
193
|
if (typeof file === 'string') {
|
|
@@ -205,7 +205,7 @@ class Launcher {
|
|
|
205
205
|
* run multiple single remote tests
|
|
206
206
|
* @return {Boolean} true if all specs have been run and all instances have finished
|
|
207
207
|
*/
|
|
208
|
-
|
|
208
|
+
_runSpecs() {
|
|
209
209
|
/**
|
|
210
210
|
* stop spawning new processes when CTRL+C was triggered
|
|
211
211
|
*/
|
|
@@ -213,7 +213,7 @@ class Launcher {
|
|
|
213
213
|
return true;
|
|
214
214
|
}
|
|
215
215
|
const config = this.configParser.getConfig();
|
|
216
|
-
while (this.
|
|
216
|
+
while (this._getNumberOfRunningInstances() < config.maxInstances) {
|
|
217
217
|
const schedulableCaps = this._schedule
|
|
218
218
|
/**
|
|
219
219
|
* bail if number of errors exceeds allowed
|
|
@@ -232,7 +232,7 @@ class Launcher {
|
|
|
232
232
|
/**
|
|
233
233
|
* make sure complete number of running instances is not higher than general maxInstances number
|
|
234
234
|
*/
|
|
235
|
-
.filter(() => this.
|
|
235
|
+
.filter(() => this._getNumberOfRunningInstances() < config.maxInstances)
|
|
236
236
|
/**
|
|
237
237
|
* make sure the capability has available capacities
|
|
238
238
|
*/
|
|
@@ -252,34 +252,34 @@ class Launcher {
|
|
|
252
252
|
break;
|
|
253
253
|
}
|
|
254
254
|
const specs = schedulableCaps[0].specs.shift();
|
|
255
|
-
this.
|
|
255
|
+
this._startInstance(specs.files, schedulableCaps[0].caps, schedulableCaps[0].cid, specs.rid, specs.retries);
|
|
256
256
|
schedulableCaps[0].availableInstances--;
|
|
257
257
|
schedulableCaps[0].runningInstances++;
|
|
258
258
|
}
|
|
259
|
-
return this.
|
|
259
|
+
return this._getNumberOfRunningInstances() === 0 && this._getNumberOfSpecsLeft() === 0;
|
|
260
260
|
}
|
|
261
261
|
/**
|
|
262
262
|
* gets number of all running instances
|
|
263
263
|
* @return {number} number of running instances
|
|
264
264
|
*/
|
|
265
|
-
|
|
265
|
+
_getNumberOfRunningInstances() {
|
|
266
266
|
return this._schedule.map((a) => a.runningInstances).reduce((a, b) => a + b);
|
|
267
267
|
}
|
|
268
268
|
/**
|
|
269
269
|
* get number of total specs left to complete whole suites
|
|
270
270
|
* @return {number} specs left to complete suite
|
|
271
271
|
*/
|
|
272
|
-
|
|
272
|
+
_getNumberOfSpecsLeft() {
|
|
273
273
|
return this._schedule.map((a) => a.specs.length).reduce((a, b) => a + b);
|
|
274
274
|
}
|
|
275
275
|
/**
|
|
276
276
|
* Start instance in a child process.
|
|
277
277
|
* @param {Array} specs Specs to run
|
|
278
|
-
* @param {
|
|
279
|
-
* @param {
|
|
280
|
-
* @param {
|
|
278
|
+
* @param {number} cid Capabilities ID
|
|
279
|
+
* @param {string} rid Runner ID override
|
|
280
|
+
* @param {number} retries Number of retries remaining
|
|
281
281
|
*/
|
|
282
|
-
async
|
|
282
|
+
async _startInstance(specs, caps, cid, rid, retries) {
|
|
283
283
|
if (!this.runner || !this.interface) {
|
|
284
284
|
throw new Error('Internal Error: no runner initialised, call run() first');
|
|
285
285
|
}
|
|
@@ -290,7 +290,7 @@ class Launcher {
|
|
|
290
290
|
}
|
|
291
291
|
// Retried tests receive the cid of the failing test as rid
|
|
292
292
|
// so they can run with the same cid of the failing test.
|
|
293
|
-
const runnerId = rid || this.
|
|
293
|
+
const runnerId = rid || this._getRunnerId(cid);
|
|
294
294
|
const processNumber = this._runnerStarted + 1;
|
|
295
295
|
// process.debugPort defaults to 5858 and is set even when process
|
|
296
296
|
// is not being debugged.
|
|
@@ -352,7 +352,7 @@ class Launcher {
|
|
|
352
352
|
});
|
|
353
353
|
worker.on('message', this.interface.onMessage.bind(this.interface));
|
|
354
354
|
worker.on('error', this.interface.onMessage.bind(this.interface));
|
|
355
|
-
worker.on('exit', this.
|
|
355
|
+
worker.on('exit', this._endHandler.bind(this));
|
|
356
356
|
}
|
|
357
357
|
_workerHookError(error) {
|
|
358
358
|
if (!this.interface) {
|
|
@@ -365,10 +365,10 @@ class Launcher {
|
|
|
365
365
|
}
|
|
366
366
|
/**
|
|
367
367
|
* generates a runner id
|
|
368
|
-
* @param {
|
|
368
|
+
* @param {number} cid capability id (unique identifier for a capability)
|
|
369
369
|
* @return {String} runner id (combination of cid and test id e.g. 0a, 0b, 1a, 1b ...)
|
|
370
370
|
*/
|
|
371
|
-
|
|
371
|
+
_getRunnerId(cid) {
|
|
372
372
|
if (!this._rid[cid]) {
|
|
373
373
|
this._rid[cid] = 0;
|
|
374
374
|
}
|
|
@@ -376,12 +376,12 @@ class Launcher {
|
|
|
376
376
|
}
|
|
377
377
|
/**
|
|
378
378
|
* Close test runner process once all child processes have exited
|
|
379
|
-
* @param {
|
|
380
|
-
* @param {
|
|
379
|
+
* @param {number} cid Capabilities ID
|
|
380
|
+
* @param {number} exitCode exit code of child process
|
|
381
381
|
* @param {Array} specs Specs that were run
|
|
382
|
-
* @param {
|
|
382
|
+
* @param {number} retries Number or retries remaining
|
|
383
383
|
*/
|
|
384
|
-
async
|
|
384
|
+
async _endHandler({ cid: rid, exitCode, specs, retries }) {
|
|
385
385
|
const passed = this._isWatchModeHalted() || exitCode === 0;
|
|
386
386
|
if (!passed && retries > 0) {
|
|
387
387
|
// Default is true, so test for false explicitly
|
|
@@ -416,7 +416,7 @@ class Launcher {
|
|
|
416
416
|
* - there are specs to be executed
|
|
417
417
|
* - we are running watch mode
|
|
418
418
|
*/
|
|
419
|
-
const shouldRunSpecs = this.
|
|
419
|
+
const shouldRunSpecs = this._runSpecs();
|
|
420
420
|
const inWatchMode = this._isWatchMode && !this._hasTriggeredExitRoutine;
|
|
421
421
|
if (!shouldRunSpecs || inWatchMode) {
|
|
422
422
|
/**
|
|
@@ -437,7 +437,7 @@ class Launcher {
|
|
|
437
437
|
* having dead driver processes. To do so let the runner end its Selenium
|
|
438
438
|
* session first before killing
|
|
439
439
|
*/
|
|
440
|
-
|
|
440
|
+
_exitHandler(callback) {
|
|
441
441
|
if (!callback || !this.runner || !this.interface) {
|
|
442
442
|
return;
|
|
443
443
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Function to be executed after a test (in Mocha/Jasmine only)
|
|
3
|
-
* @param {
|
|
4
|
-
* @param {
|
|
3
|
+
* @param {object} test test object
|
|
4
|
+
* @param {object} context scope object the test was executed with
|
|
5
5
|
* @param {Error} result.error error object in case the test fails, otherwise `undefined`
|
|
6
|
-
* @param {
|
|
7
|
-
* @param {
|
|
8
|
-
* @param {
|
|
9
|
-
* @param {
|
|
6
|
+
* @param {*} result.result return object of test function
|
|
7
|
+
* @param {number} result.duration duration of test
|
|
8
|
+
* @param {boolean} result.passed true if test has passed, otherwise false
|
|
9
|
+
* @param {object} result.retries informations to spec related retries, e.g. `{ attempts: 0, limit: 0 }`
|
|
10
10
|
*/<%
|
|
11
11
|
if (reporters.length && reporters.includes('allure')) {%>
|
|
12
12
|
afterTest: async function(test, context, { error, result, duration, passed, retries }) {
|
|
@@ -271,7 +271,7 @@ export const config: Options.Testrunner = {<%
|
|
|
271
271
|
// resolved to continue.
|
|
272
272
|
/**
|
|
273
273
|
* Gets executed once before all workers get launched.
|
|
274
|
-
* @param {
|
|
274
|
+
* @param {object} config wdio configuration object
|
|
275
275
|
* @param {Array.<Object>} capabilities list of capabilities details
|
|
276
276
|
*/
|
|
277
277
|
// onPrepare: function (config, capabilities) {
|
|
@@ -279,30 +279,30 @@ export const config: Options.Testrunner = {<%
|
|
|
279
279
|
/**
|
|
280
280
|
* Gets executed before a worker process is spawned and can be used to initialise specific service
|
|
281
281
|
* for that worker as well as modify runtime environments in an async fashion.
|
|
282
|
-
* @param {
|
|
283
|
-
* @param {
|
|
284
|
-
* @param {
|
|
285
|
-
* @param {
|
|
286
|
-
* @param {
|
|
282
|
+
* @param {string} cid capability id (e.g 0-0)
|
|
283
|
+
* @param {object} caps object containing capabilities for session that will be spawn in the worker
|
|
284
|
+
* @param {object} specs specs to be run in the worker process
|
|
285
|
+
* @param {object} args object that will be merged with the main configuration once worker is initialized
|
|
286
|
+
* @param {object} execArgv list of string arguments passed to the worker process
|
|
287
287
|
*/
|
|
288
288
|
// onWorkerStart: function (cid, caps, specs, args, execArgv) {
|
|
289
289
|
// },
|
|
290
290
|
/**
|
|
291
291
|
* Gets executed just after a worker process has exited.
|
|
292
|
-
* @param {
|
|
293
|
-
* @param {
|
|
294
|
-
* @param {
|
|
295
|
-
* @param {
|
|
292
|
+
* @param {string} cid capability id (e.g 0-0)
|
|
293
|
+
* @param {number} exitCode 0 - success, 1 - fail
|
|
294
|
+
* @param {object} specs specs to be run in the worker process
|
|
295
|
+
* @param {number} retries number of retries used
|
|
296
296
|
*/
|
|
297
297
|
// onWorkerEnd: function (cid, exitCode, specs, retries) {
|
|
298
298
|
// },
|
|
299
299
|
/**
|
|
300
300
|
* Gets executed just before initialising the webdriver session and test framework. It allows you
|
|
301
301
|
* to manipulate configurations depending on the capability or spec.
|
|
302
|
-
* @param {
|
|
302
|
+
* @param {object} config wdio configuration object
|
|
303
303
|
* @param {Array.<Object>} capabilities list of capabilities details
|
|
304
304
|
* @param {Array.<String>} specs List of spec file paths that are to be run
|
|
305
|
-
* @param {
|
|
305
|
+
* @param {string} cid worker id (e.g. 0-0)
|
|
306
306
|
*/
|
|
307
307
|
// beforeSession: function (config, capabilities, specs, cid) {
|
|
308
308
|
// },
|
|
@@ -311,13 +311,13 @@ export const config: Options.Testrunner = {<%
|
|
|
311
311
|
* variables like `browser`. It is the perfect place to define custom commands.
|
|
312
312
|
* @param {Array.<Object>} capabilities list of capabilities details
|
|
313
313
|
* @param {Array.<String>} specs List of spec file paths that are to be run
|
|
314
|
-
* @param {
|
|
314
|
+
* @param {object} browser instance of created browser/device session
|
|
315
315
|
*/
|
|
316
316
|
// before: function (capabilities, specs) {
|
|
317
317
|
// },
|
|
318
318
|
/**
|
|
319
319
|
* Runs before a WebdriverIO command gets executed.
|
|
320
|
-
* @param {
|
|
320
|
+
* @param {string} commandName hook command name
|
|
321
321
|
* @param {Array} args arguments that command would receive
|
|
322
322
|
*/
|
|
323
323
|
// beforeCommand: function (commandName, args) {
|
|
@@ -325,7 +325,7 @@ export const config: Options.Testrunner = {<%
|
|
|
325
325
|
if(answers.framework === 'mocha' || answers.framework === 'jasmine') { %>
|
|
326
326
|
/**
|
|
327
327
|
* Hook that gets executed before the suite starts
|
|
328
|
-
* @param {
|
|
328
|
+
* @param {object} suite suite details
|
|
329
329
|
*/
|
|
330
330
|
// beforeSuite: function (suite) {
|
|
331
331
|
// },
|
|
@@ -349,7 +349,7 @@ export const config: Options.Testrunner = {<%
|
|
|
349
349
|
<%- include('afterTest', { reporters: answers.reporters }) %>
|
|
350
350
|
/**
|
|
351
351
|
* Hook that gets executed after the suite has ended
|
|
352
|
-
* @param {
|
|
352
|
+
* @param {object} suite suite details
|
|
353
353
|
*/
|
|
354
354
|
// afterSuite: function (suite) {
|
|
355
355
|
// },<% }
|
|
@@ -358,7 +358,7 @@ export const config: Options.Testrunner = {<%
|
|
|
358
358
|
* Cucumber Hooks
|
|
359
359
|
*
|
|
360
360
|
* Runs before a Cucumber Feature.
|
|
361
|
-
* @param {
|
|
361
|
+
* @param {string} uri path to feature file
|
|
362
362
|
* @param {GherkinDocument.IFeature} feature Cucumber feature object
|
|
363
363
|
*/
|
|
364
364
|
// beforeFeature: function (uri, feature) {
|
|
@@ -367,7 +367,7 @@ export const config: Options.Testrunner = {<%
|
|
|
367
367
|
*
|
|
368
368
|
* Runs before a Cucumber Scenario.
|
|
369
369
|
* @param {ITestCaseHookParameter} world world object containing information on pickle and test step
|
|
370
|
-
* @param {
|
|
370
|
+
* @param {object} context Cucumber World object
|
|
371
371
|
*/
|
|
372
372
|
// beforeScenario: function (world, context) {
|
|
373
373
|
// },
|
|
@@ -376,7 +376,7 @@ export const config: Options.Testrunner = {<%
|
|
|
376
376
|
* Runs before a Cucumber Step.
|
|
377
377
|
* @param {Pickle.IPickleStep} step step data
|
|
378
378
|
* @param {IPickle} scenario scenario pickle
|
|
379
|
-
* @param {
|
|
379
|
+
* @param {object} context Cucumber World object
|
|
380
380
|
*/
|
|
381
381
|
// beforeStep: function (step, scenario, context) {
|
|
382
382
|
// },
|
|
@@ -385,11 +385,11 @@ export const config: Options.Testrunner = {<%
|
|
|
385
385
|
* Runs after a Cucumber Step.
|
|
386
386
|
* @param {Pickle.IPickleStep} step step data
|
|
387
387
|
* @param {IPickle} scenario scenario pickle
|
|
388
|
-
* @param {
|
|
388
|
+
* @param {object} result results object containing scenario results
|
|
389
389
|
* @param {boolean} result.passed true if scenario has passed
|
|
390
390
|
* @param {string} result.error error stack if scenario failed
|
|
391
391
|
* @param {number} result.duration duration of scenario in milliseconds
|
|
392
|
-
* @param {
|
|
392
|
+
* @param {object} context Cucumber World object
|
|
393
393
|
*/
|
|
394
394
|
// afterStep: function (step, scenario, result, context) {
|
|
395
395
|
// },
|
|
@@ -397,18 +397,18 @@ export const config: Options.Testrunner = {<%
|
|
|
397
397
|
*
|
|
398
398
|
* Runs after a Cucumber Scenario.
|
|
399
399
|
* @param {ITestCaseHookParameter} world world object containing information on pickle and test step
|
|
400
|
-
* @param {
|
|
400
|
+
* @param {object} result results object containing scenario results
|
|
401
401
|
* @param {boolean} result.passed true if scenario has passed
|
|
402
402
|
* @param {string} result.error error stack if scenario failed
|
|
403
403
|
* @param {number} result.duration duration of scenario in milliseconds
|
|
404
|
-
* @param {
|
|
404
|
+
* @param {object} context Cucumber World object
|
|
405
405
|
*/
|
|
406
406
|
// afterScenario: function (world, result, context) {
|
|
407
407
|
// },
|
|
408
408
|
/**
|
|
409
409
|
*
|
|
410
410
|
* Runs after a Cucumber Feature.
|
|
411
|
-
* @param {
|
|
411
|
+
* @param {string} uri path to feature file
|
|
412
412
|
* @param {GherkinDocument.IFeature} feature Cucumber feature object
|
|
413
413
|
*/
|
|
414
414
|
// afterFeature: function (uri, feature) {
|
|
@@ -416,17 +416,17 @@ export const config: Options.Testrunner = {<%
|
|
|
416
416
|
<% } %>
|
|
417
417
|
/**
|
|
418
418
|
* Runs after a WebdriverIO command gets executed
|
|
419
|
-
* @param {
|
|
419
|
+
* @param {string} commandName hook command name
|
|
420
420
|
* @param {Array} args arguments that command would receive
|
|
421
|
-
* @param {
|
|
422
|
-
* @param {
|
|
421
|
+
* @param {number} result 0 - command success, 1 - command error
|
|
422
|
+
* @param {object} error error object if any
|
|
423
423
|
*/
|
|
424
424
|
// afterCommand: function (commandName, args, result, error) {
|
|
425
425
|
// },
|
|
426
426
|
/**
|
|
427
427
|
* Gets executed after all tests are done. You still have access to all global variables from
|
|
428
428
|
* the test.
|
|
429
|
-
* @param {
|
|
429
|
+
* @param {number} result 0 - test pass, 1 - test fail
|
|
430
430
|
* @param {Array.<Object>} capabilities list of capabilities details
|
|
431
431
|
* @param {Array.<String>} specs List of spec file paths that ran
|
|
432
432
|
*/
|
|
@@ -434,7 +434,7 @@ export const config: Options.Testrunner = {<%
|
|
|
434
434
|
// },
|
|
435
435
|
/**
|
|
436
436
|
* Gets executed right after terminating the webdriver session.
|
|
437
|
-
* @param {
|
|
437
|
+
* @param {object} config wdio configuration object
|
|
438
438
|
* @param {Array.<Object>} capabilities list of capabilities details
|
|
439
439
|
* @param {Array.<String>} specs List of spec file paths that ran
|
|
440
440
|
*/
|
|
@@ -443,8 +443,8 @@ export const config: Options.Testrunner = {<%
|
|
|
443
443
|
/**
|
|
444
444
|
* Gets executed after all workers got shut down and the process is about to exit. An error
|
|
445
445
|
* thrown in the onComplete hook will result in the test run failing.
|
|
446
|
-
* @param {
|
|
447
|
-
* @param {
|
|
446
|
+
* @param {object} exitCode 0 - success, 1 - fail
|
|
447
|
+
* @param {object} config wdio configuration object
|
|
448
448
|
* @param {Array.<Object>} capabilities list of capabilities details
|
|
449
449
|
* @param {<Object>} results object containing test results
|
|
450
450
|
*/
|
|
@@ -452,8 +452,8 @@ export const config: Options.Testrunner = {<%
|
|
|
452
452
|
// },
|
|
453
453
|
/**
|
|
454
454
|
* Gets executed when a refresh happens.
|
|
455
|
-
* @param {
|
|
456
|
-
* @param {
|
|
455
|
+
* @param {string} oldSessionId session ID of the old session
|
|
456
|
+
* @param {string} newSessionId session ID of the new session
|
|
457
457
|
*/
|
|
458
458
|
// onReload: function(oldSessionId, newSessionId) {
|
|
459
459
|
// }
|
package/build/utils.d.ts
CHANGED
|
@@ -15,8 +15,8 @@ export declare function runServiceHook(launcher: Services.ServiceInstance[], hoo
|
|
|
15
15
|
/**
|
|
16
16
|
* Run hook in service launcher
|
|
17
17
|
* @param {Array|Function} hook - can be array of functions or single function
|
|
18
|
-
* @param {
|
|
19
|
-
* @param {
|
|
18
|
+
* @param {object} config
|
|
19
|
+
* @param {object} capabilities
|
|
20
20
|
*/
|
|
21
21
|
export declare function runLauncherHook(hook: Function | Function[], ...args: any[]): Promise<void | any[]>;
|
|
22
22
|
/**
|
package/build/utils.js
CHANGED
|
@@ -62,8 +62,8 @@ export async function runServiceHook(launcher, hookName, ...args) {
|
|
|
62
62
|
/**
|
|
63
63
|
* Run hook in service launcher
|
|
64
64
|
* @param {Array|Function} hook - can be array of functions or single function
|
|
65
|
-
* @param {
|
|
66
|
-
* @param {
|
|
65
|
+
* @param {object} config
|
|
66
|
+
* @param {object} capabilities
|
|
67
67
|
*/
|
|
68
68
|
export async function runLauncherHook(hook, ...args) {
|
|
69
69
|
if (typeof hook === 'function') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/cli",
|
|
3
|
-
"version": "8.8.
|
|
3
|
+
"version": "8.8.4",
|
|
4
4
|
"description": "WebdriverIO testrunner command line interface",
|
|
5
5
|
"author": "Christian Bromann <mail@bromann.dev>",
|
|
6
6
|
"homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-cli",
|
|
@@ -28,21 +28,30 @@
|
|
|
28
28
|
"bugs": {
|
|
29
29
|
"url": "https://github.com/webdriverio/webdriverio/issues"
|
|
30
30
|
},
|
|
31
|
+
"main": "./build/cjs/index.js",
|
|
31
32
|
"type": "module",
|
|
33
|
+
"module": "./build/index.js",
|
|
32
34
|
"types": "./build/index.d.ts",
|
|
33
35
|
"exports": {
|
|
34
|
-
".":
|
|
36
|
+
".": [
|
|
37
|
+
{
|
|
38
|
+
"types": "./build/index.d.ts",
|
|
39
|
+
"import": "./build/index.js",
|
|
40
|
+
"require": "./build/cjs/index.js"
|
|
41
|
+
},
|
|
42
|
+
"./build/cjs/index.js"
|
|
43
|
+
],
|
|
35
44
|
"./package.json": "./package.json"
|
|
36
45
|
},
|
|
37
46
|
"typeScriptVersion": "3.8.3",
|
|
38
47
|
"dependencies": {
|
|
39
48
|
"@types/node": "^18.0.0",
|
|
40
|
-
"@wdio/config": "8.8.
|
|
41
|
-
"@wdio/globals": "8.8.
|
|
49
|
+
"@wdio/config": "8.8.4",
|
|
50
|
+
"@wdio/globals": "8.8.4",
|
|
42
51
|
"@wdio/logger": "8.6.6",
|
|
43
52
|
"@wdio/protocols": "8.8.1",
|
|
44
|
-
"@wdio/types": "8.8.
|
|
45
|
-
"@wdio/utils": "8.8.
|
|
53
|
+
"@wdio/types": "8.8.4",
|
|
54
|
+
"@wdio/utils": "8.8.4",
|
|
46
55
|
"async-exit-hook": "^2.0.1",
|
|
47
56
|
"chalk": "^5.0.1",
|
|
48
57
|
"chokidar": "^3.5.3",
|
|
@@ -56,7 +65,7 @@
|
|
|
56
65
|
"lodash.union": "^4.6.0",
|
|
57
66
|
"read-pkg-up": "9.1.0",
|
|
58
67
|
"recursive-readdir": "^2.2.2",
|
|
59
|
-
"webdriverio": "8.8.
|
|
68
|
+
"webdriverio": "8.8.4",
|
|
60
69
|
"yargs": "^17.5.1",
|
|
61
70
|
"yarn-install": "^1.0.0"
|
|
62
71
|
},
|
|
@@ -73,5 +82,5 @@
|
|
|
73
82
|
"publishConfig": {
|
|
74
83
|
"access": "public"
|
|
75
84
|
},
|
|
76
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "e88a296000de70344fbf19d0d63a54cb1a617427"
|
|
77
86
|
}
|