@wdio/utils 8.22.0 → 8.23.1
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/index.d.ts +3 -3
- package/build/index.js +3 -3
- package/build/{initialisePlugin.d.ts → initializePlugin.d.ts} +3 -3
- package/build/initializePlugin.d.ts.map +1 -0
- package/build/{initialisePlugin.js → initializePlugin.js} +2 -2
- package/build/{initialiseServices.d.ts → initializeServices.d.ts} +5 -5
- package/build/{initialiseServices.d.ts.map → initializeServices.d.ts.map} +1 -1
- package/build/{initialiseServices.js → initializeServices.js} +23 -23
- package/build/monad.d.ts +1 -4
- package/build/monad.d.ts.map +1 -1
- package/build/monad.js +1 -9
- package/build/node/utils.d.ts.map +1 -1
- package/build/node/utils.js +9 -2
- package/build/test-framework/testFnWrapper.d.ts +6 -4
- package/build/test-framework/testFnWrapper.d.ts.map +1 -1
- package/build/test-framework/testFnWrapper.js +6 -4
- package/build/utils.js +1 -1
- package/package.json +3 -3
- package/build/initialisePlugin.d.ts.map +0 -1
package/build/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import webdriverMonad from './monad.js';
|
|
2
|
-
import
|
|
2
|
+
import initializePlugin from './initializePlugin.js';
|
|
3
3
|
import { startWebDriver } from './startWebDriver.js';
|
|
4
|
-
import {
|
|
4
|
+
import { initializeWorkerService, initializeLauncherService } from './initializeServices.js';
|
|
5
5
|
import { commandCallStructure, isValidParameter, getArgumentType, safeImport, isFunctionAsync, transformCommandLogResult, sleep, isAppiumCapability } from './utils.js';
|
|
6
6
|
import { wrapCommand, executeHooksWithArgs, executeAsync } from './shim.js';
|
|
7
7
|
import { testFnWrapper, wrapGlobalTestMethod } from './test-framework/index.js';
|
|
8
8
|
import { isW3C, capabilitiesEnvironmentDetector, sessionEnvironmentDetector, devtoolsEnvironmentDetector } from './envDetector.js';
|
|
9
9
|
import { UNICODE_CHARACTERS, HOOK_DEFINITION } from './constants.js';
|
|
10
|
-
export { startWebDriver,
|
|
10
|
+
export { startWebDriver, initializePlugin, initializeLauncherService, initializeWorkerService, isFunctionAsync, transformCommandLogResult, webdriverMonad, commandCallStructure, isValidParameter, getArgumentType, safeImport, sleep, isAppiumCapability,
|
|
11
11
|
/**
|
|
12
12
|
* runner shim
|
|
13
13
|
*/
|
package/build/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/* istanbul ignore file */
|
|
2
2
|
import webdriverMonad from './monad.js';
|
|
3
|
-
import
|
|
3
|
+
import initializePlugin from './initializePlugin.js';
|
|
4
4
|
import { startWebDriver } from './startWebDriver.js';
|
|
5
|
-
import {
|
|
5
|
+
import { initializeWorkerService, initializeLauncherService } from './initializeServices.js';
|
|
6
6
|
import { commandCallStructure, isValidParameter, getArgumentType, safeImport, isFunctionAsync, transformCommandLogResult, sleep, isAppiumCapability } from './utils.js';
|
|
7
7
|
import { wrapCommand, executeHooksWithArgs, executeAsync } from './shim.js';
|
|
8
8
|
import { testFnWrapper, wrapGlobalTestMethod } from './test-framework/index.js';
|
|
9
9
|
import { isW3C, capabilitiesEnvironmentDetector, sessionEnvironmentDetector, devtoolsEnvironmentDetector } from './envDetector.js';
|
|
10
10
|
import { UNICODE_CHARACTERS, HOOK_DEFINITION } from './constants.js';
|
|
11
|
-
export { startWebDriver,
|
|
11
|
+
export { startWebDriver, initializePlugin, initializeLauncherService, initializeWorkerService, isFunctionAsync, transformCommandLogResult, webdriverMonad, commandCallStructure, isValidParameter, getArgumentType, safeImport, sleep, isAppiumCapability,
|
|
12
12
|
/**
|
|
13
13
|
* runner shim
|
|
14
14
|
*/
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Services } from '@wdio/types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* initialize WebdriverIO compliant plugins like reporter or services in the following way:
|
|
4
4
|
* 1. if package name is scoped (starts with "@"), require scoped package name
|
|
5
5
|
* 2. otherwise try to require "@wdio/<name>-<type>"
|
|
6
6
|
* 3. otherwise try to require "wdio-<name>-<type>"
|
|
7
7
|
*/
|
|
8
|
-
export default function
|
|
9
|
-
//# sourceMappingURL=
|
|
8
|
+
export default function initializePlugin(name: string, type?: string): Promise<Services.ServicePlugin | Services.RunnerPlugin>;
|
|
9
|
+
//# sourceMappingURL=initializePlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initializePlugin.d.ts","sourceRoot":"","sources":["../src/initializePlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAI3C;;;;;GAKG;AACH,wBAA8B,gBAAgB,CAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,aAAa,GAAG,QAAQ,CAAC,YAAY,CAAC,CAqCpI"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { safeImport, isAbsolute } from './utils.js';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* initialize WebdriverIO compliant plugins like reporter or services in the following way:
|
|
4
4
|
* 1. if package name is scoped (starts with "@"), require scoped package name
|
|
5
5
|
* 2. otherwise try to require "@wdio/<name>-<type>"
|
|
6
6
|
* 3. otherwise try to require "wdio-<name>-<type>"
|
|
7
7
|
*/
|
|
8
|
-
export default async function
|
|
8
|
+
export default async function initializePlugin(name, type) {
|
|
9
9
|
/**
|
|
10
10
|
* directly import packages that are scoped or start with an absolute path
|
|
11
11
|
*/
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import type { Capabilities, Services, Options } from '@wdio/types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* initialize service for launcher process
|
|
4
4
|
* @param {Object} config wdio config
|
|
5
5
|
* @param {Object[]} caps list of capabilities
|
|
6
6
|
* @return {Object} containing a list of launcher services as well
|
|
7
7
|
* as a list of services that don't need to be
|
|
8
8
|
* required in the worker
|
|
9
9
|
*/
|
|
10
|
-
export declare function
|
|
10
|
+
export declare function initializeLauncherService(config: Omit<Options.Testrunner, 'capabilities' | keyof Services.HookFunctions>, caps: Capabilities.DesiredCapabilities): Promise<{
|
|
11
11
|
ignoredWorkerServices: string[];
|
|
12
12
|
launcherServices: Services.ServiceInstance[];
|
|
13
13
|
}>;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* initialize services for worker instance
|
|
16
16
|
* @param {Object} config wdio config
|
|
17
17
|
* @param {Object} caps worker capabilities
|
|
18
18
|
* @param {object} ignoredWorkerServices list of services that don't need to be required in a worker
|
|
19
19
|
* as they don't export a service for it
|
|
20
20
|
* @return {Object[]} list if worker initiated worker services
|
|
21
21
|
*/
|
|
22
|
-
export declare function
|
|
23
|
-
//# sourceMappingURL=
|
|
22
|
+
export declare function initializeWorkerService(config: Options.Testrunner, caps: Capabilities.DesiredCapabilities, ignoredWorkerServices?: string[]): Promise<Services.ServiceInstance[]>;
|
|
23
|
+
//# sourceMappingURL=initializeServices.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"initializeServices.d.ts","sourceRoot":"","sources":["../src/initializeServices.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAqFlE;;;;;;;GAOG;AACH,wBAAsB,yBAAyB,CAAE,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,cAAc,GAAG,MAAM,QAAQ,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,mBAAmB;;;GAmDvK;AAED;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CACzC,MAAM,EAAE,OAAO,CAAC,UAAU,EAC1B,IAAI,EAAE,YAAY,CAAC,mBAAmB,EACtC,qBAAqB,GAAE,MAAM,EAAO,GACrC,OAAO,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC,CA+BrC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import logger from '@wdio/logger';
|
|
2
|
-
import
|
|
3
|
-
const log = logger('@wdio/utils:
|
|
2
|
+
import initializePlugin from './initializePlugin.js';
|
|
3
|
+
const log = logger('@wdio/utils:initializeServices');
|
|
4
4
|
/**
|
|
5
5
|
* Maps list of services of a config file into a list of actionable objects
|
|
6
6
|
* @param {Object} config config of running session
|
|
7
7
|
* @param {Object} caps capabilities of running session
|
|
8
8
|
* @return {[(Object|Class), Object][]} list of services with their config objects
|
|
9
9
|
*/
|
|
10
|
-
async function
|
|
11
|
-
const
|
|
10
|
+
async function initializeServices(services) {
|
|
11
|
+
const initializedServices = [];
|
|
12
12
|
for (const [serviceName, serviceConfig = {}] of services) {
|
|
13
13
|
/**
|
|
14
|
-
* allow custom services that are already
|
|
14
|
+
* allow custom services that are already initialized, e.g.
|
|
15
15
|
*
|
|
16
16
|
* ```
|
|
17
17
|
* services: [
|
|
@@ -20,8 +20,8 @@ async function initialiseServices(services) {
|
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
22
|
if (typeof serviceName === 'object') {
|
|
23
|
-
log.debug('
|
|
24
|
-
|
|
23
|
+
log.debug('initialize custom initiated service');
|
|
24
|
+
initializedServices.push([serviceName, {}]);
|
|
25
25
|
continue;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
@@ -38,8 +38,8 @@ async function initialiseServices(services) {
|
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
40
|
if (typeof serviceName === 'function') {
|
|
41
|
-
log.debug(`
|
|
42
|
-
|
|
41
|
+
log.debug(`initialize custom service "${serviceName.name}"`);
|
|
42
|
+
initializedServices.push([serviceName, serviceConfig]);
|
|
43
43
|
continue;
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
@@ -49,11 +49,11 @@ async function initialiseServices(services) {
|
|
|
49
49
|
* services: ['@wdio/devtools-service']
|
|
50
50
|
* ```
|
|
51
51
|
*/
|
|
52
|
-
log.debug(`
|
|
53
|
-
const service = await
|
|
54
|
-
|
|
52
|
+
log.debug(`initialize service "${serviceName}" as NPM package`);
|
|
53
|
+
const service = await initializePlugin(serviceName, 'service');
|
|
54
|
+
initializedServices.push([service, serviceConfig, serviceName]);
|
|
55
55
|
}
|
|
56
|
-
return
|
|
56
|
+
return initializedServices;
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* formats service array into proper structure which is an array with
|
|
@@ -66,19 +66,19 @@ function sanitizeServiceArray(service) {
|
|
|
66
66
|
return Array.isArray(service) ? service : [service, {}];
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
|
-
*
|
|
69
|
+
* initialize service for launcher process
|
|
70
70
|
* @param {Object} config wdio config
|
|
71
71
|
* @param {Object[]} caps list of capabilities
|
|
72
72
|
* @return {Object} containing a list of launcher services as well
|
|
73
73
|
* as a list of services that don't need to be
|
|
74
74
|
* required in the worker
|
|
75
75
|
*/
|
|
76
|
-
export async function
|
|
76
|
+
export async function initializeLauncherService(config, caps) {
|
|
77
77
|
const ignoredWorkerServices = [];
|
|
78
78
|
const launcherServices = [];
|
|
79
79
|
let serviceLabelToBeInitialised = 'unknown';
|
|
80
80
|
try {
|
|
81
|
-
const services = await
|
|
81
|
+
const services = await initializeServices(config.services.map(sanitizeServiceArray));
|
|
82
82
|
for (const [service, serviceConfig, serviceName] of services) {
|
|
83
83
|
/**
|
|
84
84
|
* add custom services as object or function
|
|
@@ -120,38 +120,38 @@ export async function initialiseLauncherService(config, caps) {
|
|
|
120
120
|
return { ignoredWorkerServices, launcherServices };
|
|
121
121
|
}
|
|
122
122
|
/**
|
|
123
|
-
*
|
|
123
|
+
* initialize services for worker instance
|
|
124
124
|
* @param {Object} config wdio config
|
|
125
125
|
* @param {Object} caps worker capabilities
|
|
126
126
|
* @param {object} ignoredWorkerServices list of services that don't need to be required in a worker
|
|
127
127
|
* as they don't export a service for it
|
|
128
128
|
* @return {Object[]} list if worker initiated worker services
|
|
129
129
|
*/
|
|
130
|
-
export async function
|
|
130
|
+
export async function initializeWorkerService(config, caps, ignoredWorkerServices = []) {
|
|
131
131
|
let serviceLabelToBeInitialised = 'unknown';
|
|
132
|
-
const
|
|
132
|
+
const initializedServices = [];
|
|
133
133
|
const workerServices = config.services
|
|
134
134
|
.map(sanitizeServiceArray)
|
|
135
135
|
.filter(([serviceName]) => !ignoredWorkerServices.includes(serviceName));
|
|
136
136
|
try {
|
|
137
|
-
const services = await
|
|
137
|
+
const services = await initializeServices(workerServices);
|
|
138
138
|
for (const [service, serviceConfig, serviceName] of services) {
|
|
139
139
|
/**
|
|
140
140
|
* add object service
|
|
141
141
|
*/
|
|
142
142
|
if (typeof service === 'object' && !serviceName) {
|
|
143
143
|
serviceLabelToBeInitialised = 'object';
|
|
144
|
-
|
|
144
|
+
initializedServices.push(service);
|
|
145
145
|
continue;
|
|
146
146
|
}
|
|
147
147
|
const Service = service.default || service;
|
|
148
148
|
if (typeof Service === 'function') {
|
|
149
149
|
serviceLabelToBeInitialised = serviceName || Service.constructor?.name || Service.toString();
|
|
150
|
-
|
|
150
|
+
initializedServices.push(new Service(serviceConfig, caps, config));
|
|
151
151
|
continue;
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
|
-
return
|
|
154
|
+
return initializedServices;
|
|
155
155
|
}
|
|
156
156
|
catch (err) {
|
|
157
157
|
throw new Error(`Failed to initilialise service ${serviceLabelToBeInitialised}: ${err.stack}`);
|
package/build/monad.d.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { EventEmitter } from 'node:events';
|
|
2
1
|
interface PropertiesObject {
|
|
3
2
|
[key: string | symbol]: PropertyDescriptor;
|
|
4
3
|
}
|
|
5
4
|
export default function WebDriver(options: Record<string, any>, modifier?: Function, propertiesObject?: PropertiesObject): {
|
|
6
|
-
(this: void, sessionId: string, commandWrapper?: Function
|
|
7
|
-
socket: Partial<EventEmitter>;
|
|
8
|
-
}): any;
|
|
5
|
+
(this: void, sessionId: string, commandWrapper?: Function): any;
|
|
9
6
|
/**
|
|
10
7
|
* Enhance monad prototype with function
|
|
11
8
|
* @param {string} name name of function to attach to prototype
|
package/build/monad.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"monad.d.ts","sourceRoot":"","sources":["../src/monad.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"monad.d.ts","sourceRoot":"","sources":["../src/monad.ts"],"names":[],"mappings":"AAYA,UAAU,gBAAgB;IACtB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,kBAAkB,CAAA;CAC7C;AAED,MAAM,CAAC,OAAO,UAAU,SAAS,CAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,QAAQ,CAAC,EAAE,QAAQ,EAAE,gBAAgB,GAAE,gBAAqB;WAkBpG,IAAI,aAAa,MAAM,mBAAmB,QAAQ;IA+GvE;;;;;;OAMG;eACyB,MAAM,QAAQ,QAAQ,SAAS,OAAO,MAAM,EAAE,GAAG,CAAC,gBAAgB,QAAQ;EA6CzG"}
|
package/build/monad.js
CHANGED
|
@@ -20,10 +20,7 @@ export default function WebDriver(options, modifier, propertiesObject = {}) {
|
|
|
20
20
|
/**
|
|
21
21
|
* WebDriver monad
|
|
22
22
|
*/
|
|
23
|
-
function unit(sessionId, commandWrapper
|
|
24
|
-
if (eventMiddleware) {
|
|
25
|
-
prototype.eventMiddleware = eventMiddleware;
|
|
26
|
-
}
|
|
23
|
+
function unit(sessionId, commandWrapper) {
|
|
27
24
|
/**
|
|
28
25
|
* capabilities attached to the instance prototype not being shown if
|
|
29
26
|
* logging the instance
|
|
@@ -168,11 +165,6 @@ export default function WebDriver(options, modifier, propertiesObject = {}) {
|
|
|
168
165
|
prototype[eventCommand] = function (...args) {
|
|
169
166
|
const method = eventCommand;
|
|
170
167
|
eventHandler[method]?.(...args);
|
|
171
|
-
if (prototype.eventMiddleware) {
|
|
172
|
-
if (typeof prototype.eventMiddleware[method] === 'function') {
|
|
173
|
-
prototype.eventMiddleware.socket[method](...args);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
168
|
return this;
|
|
177
169
|
};
|
|
178
170
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/node/utils.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAK1C;;;;GAIG;AACH,eAAO,MAAM,SAAS,UAAW,MAAM,YAWtC,CAAA;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,oBAAoB,YAYvD;AAED,wBAAgB,sBAAsB,CAAC,UAAU,CAAC,EAAE,MAAM,sBAqBzD;AAED,wBAAsB,uBAAuB,CAAC,WAAW,CAAC,EAAE,MAAM,+BAiBjE;AAGD,eAAO,MAAM,wBAAwB,aAAc,MAAM,mBAAmB,MAAM,cAAc,MAAM,SAOrG,CAAA;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/node/utils.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAK1C;;;;GAIG;AACH,eAAO,MAAM,SAAS,UAAW,MAAM,YAWtC,CAAA;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,oBAAoB,YAYvD;AAED,wBAAgB,sBAAsB,CAAC,UAAU,CAAC,EAAE,MAAM,sBAqBzD;AAED,wBAAsB,uBAAuB,CAAC,WAAW,CAAC,EAAE,MAAM,+BAiBjE;AAGD,eAAO,MAAM,wBAAwB,aAAc,MAAM,mBAAmB,MAAM,cAAc,MAAM,SAOrG,CAAA;AA+BD,wBAAsB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,CAAC,YAAY;;;;;;GA2G3F;AAED,wBAAgB,gBAAgB,CAAE,IAAI,EAAE,WAAW,CAAC,YAAY,oGAS/D;AAED,wBAAgB,WAAW,CAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,EAAE,IAAI,EAAE,WAAW,CAAC,YAAY,UAGxG;AAED,wBAAgB,yBAAyB,CAAC,WAAW,EAAC,MAAM,UAM3D;AAED,wBAAsB,iBAAiB,CAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM;;GAgDhF;AAED,wBAAgB,gBAAgB,CAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,mBAEzE;AAED,wBAAgB,eAAe,CAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,mBAExE"}
|
package/build/node/utils.js
CHANGED
|
@@ -98,8 +98,15 @@ export const downloadProgressCallback = (artifact, downloadedBytes, totalBytes)
|
|
|
98
98
|
* @param {InstallOptions & { unpack?: true | undefined }} args - An object containing installation options and an optional `unpack` flag.
|
|
99
99
|
* @returns {Promise<void>} A Promise that resolves once the package is installed and clear the progress log.
|
|
100
100
|
*/
|
|
101
|
-
const _install = async (args) => {
|
|
102
|
-
await install(args)
|
|
101
|
+
const _install = async (args, retry = false) => {
|
|
102
|
+
await install(args).catch((err) => {
|
|
103
|
+
const error = `Failed downloading ${args.browser} v${args.buildId}: ${err.message}, retrying ...`;
|
|
104
|
+
if (retry) {
|
|
105
|
+
throw new Error(error);
|
|
106
|
+
}
|
|
107
|
+
log.error(error);
|
|
108
|
+
return _install(args, true);
|
|
109
|
+
});
|
|
103
110
|
log.progress('');
|
|
104
111
|
};
|
|
105
112
|
function locateChromeSafely() {
|
|
@@ -8,10 +8,11 @@ import type { WrapperMethods, SpecFunction, BeforeHookParam, AfterHookParam } fr
|
|
|
8
8
|
* @param {object} after afterFn and afterFnArgs
|
|
9
9
|
* @param {string} cid cid
|
|
10
10
|
* @param {number} repeatTest number of retries if test fails
|
|
11
|
-
* @return {*} specFn result
|
|
12
11
|
* @param {string} hookName the hook name
|
|
12
|
+
* @param {number} timeout the maximum time (in milliseconds) to wait for
|
|
13
|
+
* @return {*} specFn result
|
|
13
14
|
*/
|
|
14
|
-
export declare const testFnWrapper: (this: unknown, args_0: string, args_1: SpecFunction, args_2: BeforeHookParam<unknown>, args_3: AfterHookParam<unknown>, args_4: string, args_5: number, args_6?: string | undefined) => Promise<unknown>;
|
|
15
|
+
export declare const testFnWrapper: (this: unknown, args_0: string, args_1: SpecFunction, args_2: BeforeHookParam<unknown>, args_3: AfterHookParam<unknown>, args_4: string, args_5: number, args_6?: string | undefined, args_7?: number | undefined) => Promise<unknown>;
|
|
15
16
|
/**
|
|
16
17
|
* wraps test framework spec/hook function with WebdriverIO before/after hooks
|
|
17
18
|
*
|
|
@@ -22,10 +23,11 @@ export declare const testFnWrapper: (this: unknown, args_0: string, args_1: Spec
|
|
|
22
23
|
* @param {object} after afterFn and afterFnArgs function
|
|
23
24
|
* @param {string} cid cid
|
|
24
25
|
* @param {number} repeatTest number of retries if test fails
|
|
25
|
-
* @return {*} specFn result
|
|
26
26
|
* @param {string} hookName the hook name
|
|
27
|
+
* @param {number} timeout the maximum time (in milliseconds) to wait for
|
|
28
|
+
* @return {*} specFn result
|
|
27
29
|
*/
|
|
28
|
-
export declare const testFrameworkFnWrapper: (this: unknown, { executeHooksWithArgs, executeAsync }: WrapperMethods, type: string, { specFn, specFnArgs }: SpecFunction, { beforeFn, beforeFnArgs }: BeforeHookParam<unknown>, { afterFn, afterFnArgs }: AfterHookParam<unknown>, cid: string, repeatTest?: number, hookName?: string) => Promise<unknown>;
|
|
30
|
+
export declare const testFrameworkFnWrapper: (this: unknown, { executeHooksWithArgs, executeAsync }: WrapperMethods, type: string, { specFn, specFnArgs }: SpecFunction, { beforeFn, beforeFnArgs }: BeforeHookParam<unknown>, { afterFn, afterFnArgs }: AfterHookParam<unknown>, cid: string, repeatTest?: number, hookName?: string, timeout?: number) => Promise<unknown>;
|
|
29
31
|
/**
|
|
30
32
|
* Filter out internal stacktraces. exporting to allow testing of the function
|
|
31
33
|
* @param {string} stack Stacktrace
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testFnWrapper.d.ts","sourceRoot":"","sources":["../../src/test-framework/testFnWrapper.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACR,cAAc,EACd,YAAY,EACZ,eAAe,EACf,cAAc,EACjB,MAAM,YAAY,CAAA;AASnB
|
|
1
|
+
{"version":3,"file":"testFnWrapper.d.ts","sourceRoot":"","sources":["../../src/test-framework/testFnWrapper.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACR,cAAc,EACd,YAAY,EACZ,eAAe,EACf,cAAc,EACjB,MAAM,YAAY,CAAA;AASnB;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa,SAChB,OAAO,wNAahB,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,sBAAsB,SACzB,OAAO,0CAC2B,cAAc,QAChD,MAAM,0BACY,YAAY,8BACR,gBAAgB,OAAO,CAAC,4BAC1B,eAAe,OAAO,CAAC,OAC5C,MAAM,kCAEA,MAAM,YACP,MAAM,qBA0CnB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,UAAW,MAAM,KAAG,MAKhD,CAAA"}
|
|
@@ -15,8 +15,9 @@ const STACKTRACE_FILTER = [
|
|
|
15
15
|
* @param {object} after afterFn and afterFnArgs
|
|
16
16
|
* @param {string} cid cid
|
|
17
17
|
* @param {number} repeatTest number of retries if test fails
|
|
18
|
-
* @return {*} specFn result
|
|
19
18
|
* @param {string} hookName the hook name
|
|
19
|
+
* @param {number} timeout the maximum time (in milliseconds) to wait for
|
|
20
|
+
* @return {*} specFn result
|
|
20
21
|
*/
|
|
21
22
|
export const testFnWrapper = function (...args) {
|
|
22
23
|
return testFrameworkFnWrapper.call(this, { executeHooksWithArgs, executeAsync }, ...args);
|
|
@@ -31,10 +32,11 @@ export const testFnWrapper = function (...args) {
|
|
|
31
32
|
* @param {object} after afterFn and afterFnArgs function
|
|
32
33
|
* @param {string} cid cid
|
|
33
34
|
* @param {number} repeatTest number of retries if test fails
|
|
34
|
-
* @return {*} specFn result
|
|
35
35
|
* @param {string} hookName the hook name
|
|
36
|
+
* @param {number} timeout the maximum time (in milliseconds) to wait for
|
|
37
|
+
* @return {*} specFn result
|
|
36
38
|
*/
|
|
37
|
-
export const testFrameworkFnWrapper = async function ({ executeHooksWithArgs, executeAsync }, type, { specFn, specFnArgs }, { beforeFn, beforeFnArgs }, { afterFn, afterFnArgs }, cid, repeatTest = 0, hookName) {
|
|
39
|
+
export const testFrameworkFnWrapper = async function ({ executeHooksWithArgs, executeAsync }, type, { specFn, specFnArgs }, { beforeFn, beforeFnArgs }, { afterFn, afterFnArgs }, cid, repeatTest = 0, hookName, timeout) {
|
|
38
40
|
const retries = { attempts: 0, limit: repeatTest };
|
|
39
41
|
const beforeArgs = beforeFnArgs(this);
|
|
40
42
|
if (type === 'Hook' && hookName) {
|
|
@@ -45,7 +47,7 @@ export const testFrameworkFnWrapper = async function ({ executeHooksWithArgs, ex
|
|
|
45
47
|
let error;
|
|
46
48
|
const testStart = Date.now();
|
|
47
49
|
try {
|
|
48
|
-
result = await executeAsync.call(this, specFn, retries, specFnArgs);
|
|
50
|
+
result = await executeAsync.call(this, specFn, retries, specFnArgs, timeout);
|
|
49
51
|
}
|
|
50
52
|
catch (err) {
|
|
51
53
|
if (err.stack) {
|
package/build/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/utils",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.23.1",
|
|
4
4
|
"description": "A WDIO helper utility to provide several utility functions used across the project.",
|
|
5
5
|
"author": "Christian Bromann <mail@bromann.dev>",
|
|
6
6
|
"homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-utils",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@puppeteer/browsers": "^1.6.0",
|
|
41
41
|
"@wdio/logger": "8.16.17",
|
|
42
|
-
"@wdio/types": "8.
|
|
42
|
+
"@wdio/types": "8.23.1",
|
|
43
43
|
"decamelize": "^6.0.0",
|
|
44
44
|
"deepmerge-ts": "^5.1.0",
|
|
45
45
|
"edgedriver": "^5.3.5",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "64633b802ba4d00d23f6531dadc3fc724d8d7dd5"
|
|
59
59
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"initialisePlugin.d.ts","sourceRoot":"","sources":["../src/initialisePlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAI3C;;;;;GAKG;AACH,wBAA8B,gBAAgB,CAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,aAAa,GAAG,QAAQ,CAAC,YAAY,CAAC,CAqCpI"}
|