@wdio/utils 7.18.0 → 7.19.2
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/shim.js
CHANGED
|
@@ -197,7 +197,7 @@ let wrapCommand = function wrapCommand(commandName, fn) {
|
|
|
197
197
|
* await $('foo').$('bar')
|
|
198
198
|
* ```
|
|
199
199
|
*/
|
|
200
|
-
if (ELEMENT_QUERY_COMMANDS.includes(prop)) {
|
|
200
|
+
if (ELEMENT_QUERY_COMMANDS.includes(prop) || prop.endsWith('$')) {
|
|
201
201
|
// this: WebdriverIO.Element
|
|
202
202
|
return wrapCommand(prop, function (...args) {
|
|
203
203
|
return this[prop].apply(this, args);
|
|
@@ -270,7 +270,7 @@ let wrapCommand = function wrapCommand(commandName, fn) {
|
|
|
270
270
|
*/
|
|
271
271
|
const command = hasWdioSyncSupport && wdioSync && Boolean(global.browser) && !exports.runAsync && !exports.asyncSpec
|
|
272
272
|
? wdioSync.wrapCommand(commandName, fn)
|
|
273
|
-
: ELEMENT_QUERY_COMMANDS.includes(commandName)
|
|
273
|
+
: ELEMENT_QUERY_COMMANDS.includes(commandName) || commandName.endsWith('$')
|
|
274
274
|
? chainElementQuery
|
|
275
275
|
: wrapCommandFn;
|
|
276
276
|
return command.apply(this, args);
|
|
@@ -24,4 +24,10 @@ export declare const testFnWrapper: (this: unknown, args_0: string, args_1: Spec
|
|
|
24
24
|
* @return {*} specFn result
|
|
25
25
|
*/
|
|
26
26
|
export declare const testFrameworkFnWrapper: (this: unknown, { executeHooksWithArgs, executeAsync, runSync }: WrapperMethods, type: string, { specFn, specFnArgs }: SpecFunction, { beforeFn, beforeFnArgs }: BeforeHookParam<unknown>, { afterFn, afterFnArgs }: AfterHookParam<unknown>, cid: string, repeatTest?: number) => Promise<unknown>;
|
|
27
|
+
/**
|
|
28
|
+
* Filter out internal stacktraces. exporting to allow testing of the function
|
|
29
|
+
* @param {string} stack Stacktrace
|
|
30
|
+
* @returns {string}
|
|
31
|
+
*/
|
|
32
|
+
export declare const filterStackTrace: (stack: string) => string;
|
|
27
33
|
//# sourceMappingURL=testFnWrapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testFnWrapper.d.ts","sourceRoot":"","sources":["../../src/test-framework/testFnWrapper.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACR,cAAc,EACd,YAAY,EACZ,eAAe,EACf,cAAc,EAEjB,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"testFnWrapper.d.ts","sourceRoot":"","sources":["../../src/test-framework/testFnWrapper.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACR,cAAc,EACd,YAAY,EACZ,eAAe,EACf,cAAc,EAEjB,MAAM,SAAS,CAAA;AAShB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,aAAa,SAChB,OAAO,8JAWhB,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sBAAsB,SACzB,OAAO,mDACoC,cAAc,QACzD,MAAM,0BACY,YAAY,8BACR,gBAAgB,OAAO,CAAC,4BAC1B,eAAe,OAAO,CAAC,OAC5C,MAAM,0CAuDd,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,UAAW,MAAM,KAAG,MAKhD,CAAA"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.testFrameworkFnWrapper = exports.testFnWrapper = void 0;
|
|
3
|
+
exports.filterStackTrace = exports.testFrameworkFnWrapper = exports.testFnWrapper = void 0;
|
|
4
4
|
const utils_1 = require("../utils");
|
|
5
5
|
const errorHandler_1 = require("./errorHandler");
|
|
6
6
|
const shim_1 = require("../shim");
|
|
7
|
+
const STACKTRACE_FILTER = [
|
|
8
|
+
'node_modules/webdriver/',
|
|
9
|
+
'node_modules/webdriverio/',
|
|
10
|
+
'node_modules/@wdio/',
|
|
11
|
+
'(internal/process/task',
|
|
12
|
+
];
|
|
7
13
|
/**
|
|
8
14
|
* wraps test framework spec/hook function with WebdriverIO before/after hooks
|
|
9
15
|
*
|
|
@@ -52,6 +58,9 @@ const testFrameworkFnWrapper = async function ({ executeHooksWithArgs, executeAs
|
|
|
52
58
|
result = await promise;
|
|
53
59
|
}
|
|
54
60
|
catch (err) {
|
|
61
|
+
if (err.stack) {
|
|
62
|
+
err.stack = (0, exports.filterStackTrace)(err.stack);
|
|
63
|
+
}
|
|
55
64
|
error = err;
|
|
56
65
|
}
|
|
57
66
|
const duration = Date.now() - testStart;
|
|
@@ -78,3 +87,15 @@ const testFrameworkFnWrapper = async function ({ executeHooksWithArgs, executeAs
|
|
|
78
87
|
return result;
|
|
79
88
|
};
|
|
80
89
|
exports.testFrameworkFnWrapper = testFrameworkFnWrapper;
|
|
90
|
+
/**
|
|
91
|
+
* Filter out internal stacktraces. exporting to allow testing of the function
|
|
92
|
+
* @param {string} stack Stacktrace
|
|
93
|
+
* @returns {string}
|
|
94
|
+
*/
|
|
95
|
+
const filterStackTrace = (stack) => {
|
|
96
|
+
return stack
|
|
97
|
+
.split('\n')
|
|
98
|
+
.filter(line => !STACKTRACE_FILTER.some(l => line.includes(l)))
|
|
99
|
+
.join('\n');
|
|
100
|
+
};
|
|
101
|
+
exports.filterStackTrace = filterStackTrace;
|
package/build/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAW,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAW,MAAM,aAAa,CAAA;AAMpD;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,gBAAgB,EAAE;IAAE,sBAAsB,CAAC,EAAE;QAAE,KAAK,EAAE,GAAG,CAAA;KAAE,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,QAsCzH;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAE,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,UA+BrE;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAE,MAAM,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE;;;EAWpF;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAE,GAAG,EAAE,GAAG,EAAE,YAAY,EAAE,MAAM,WA8B/D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAE,GAAG,EAAE,GAAG,wGAExC;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAE,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC,aAAa,GAAG,IAAI,CAoCxE;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAE,EAAE,EAAE,QAAQ,WAE5C;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAE,IAAI,EAAE,GAAG,EAAE,SAE1C;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,WAanC;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,SAAU,MAAM,YAWrC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,KAAK,mCAAoD,CAAA"}
|
package/build/utils.js
CHANGED
|
@@ -8,6 +8,7 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const SCREENSHOT_REPLACEMENT = '"<Screenshot[base64]>"';
|
|
10
10
|
const SCRIPT_PLACEHOLDER = '"<Script[base64]>"';
|
|
11
|
+
const REGEX_SCRIPT_NAME = /return \(function (\w+)/;
|
|
11
12
|
/**
|
|
12
13
|
* overwrite native element commands with user defined
|
|
13
14
|
* @param {object} propertiesObject propertiesObject
|
|
@@ -96,6 +97,10 @@ function transformCommandLogResult(result) {
|
|
|
96
97
|
else if (typeof result.script === 'string' && isBase64(result.script)) {
|
|
97
98
|
return SCRIPT_PLACEHOLDER;
|
|
98
99
|
}
|
|
100
|
+
else if (typeof result.script === 'string' && result.script.match(REGEX_SCRIPT_NAME)) {
|
|
101
|
+
const newScript = result.script.match(REGEX_SCRIPT_NAME)[1];
|
|
102
|
+
return { ...result, script: `${newScript}(...) [${Buffer.byteLength(result.script, 'utf-8')} bytes]` };
|
|
103
|
+
}
|
|
99
104
|
return result;
|
|
100
105
|
}
|
|
101
106
|
exports.transformCommandLogResult = transformCommandLogResult;
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/utils",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.19.2",
|
|
4
4
|
"description": "A WDIO helper utility to provide several utility functions used across the project.",
|
|
5
|
-
"author": "Christian Bromann <
|
|
5
|
+
"author": "Christian Bromann <mail@bromann.dev>",
|
|
6
6
|
"homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-utils",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"main": "./build/index",
|
|
@@ -23,13 +23,13 @@
|
|
|
23
23
|
"url": "https://github.com/webdriverio/webdriverio/issues"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@wdio/logger": "7.
|
|
27
|
-
"@wdio/types": "7.
|
|
26
|
+
"@wdio/logger": "7.19.0",
|
|
27
|
+
"@wdio/types": "7.19.1",
|
|
28
28
|
"p-iteration": "^1.1.8"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
33
|
"types": "./build/index.d.ts",
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "71fb35a12db8691194b346ab5abd2acf84829385"
|
|
35
35
|
}
|