@wdio/utils 8.0.13 → 8.0.14
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/initialiseServices.js +1 -1
- package/build/monad.js +3 -3
- package/build/shim.d.ts +2 -2
- package/build/shim.d.ts.map +1 -1
- package/build/shim.js +2 -2
- package/build/test-framework/testFnWrapper.js +1 -1
- package/build/utils.d.ts.map +1 -1
- package/build/utils.js +6 -4
- package/package.json +4 -4
|
@@ -9,7 +9,7 @@ const log = logger('@wdio/utils:initialiseServices');
|
|
|
9
9
|
*/
|
|
10
10
|
async function initialiseServices(services) {
|
|
11
11
|
const initialisedServices = [];
|
|
12
|
-
for (
|
|
12
|
+
for (const [serviceName, serviceConfig = {}] of services) {
|
|
13
13
|
/**
|
|
14
14
|
* allow custom services that are already initialised, e.g.
|
|
15
15
|
*
|
package/build/monad.js
CHANGED
|
@@ -53,7 +53,7 @@ export default function WebDriver(options, modifier, propertiesObject = {}) {
|
|
|
53
53
|
*/
|
|
54
54
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
55
55
|
const { puppeteer, ...propertiesObjectWithoutPuppeteer } = propertiesObject;
|
|
56
|
-
propertiesObject
|
|
56
|
+
propertiesObject.__propertiesObject__ = { value: propertiesObjectWithoutPuppeteer };
|
|
57
57
|
let client = Object.create(prototype, propertiesObject);
|
|
58
58
|
client.sessionId = sessionId;
|
|
59
59
|
/**
|
|
@@ -96,7 +96,7 @@ export default function WebDriver(options, modifier, propertiesObject = {}) {
|
|
|
96
96
|
* @param {Object=} instances multiremote instances
|
|
97
97
|
*/
|
|
98
98
|
client.overwriteCommand = function (name, func, attachToElement = false, proto, instances) {
|
|
99
|
-
|
|
99
|
+
const customCommand = typeof commandWrapper === 'function'
|
|
100
100
|
? commandWrapper(name, func)
|
|
101
101
|
: func;
|
|
102
102
|
if (attachToElement) {
|
|
@@ -157,7 +157,7 @@ export default function WebDriver(options, modifier, propertiesObject = {}) {
|
|
|
157
157
|
/**
|
|
158
158
|
* register event emitter
|
|
159
159
|
*/
|
|
160
|
-
for (
|
|
160
|
+
for (const eventCommand in EVENTHANDLER_FUNCTIONS) {
|
|
161
161
|
prototype[eventCommand] = function (...args) {
|
|
162
162
|
eventHandler[eventCommand](...args);
|
|
163
163
|
if (prototype.eventMiddleware) {
|
package/build/shim.d.ts
CHANGED
|
@@ -13,13 +13,13 @@ declare global {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
declare
|
|
16
|
+
declare const executeHooksWithArgs: <T>(this: any, hookName: string, hooks?: Function | Function[], args?: any[]) => Promise<(Error | T)[]>;
|
|
17
17
|
/**
|
|
18
18
|
* wrap command to enable before and after command to be executed
|
|
19
19
|
* @param commandName name of the command (e.g. getTitle)
|
|
20
20
|
* @param fn command function
|
|
21
21
|
*/
|
|
22
|
-
declare
|
|
22
|
+
declare const wrapCommand: <T>(commandName: string, fn: Function) => (...args: any) => Promise<T>;
|
|
23
23
|
/**
|
|
24
24
|
* execute test or hook asynchronously
|
|
25
25
|
*
|
package/build/shim.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shim.d.ts","sourceRoot":"","sources":["../src/shim.ts"],"names":[],"mappings":"AAQA,UAAU,OAAO;IACb,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;CACnB;AAED,OAAO,CAAC,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"shim.d.ts","sourceRoot":"","sources":["../src/shim.ts"],"names":[],"mappings":"AAQA,UAAU,OAAO;IACb,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;CACnB;AAED,OAAO,CAAC,MAAM,CAAC;IAEX,IAAI,WAAW,EAAE,GAAG,CAAA;CACvB;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM,CAAC;QACb,UAAU,MAAM;YACZ,MAAM,EAAE,GAAG,CAAA;YACX,WAAW,EAAE,GAAG,CAAA;SACnB;KACJ;CACJ;AAaD,QAAA,MAAM,oBAAoB,YAAqD,GAAG,YAAY,MAAM,UAAS,QAAQ,GAAG,QAAQ,EAAE,SAAa,GAAG,EAAE,2BA6CnJ,CAAA;AAED;;;;GAIG;AACH,QAAA,MAAM,WAAW,mBAAwC,MAAM,MAAM,QAAQ,eAAa,GAAG,eAkL5F,CAAA;AAED;;;;;;;GAOG;AACH,iBAAe,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,GAAE,GAAG,EAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAmBzG;AAED,OAAO,EACH,oBAAoB,EACpB,WAAW,EACX,YAAY,GACf,CAAA"}
|
package/build/shim.js
CHANGED
|
@@ -12,7 +12,7 @@ const ELEMENT_PROPS = [
|
|
|
12
12
|
];
|
|
13
13
|
const ACTION_COMMANDS = ['action', 'actions'];
|
|
14
14
|
const PROMISE_METHODS = ['then', 'catch', 'finally'];
|
|
15
|
-
|
|
15
|
+
const executeHooksWithArgs = async function executeHooksWithArgsShim(hookName, hooks = [], args = []) {
|
|
16
16
|
/**
|
|
17
17
|
* make sure hooks are an array of functions
|
|
18
18
|
*/
|
|
@@ -58,7 +58,7 @@ let executeHooksWithArgs = async function executeHooksWithArgsShim(hookName, hoo
|
|
|
58
58
|
* @param commandName name of the command (e.g. getTitle)
|
|
59
59
|
* @param fn command function
|
|
60
60
|
*/
|
|
61
|
-
|
|
61
|
+
const wrapCommand = function wrapCommand(commandName, fn) {
|
|
62
62
|
async function wrapCommandFn(...args) {
|
|
63
63
|
const beforeHookArgs = [commandName, args];
|
|
64
64
|
if (!inCommandHook && this.options.beforeCommand) {
|
|
@@ -49,7 +49,7 @@ export const testFrameworkFnWrapper = async function ({ executeHooksWithArgs, ex
|
|
|
49
49
|
error = err;
|
|
50
50
|
}
|
|
51
51
|
const duration = Date.now() - testStart;
|
|
52
|
-
|
|
52
|
+
const afterArgs = afterFnArgs(this);
|
|
53
53
|
/**
|
|
54
54
|
* ensure errors are caught in Jasmine tests too
|
|
55
55
|
* (in Jasmine failing assertions are not causing the test to throw as
|
package/build/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAKA,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,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAKA,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,QAwCzH;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;;;EAapF;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,wBAAsB,UAAU,CAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,aAAa,GAAG,IAAI,CAAC,CA4DtF;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,UAAW,MAAM,YAWtC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,KAAK,mCAAoD,CAAA"}
|
package/build/utils.js
CHANGED
|
@@ -10,7 +10,9 @@ const REGEX_SCRIPT_NAME = /return \(function (\w+)/;
|
|
|
10
10
|
* @param {object} propertiesObject propertiesObject
|
|
11
11
|
*/
|
|
12
12
|
export function overwriteElementCommands(propertiesObject) {
|
|
13
|
-
const elementOverrides = propertiesObject
|
|
13
|
+
const elementOverrides = propertiesObject.__elementOverrides__
|
|
14
|
+
? propertiesObject.__elementOverrides__.value
|
|
15
|
+
: {};
|
|
14
16
|
for (const [commandName, userDefinedCommand] of Object.entries(elementOverrides)) {
|
|
15
17
|
if (typeof userDefinedCommand !== 'function') {
|
|
16
18
|
throw new Error('overwriteCommand: commands be overwritten only with functions, command: ' + commandName);
|
|
@@ -38,8 +40,8 @@ export function overwriteElementCommands(propertiesObject) {
|
|
|
38
40
|
configurable: true
|
|
39
41
|
};
|
|
40
42
|
}
|
|
41
|
-
delete propertiesObject
|
|
42
|
-
propertiesObject
|
|
43
|
+
delete propertiesObject.__elementOverrides__;
|
|
44
|
+
propertiesObject.__elementOverrides__ = { value: {} };
|
|
43
45
|
}
|
|
44
46
|
/**
|
|
45
47
|
* get command call structure
|
|
@@ -229,7 +231,7 @@ export function filterSpecArgs(args) {
|
|
|
229
231
|
* @return {Boolean} true if the provided string is Base64
|
|
230
232
|
*/
|
|
231
233
|
export function isBase64(str) {
|
|
232
|
-
|
|
234
|
+
const notBase64 = new RegExp('[^A-Z0-9+\\/=]', 'i');
|
|
233
235
|
if (typeof str !== 'string') {
|
|
234
236
|
throw new Error('Expected string but received invalid type.');
|
|
235
237
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/utils",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.14",
|
|
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",
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
"url": "https://github.com/webdriverio/webdriverio/issues"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@wdio/logger": "8.0.
|
|
31
|
-
"@wdio/types": "8.0.
|
|
30
|
+
"@wdio/logger": "8.0.14",
|
|
31
|
+
"@wdio/types": "8.0.14",
|
|
32
32
|
"import-meta-resolve": "^2.2.0",
|
|
33
33
|
"p-iteration": "^1.1.8"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "ab58bc79c1df2e146d02a68ee444766ec371e6d2"
|
|
39
39
|
}
|