@wdio/utils 8.33.1 → 8.35.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/index.d.ts +2 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -2
- package/build/shim.d.ts.map +1 -1
- package/build/shim.js +20 -1
- package/build/utils.d.ts +4 -0
- package/build/utils.d.ts.map +1 -1
- package/build/utils.js +10 -0
- package/package.json +2 -2
package/build/index.d.ts
CHANGED
|
@@ -2,13 +2,13 @@ import webdriverMonad from './monad.js';
|
|
|
2
2
|
import initializePlugin from './initializePlugin.js';
|
|
3
3
|
import { startWebDriver } from './startWebDriver.js';
|
|
4
4
|
import { initializeWorkerService, initializeLauncherService } from './initializeServices.js';
|
|
5
|
-
import { commandCallStructure, isValidParameter, getArgumentType, safeImport, isFunctionAsync, transformCommandLogResult, sleep, isAppiumCapability } from './utils.js';
|
|
5
|
+
import { commandCallStructure, isValidParameter, getArgumentType, safeImport, isFunctionAsync, transformCommandLogResult, sleep, isAppiumCapability, getBrowserObject } from './utils.js';
|
|
6
6
|
import { wrapCommand, executeHooksWithArgs, executeAsync } from './shim.js';
|
|
7
7
|
import * as asyncIterators from './pIteration.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, initializePlugin, initializeLauncherService, initializeWorkerService, isFunctionAsync, transformCommandLogResult, webdriverMonad, commandCallStructure, isValidParameter, getArgumentType, safeImport, sleep, isAppiumCapability, asyncIterators,
|
|
11
|
+
export { startWebDriver, initializePlugin, initializeLauncherService, initializeWorkerService, isFunctionAsync, transformCommandLogResult, webdriverMonad, commandCallStructure, isValidParameter, getArgumentType, safeImport, sleep, isAppiumCapability, getBrowserObject, asyncIterators,
|
|
12
12
|
/**
|
|
13
13
|
* runner shim
|
|
14
14
|
*/
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,cAAc,MAAM,YAAY,CAAA;AACvC,OAAO,gBAAgB,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AAC5F,OAAO,EACH,oBAAoB,EAAE,gBAAgB,EAAE,eAAe,EAAE,UAAU,EACnE,eAAe,EAAE,yBAAyB,EAAE,KAAK,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,cAAc,MAAM,YAAY,CAAA;AACvC,OAAO,gBAAgB,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AAC5F,OAAO,EACH,oBAAoB,EAAE,gBAAgB,EAAE,eAAe,EAAE,UAAU,EACnE,eAAe,EAAE,yBAAyB,EAAE,KAAK,EAAE,kBAAkB,EACrE,gBAAgB,EACnB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAC3E,OAAO,KAAK,cAAc,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAC/E,OAAO,EACH,KAAK,EAAE,+BAA+B,EACtC,0BAA0B,EAAE,2BAA2B,EAC1D,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAEpE,OAAO,EACH,cAAc,EACd,gBAAgB,EAChB,yBAAyB,EACzB,uBAAuB,EACvB,eAAe,EACf,yBAAyB,EACzB,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,KAAK,EACL,kBAAkB,EAClB,gBAAgB,EAChB,cAAc;AAEd;;GAEG;AACH,WAAW,EACX,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,oBAAoB;AAEpB;;GAEG;AACH,KAAK,EACL,0BAA0B,EAC1B,+BAA+B,EAC/B,2BAA2B;AAE3B;;GAEG;AACH,kBAAkB,EAClB,eAAe,EAClB,CAAA"}
|
package/build/index.js
CHANGED
|
@@ -3,13 +3,13 @@ import webdriverMonad from './monad.js';
|
|
|
3
3
|
import initializePlugin from './initializePlugin.js';
|
|
4
4
|
import { startWebDriver } from './startWebDriver.js';
|
|
5
5
|
import { initializeWorkerService, initializeLauncherService } from './initializeServices.js';
|
|
6
|
-
import { commandCallStructure, isValidParameter, getArgumentType, safeImport, isFunctionAsync, transformCommandLogResult, sleep, isAppiumCapability } from './utils.js';
|
|
6
|
+
import { commandCallStructure, isValidParameter, getArgumentType, safeImport, isFunctionAsync, transformCommandLogResult, sleep, isAppiumCapability, getBrowserObject } from './utils.js';
|
|
7
7
|
import { wrapCommand, executeHooksWithArgs, executeAsync } from './shim.js';
|
|
8
8
|
import * as asyncIterators from './pIteration.js';
|
|
9
9
|
import { testFnWrapper, wrapGlobalTestMethod } from './test-framework/index.js';
|
|
10
10
|
import { isW3C, capabilitiesEnvironmentDetector, sessionEnvironmentDetector, devtoolsEnvironmentDetector } from './envDetector.js';
|
|
11
11
|
import { UNICODE_CHARACTERS, HOOK_DEFINITION } from './constants.js';
|
|
12
|
-
export { startWebDriver, initializePlugin, initializeLauncherService, initializeWorkerService, isFunctionAsync, transformCommandLogResult, webdriverMonad, commandCallStructure, isValidParameter, getArgumentType, safeImport, sleep, isAppiumCapability, asyncIterators,
|
|
12
|
+
export { startWebDriver, initializePlugin, initializeLauncherService, initializeWorkerService, isFunctionAsync, transformCommandLogResult, webdriverMonad, commandCallStructure, isValidParameter, getArgumentType, safeImport, sleep, isAppiumCapability, getBrowserObject, asyncIterators,
|
|
13
13
|
/**
|
|
14
14
|
* runner shim
|
|
15
15
|
*/
|
package/build/shim.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shim.d.ts","sourceRoot":"","sources":["../src/shim.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shim.d.ts","sourceRoot":"","sources":["../src/shim.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAW,UAAU,EAAE,MAAM,aAAa,CAAA;AAsBtD,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,CA4DvJ;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,CAqN9F;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
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
/// <reference types="@wdio/globals/types" />
|
|
1
2
|
import logger from '@wdio/logger';
|
|
2
3
|
import * as iterators from './pIteration.js';
|
|
4
|
+
import { getBrowserObject } from './utils.js';
|
|
3
5
|
const log = logger('@wdio/utils:shim');
|
|
4
6
|
let inCommandHook = false;
|
|
5
7
|
const ELEMENT_QUERY_COMMANDS = [
|
|
@@ -136,9 +138,26 @@ export function wrapCommand(commandName, fn) {
|
|
|
136
138
|
* `this` is an array of WebdriverIO elements
|
|
137
139
|
*
|
|
138
140
|
* Note(Christian): types for elements are defined in the
|
|
139
|
-
* webdriverio package and not accessible here
|
|
141
|
+
* webdriverio package and not accessible here (fixed in v9)
|
|
140
142
|
*/
|
|
141
143
|
function (index) {
|
|
144
|
+
/**
|
|
145
|
+
* if we access an index that is out of bounds we wait for the
|
|
146
|
+
* array to get that long, and timeout eventually if it doesn't
|
|
147
|
+
*/
|
|
148
|
+
if (index >= this.length) {
|
|
149
|
+
const browser = getBrowserObject(this);
|
|
150
|
+
return browser.waitUntil(async () => {
|
|
151
|
+
const elems = await this.parent[this.foundWith](this.selector);
|
|
152
|
+
if (elems.length > index) {
|
|
153
|
+
return elems[index];
|
|
154
|
+
}
|
|
155
|
+
return false;
|
|
156
|
+
}, {
|
|
157
|
+
timeout: browser.options.waitforTimeout,
|
|
158
|
+
timeoutMsg: `Index out of bounds! $$(${this.selector}) returned only ${this.length} elements.`
|
|
159
|
+
});
|
|
160
|
+
}
|
|
142
161
|
return this[index];
|
|
143
162
|
}, [prop], { prop, args });
|
|
144
163
|
}
|
package/build/utils.d.ts
CHANGED
|
@@ -88,4 +88,8 @@ export declare function isChrome(browserName?: string): boolean;
|
|
|
88
88
|
export declare function isSafari(browserName?: string): boolean;
|
|
89
89
|
export declare function isFirefox(browserName?: string): boolean;
|
|
90
90
|
export declare function isEdge(browserName?: string): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* traverse up the scope chain until browser element was reached
|
|
93
|
+
*/
|
|
94
|
+
export declare function getBrowserObject(elem: WebdriverIO.Element | WebdriverIO.Browser): WebdriverIO.Browser;
|
|
91
95
|
//# sourceMappingURL=utils.d.ts.map
|
package/build/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAW,MAAM,aAAa,CAAA;AAe7D,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,WAGnC;AAED;;;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,EAAE,MAAM,UAAQ,UA+BrF;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,CAgEtF;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,WAenC;AAED;;;GAGG;AACH,eAAO,MAAM,KAAK,mCAAoD,CAAA;AAEtE;;;;;EAKE;AACF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,WAAW,CAAC,YAAY,GAAG,OAAO,CAM1E;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,KAAK,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC,WAQ/H;AAED,wBAAgB,QAAQ,CAAE,WAAW,CAAC,EAAE,MAAM,WAE7C;AACD,wBAAgB,QAAQ,CAAE,WAAW,CAAC,EAAE,MAAM,WAE7C;AACD,wBAAgB,SAAS,CAAE,WAAW,CAAC,EAAE,MAAM,WAE9C;AACD,wBAAgB,MAAM,CAAE,WAAW,CAAC,EAAE,MAAM,WAE3C;AAED;;GAEG;AAEH,wBAAgB,gBAAgB,CAAE,IAAI,EAAE,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,GAAG,WAAW,CAAC,OAAO,CAKtG"}
|
package/build/utils.js
CHANGED
|
@@ -300,3 +300,13 @@ export function isFirefox(browserName) {
|
|
|
300
300
|
export function isEdge(browserName) {
|
|
301
301
|
return Boolean(browserName && SUPPORTED_BROWSERNAMES.edge.includes(browserName.toLowerCase()));
|
|
302
302
|
}
|
|
303
|
+
/**
|
|
304
|
+
* traverse up the scope chain until browser element was reached
|
|
305
|
+
*/
|
|
306
|
+
// @ts-ignore types are not loaded in time (fixed in v9)
|
|
307
|
+
export function getBrowserObject(elem) {
|
|
308
|
+
// @ts-ignore types are not loaded in time (fixed in v9)
|
|
309
|
+
const elemObject = elem;
|
|
310
|
+
// @ts-ignore types are not loaded in time (fixed in v9)
|
|
311
|
+
return elemObject.parent ? getBrowserObject(elemObject.parent) : elem;
|
|
312
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/utils",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.35.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",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "d6eab1a26ca9feebcde789adacd872067b6c7b83"
|
|
58
58
|
}
|