@wdio/utils 8.20.3 → 8.22.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/envDetector.d.ts.map +1 -1
- package/build/envDetector.js +15 -2
- package/build/shim.d.ts.map +1 -1
- package/build/shim.js +8 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"envDetector.d.ts","sourceRoot":"","sources":["../src/envDetector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAQ/C;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC,mBAAmB,WAwCpE;
|
|
1
|
+
{"version":3,"file":"envDetector.d.ts","sourceRoot":"","sources":["../src/envDetector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAQ/C;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC,mBAAmB,WAwCpE;AAwKD;;;;;GAKG;AACH,wBAAgB,+BAA+B,CAAC,YAAY,EAAE,WAAW,CAAC,YAAY,EAAE,kBAAkB,EAAE,MAAM;;;;;;;;EAIjH;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,EAAE,YAAY,EAAE,qBAAqB,EAAE,EAC9E;IAAE,YAAY,EAAE,YAAY,CAAC,gBAAgB,CAAC;IAAC,qBAAqB,EAAE,YAAY,CAAC,gBAAgB,CAAA;CAAE;;;;;;;;;;EAexG;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,EAAE,WAAW,EAAE,EAAE,WAAW,CAAC,YAAY;;;;;;;;;;;EAapF;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAAC,YAAY,EAAE,WAAW,CAAC,YAAY;;;;;;;;EAUlF"}
|
package/build/envDetector.js
CHANGED
|
@@ -76,6 +76,8 @@ function isFirefox(capabilities) {
|
|
|
76
76
|
*/
|
|
77
77
|
function isMobile(capabilities) {
|
|
78
78
|
const browserName = (capabilities.browserName || '').toLowerCase();
|
|
79
|
+
const bsOptions = capabilities['bstack:options'] || {};
|
|
80
|
+
const browserstackBrowserName = (bsOptions.browserName || '').toLowerCase();
|
|
79
81
|
/**
|
|
80
82
|
* we have mobile capabilities if
|
|
81
83
|
*/
|
|
@@ -86,6 +88,9 @@ function isMobile(capabilities) {
|
|
|
86
88
|
capabilities.platformName && capabilities.platformName.match(/ios/i) ||
|
|
87
89
|
capabilities.platformName && capabilities.platformName.match(/tvos/i) ||
|
|
88
90
|
capabilities.platformName && capabilities.platformName.match(/android/i) ||
|
|
91
|
+
/ios/i.test(bsOptions.platformName || '') ||
|
|
92
|
+
/tvos/i.test(bsOptions.platformName || '') ||
|
|
93
|
+
/android/i.test(bsOptions.platformName || '') ||
|
|
89
94
|
/**
|
|
90
95
|
* capabilities contain mobile only specific capabilities
|
|
91
96
|
*/
|
|
@@ -94,10 +99,12 @@ function isMobile(capabilities) {
|
|
|
94
99
|
* browserName is empty (and eventually app is defined)
|
|
95
100
|
*/
|
|
96
101
|
capabilities.browserName === '' ||
|
|
102
|
+
bsOptions.browserName === '' ||
|
|
97
103
|
/**
|
|
98
104
|
* browserName is a mobile browser
|
|
99
105
|
*/
|
|
100
|
-
MOBILE_BROWSER_NAMES.includes(browserName)
|
|
106
|
+
MOBILE_BROWSER_NAMES.includes(browserName) ||
|
|
107
|
+
MOBILE_BROWSER_NAMES.includes(browserstackBrowserName));
|
|
101
108
|
}
|
|
102
109
|
/**
|
|
103
110
|
* check if session is run on iOS device
|
|
@@ -105,11 +112,14 @@ function isMobile(capabilities) {
|
|
|
105
112
|
* @return {Boolean} true if run on iOS device
|
|
106
113
|
*/
|
|
107
114
|
function isIOS(capabilities) {
|
|
115
|
+
const bsOptions = capabilities?.['bstack:options'] || {};
|
|
108
116
|
if (!capabilities) {
|
|
109
117
|
return false;
|
|
110
118
|
}
|
|
111
119
|
return Boolean((capabilities.platformName && capabilities.platformName.match(/iOS/i)) ||
|
|
112
|
-
(capabilities.deviceName && capabilities.deviceName.match(/(iPad|iPhone)/i))
|
|
120
|
+
(capabilities.deviceName && capabilities.deviceName.match(/(iPad|iPhone)/i)) ||
|
|
121
|
+
(/iOS/i.test(bsOptions.platformName || '')) ||
|
|
122
|
+
(/(iPad|iPhone)/i.test(bsOptions.deviceName || '')));
|
|
113
123
|
}
|
|
114
124
|
/**
|
|
115
125
|
* check if session is run on Android device
|
|
@@ -117,10 +127,13 @@ function isIOS(capabilities) {
|
|
|
117
127
|
* @return {Boolean} true if run on Android device
|
|
118
128
|
*/
|
|
119
129
|
function isAndroid(capabilities) {
|
|
130
|
+
const bsOptions = capabilities?.['bstack:options'] || {};
|
|
120
131
|
if (!capabilities) {
|
|
121
132
|
return false;
|
|
122
133
|
}
|
|
123
134
|
return Boolean((capabilities.platformName && capabilities.platformName.match(/Android/i)) ||
|
|
135
|
+
(/Android/i.test(bsOptions.platformName || '')) ||
|
|
136
|
+
(/Android/i.test(bsOptions.browserName || '')) ||
|
|
124
137
|
(capabilities.browserName && capabilities.browserName.match(/Android/i)));
|
|
125
138
|
}
|
|
126
139
|
/**
|
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.22.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.21.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": "81496a30b1c50e7d4129be6997f1a557f9659224"
|
|
59
59
|
}
|