@wdio/utils 8.21.0 → 8.23.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/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/shim.d.ts.map +1 -1
- package/build/shim.js +8 -1
- package/package.json +3 -3
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() {
|
package/build/shim.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shim.d.ts","sourceRoot":"","sources":["../src/shim.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAW,UAAU,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"shim.d.ts","sourceRoot":"","sources":["../src/shim.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAW,UAAU,EAAE,MAAM,aAAa,CAAA;AAqBtD,wBAAsB,oBAAoB,CAAC,CAAC,EAAG,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,GAAE,QAAQ,GAAG,QAAQ,EAAO,EAAE,IAAI,GAAE,GAAG,EAAO,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,CAsDvJ;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,CAAC,CAAC,CAmM9F;AAED;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,CAAC,WAAW,EAAE,IAAI,GAAE,GAAG,EAAO,EAAE,OAAO,GAAE,MAAc,GAAG,OAAO,CAAC,OAAO,CAAC,CA2CxJ"}
|
package/build/shim.js
CHANGED
|
@@ -12,6 +12,7 @@ const ELEMENT_PROPS = [
|
|
|
12
12
|
];
|
|
13
13
|
const ACTION_COMMANDS = ['action', 'actions'];
|
|
14
14
|
const PROMISE_METHODS = ['then', 'catch', 'finally'];
|
|
15
|
+
const TIME_BUFFER = 3;
|
|
15
16
|
export async function executeHooksWithArgs(hookName, hooks = [], args = []) {
|
|
16
17
|
/**
|
|
17
18
|
* make sure hooks are an array of functions
|
|
@@ -245,8 +246,14 @@ export function wrapCommand(commandName, fn) {
|
|
|
245
246
|
export async function executeAsync(fn, retries, args = [], timeout = 20000) {
|
|
246
247
|
this.wdioRetries = retries.attempts;
|
|
247
248
|
try {
|
|
249
|
+
/**
|
|
250
|
+
* To prevent test failures due to timeout exceptions in Jasmine from overwriting test objects with subsequent values,
|
|
251
|
+
* we reduce the overall timeout by a constant known as TIME_BUFFER. TIME_BUFFER acts as a safety margin, allowing a small
|
|
252
|
+
* window of time for an operation to complete before triggering a timeout. This approach ensures that test results are handled
|
|
253
|
+
* properly without affecting the overall test execution timing.
|
|
254
|
+
*/
|
|
248
255
|
// @ts-expect-error
|
|
249
|
-
const _timeout = this?._runnable?._timeout || globalThis.jasmine?.DEFAULT_TIMEOUT_INTERVAL || timeout;
|
|
256
|
+
const _timeout = (this?._runnable?._timeout || globalThis.jasmine?.DEFAULT_TIMEOUT_INTERVAL || timeout) - TIME_BUFFER;
|
|
250
257
|
/**
|
|
251
258
|
* Executes the function with specified timeout and returns the result, or throws an error if the timeout is exceeded.
|
|
252
259
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/utils",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.23.0",
|
|
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.0",
|
|
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": "b17ce5f554deb8588cc156ad9676bd4bd13defe7"
|
|
59
59
|
}
|