@wdio/utils 8.17.0 → 8.18.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/driver/index.d.ts.map +1 -1
- package/build/driver/index.js +5 -2
- package/build/driver/utils.d.ts +1 -0
- package/build/driver/utils.d.ts.map +1 -1
- package/build/driver/utils.js +22 -28
- package/build/index.d.ts +2 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -2
- package/build/utils.d.ts +7 -0
- package/build/utils.d.ts.map +1 -1
- package/build/utils.js +14 -3
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/driver/index.ts"],"names":[],"mappings":";AAGA,OAAO,EAAyB,MAAM,oBAAoB,CAAA;AAQ1D,OAAO,EAA8B,KAAK,mBAAmB,IAAI,sBAAsB,EAAE,MAAM,cAAc,CAAA;AAC7G,OAAO,EAA6B,KAAK,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACnF,OAAO,EAA0C,KAAK,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAC9F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEzD,OAAO,KAAK,EAAgB,OAAO,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/driver/index.ts"],"names":[],"mappings":";AAGA,OAAO,EAAyB,MAAM,oBAAoB,CAAA;AAQ1D,OAAO,EAA8B,KAAK,mBAAmB,IAAI,sBAAsB,EAAE,MAAM,cAAc,CAAA;AAC7G,OAAO,EAA6B,KAAK,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACnF,OAAO,EAA0C,KAAK,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAC9F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEzD,OAAO,KAAK,EAAgB,OAAO,EAAE,MAAM,aAAa,CAAA;AAUxD,MAAM,MAAM,sBAAsB,GAAG,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,oBAAoB,EAAE,MAAM,GAAG,mBAAmB,GAAG,sBAAsB,CAAC,CAAA;AAChJ,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,WAAW,CAAC;QAClB,UAAU,mBAAoB,SAAQ,sBAAsB;SAAG;QAC/D,UAAU,kBAAmB,SAAQ,IAAI,CAAC,qBAAqB,EAAE,MAAM,CAAC;SAAG;QAC3E,UAAU,iBAAkB,SAAQ,IAAI,CAAC,oBAAoB,EAAE,MAAM,CAAC;SAAG;QACzE,UAAU,mBAAoB,SAAQ,IAAI,CAAC,sBAAsB,EAAE,MAAM,CAAC;SAAG;KAChF;CACJ;AAKD,wBAAsB,cAAc,CAAE,OAAO,EAAE,OAAO,CAAC,SAAS,wCA0J/D"}
|
package/build/driver/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import { deepmerge } from 'deepmerge-ts';
|
|
|
10
10
|
import { start as startSafaridriver } from 'safaridriver';
|
|
11
11
|
import { start as startGeckodriver } from 'geckodriver';
|
|
12
12
|
import { start as startEdgedriver, findEdgePath } from 'edgedriver';
|
|
13
|
+
import { isAppiumCapability } from '../utils.js';
|
|
13
14
|
import { parseParams, setupPuppeteerBrowser, definesRemoteDriver, setupChromedriver, isChrome, isFirefox, isEdge, isSafari, getCacheDir } from './utils.js';
|
|
14
15
|
import { SUPPORTED_BROWSERNAMES } from '../constants.js';
|
|
15
16
|
const log = logger('@wdio/utils');
|
|
@@ -37,10 +38,12 @@ export async function startWebDriver(options) {
|
|
|
37
38
|
/**
|
|
38
39
|
* session might be a mobile session so don't do anything
|
|
39
40
|
*/
|
|
41
|
+
if (isAppiumCapability(caps)) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
40
44
|
if (!caps.browserName) {
|
|
41
45
|
throw new Error('No "browserName" defined in capabilities nor hostname or port found!\n' +
|
|
42
|
-
'If you like to run a
|
|
43
|
-
'WebdriverIO options. If you like to run a local browser session make sure to pick from one of ' +
|
|
46
|
+
'If you like to run a local browser session make sure to pick from one of ' +
|
|
44
47
|
`the following browser names: ${Object.values(SUPPORTED_BROWSERNAMES).flat(Infinity)}`);
|
|
45
48
|
}
|
|
46
49
|
const port = await getPort();
|
package/build/driver/utils.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare function setupPuppeteerBrowser(cacheDir: string, caps: WebdriverI
|
|
|
13
13
|
}>;
|
|
14
14
|
export declare function getDriverOptions(caps: WebdriverIO.Capabilities): WebdriverIO.ChromedriverOptions | WebdriverIO.GeckodriverOptions | WebdriverIO.EdgedriverOptions;
|
|
15
15
|
export declare function getCacheDir(options: Pick<Options.WebDriver, 'cacheDir'>, caps: WebdriverIO.Capabilities): string;
|
|
16
|
+
export declare function getMajorVersionFromString(fullVersion: string): string;
|
|
16
17
|
export declare function setupChromedriver(cacheDir: string, driverVersion?: string): Promise<{
|
|
17
18
|
executablePath: string;
|
|
18
19
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/driver/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/driver/utils.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAO1C,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;AAoBD,wBAAsB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,CAAC,YAAY;;;;;;GA6E3F;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;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"}
|
package/build/driver/utils.js
CHANGED
|
@@ -3,7 +3,6 @@ import fs from 'node:fs';
|
|
|
3
3
|
import fsp from 'node:fs/promises';
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import cp from 'node:child_process';
|
|
6
|
-
import got from 'got';
|
|
7
6
|
import decamelize from 'decamelize';
|
|
8
7
|
import logger from '@wdio/logger';
|
|
9
8
|
import { install, canDownload, resolveBuildId, detectBrowserPlatform, Browser, ChromeReleaseChannel, computeExecutablePath } from '@puppeteer/browsers';
|
|
@@ -166,6 +165,13 @@ export function getCacheDir(options, caps) {
|
|
|
166
165
|
const driverOptions = getDriverOptions(caps);
|
|
167
166
|
return driverOptions.cacheDir || options.cacheDir || os.tmpdir();
|
|
168
167
|
}
|
|
168
|
+
export function getMajorVersionFromString(fullVersion) {
|
|
169
|
+
let prefix;
|
|
170
|
+
if (fullVersion) {
|
|
171
|
+
prefix = fullVersion.match(/^[+-]?([0-9]+)/);
|
|
172
|
+
}
|
|
173
|
+
return prefix && prefix.length > 0 ? prefix[0] : '';
|
|
174
|
+
}
|
|
169
175
|
export async function setupChromedriver(cacheDir, driverVersion) {
|
|
170
176
|
const platform = detectBrowserPlatform();
|
|
171
177
|
if (!platform) {
|
|
@@ -179,7 +185,6 @@ export async function setupChromedriver(cacheDir, driverVersion) {
|
|
|
179
185
|
platform,
|
|
180
186
|
cacheDir
|
|
181
187
|
});
|
|
182
|
-
let loggedBuildId = buildId;
|
|
183
188
|
const hasChromedriverInstalled = await fsp.access(executablePath).then(() => true, () => false);
|
|
184
189
|
if (!hasChromedriverInstalled) {
|
|
185
190
|
log.info(`Downloading Chromedriver v${buildId}`);
|
|
@@ -191,39 +196,28 @@ export async function setupChromedriver(cacheDir, driverVersion) {
|
|
|
191
196
|
unpack: true,
|
|
192
197
|
downloadProgressCallback: (downloadedBytes, totalBytes) => downloadProgressCallback('Chromedriver', downloadedBytes, totalBytes)
|
|
193
198
|
};
|
|
194
|
-
|
|
199
|
+
let knownBuild = buildId;
|
|
200
|
+
if (await canDownload(chromedriverInstallOpts)) {
|
|
195
201
|
await _install({ ...chromedriverInstallOpts, buildId });
|
|
196
202
|
log.info(`Download of Chromedriver v${buildId} was successful`);
|
|
197
203
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
let knownGoodVersion;
|
|
205
|
-
if (buildId.includes('.')) {
|
|
206
|
-
const majorVersion = buildId.split('.')[0];
|
|
207
|
-
const knownGoodVersions = await got('https://googlechromelabs.github.io/chrome-for-testing/known-good-versions.json').json();
|
|
208
|
-
const versionMatch = knownGoodVersions.versions.filter(({ version }) => version.startsWith(majorVersion)).pop();
|
|
209
|
-
if (!versionMatch) {
|
|
210
|
-
throw new Error(`Couldn't find known good version for Chromedriver v${majorVersion}`);
|
|
211
|
-
}
|
|
212
|
-
knownGoodVersion = versionMatch.version;
|
|
204
|
+
else {
|
|
205
|
+
log.warn(`Chromedriver v${buildId} don't exist, trying to find known good version...`);
|
|
206
|
+
knownBuild = await resolveBuildId(Browser.CHROMEDRIVER, platform, getMajorVersionFromString(version));
|
|
207
|
+
if (knownBuild) {
|
|
208
|
+
await _install({ ...chromedriverInstallOpts, buildId: knownBuild });
|
|
209
|
+
log.info(`Download of Chromedriver v${knownBuild} was successful`);
|
|
213
210
|
}
|
|
214
211
|
else {
|
|
215
|
-
|
|
212
|
+
throw new Error(`Couldn't download any known good version from Chromedriver major v${getMajorVersionFromString(version)}, requested full version - v${version}`);
|
|
216
213
|
}
|
|
217
|
-
loggedBuildId = knownGoodVersion;
|
|
218
|
-
await _install({ ...chromedriverInstallOpts, buildId: loggedBuildId });
|
|
219
|
-
log.info(`Download of Chromedriver v${loggedBuildId} was successful`);
|
|
220
|
-
executablePath = computeExecutablePath({
|
|
221
|
-
browser: Browser.CHROMEDRIVER,
|
|
222
|
-
buildId: loggedBuildId,
|
|
223
|
-
platform,
|
|
224
|
-
cacheDir
|
|
225
|
-
});
|
|
226
214
|
}
|
|
215
|
+
executablePath = computeExecutablePath({
|
|
216
|
+
browser: Browser.CHROMEDRIVER,
|
|
217
|
+
buildId: knownBuild,
|
|
218
|
+
platform,
|
|
219
|
+
cacheDir
|
|
220
|
+
});
|
|
227
221
|
}
|
|
228
222
|
else {
|
|
229
223
|
log.info(`Using Chromedriver v${buildId} from cache directory ${cacheDir}`);
|
package/build/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import initialisePlugin from './initialisePlugin.js';
|
|
2
2
|
import { initialiseWorkerService, initialiseLauncherService } from './initialiseServices.js';
|
|
3
3
|
import webdriverMonad from './monad.js';
|
|
4
|
-
import { commandCallStructure, isValidParameter, getArgumentType, safeImport, isFunctionAsync, transformCommandLogResult, canAccess, sleep } from './utils.js';
|
|
4
|
+
import { commandCallStructure, isValidParameter, getArgumentType, safeImport, isFunctionAsync, transformCommandLogResult, canAccess, sleep, isAppiumCapability } from './utils.js';
|
|
5
5
|
import { wrapCommand, executeHooksWithArgs, executeAsync } from './shim.js';
|
|
6
6
|
import { testFnWrapper, wrapGlobalTestMethod } from './test-framework/index.js';
|
|
7
7
|
import { isW3C, capabilitiesEnvironmentDetector, sessionEnvironmentDetector, devtoolsEnvironmentDetector } from './envDetector.js';
|
|
8
8
|
import { startWebDriver } from './driver/index.js';
|
|
9
9
|
import { setupDriver, setupBrowser } from './driver/manager.js';
|
|
10
10
|
import { UNICODE_CHARACTERS } from './constants.js';
|
|
11
|
-
export { initialisePlugin, initialiseLauncherService, initialiseWorkerService, isFunctionAsync, transformCommandLogResult, webdriverMonad, commandCallStructure, isValidParameter, getArgumentType, safeImport, canAccess, sleep, startWebDriver, setupBrowser, setupDriver,
|
|
11
|
+
export { initialisePlugin, initialiseLauncherService, initialiseWorkerService, isFunctionAsync, transformCommandLogResult, webdriverMonad, commandCallStructure, isValidParameter, getArgumentType, safeImport, canAccess, sleep, isAppiumCapability, startWebDriver, setupBrowser, setupDriver,
|
|
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,gBAAgB,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AAC5F,OAAO,cAAc,MAAM,YAAY,CA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B,EAC/B,2BAA2B;AAE3B;;GAEG;AACH,kBAAkB,EACrB,CAAA"}
|
package/build/index.js
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import initialisePlugin from './initialisePlugin.js';
|
|
3
3
|
import { initialiseWorkerService, initialiseLauncherService } from './initialiseServices.js';
|
|
4
4
|
import webdriverMonad from './monad.js';
|
|
5
|
-
import { commandCallStructure, isValidParameter, getArgumentType, safeImport, isFunctionAsync, transformCommandLogResult, canAccess, sleep } from './utils.js';
|
|
5
|
+
import { commandCallStructure, isValidParameter, getArgumentType, safeImport, isFunctionAsync, transformCommandLogResult, canAccess, sleep, isAppiumCapability } from './utils.js';
|
|
6
6
|
import { wrapCommand, executeHooksWithArgs, executeAsync } from './shim.js';
|
|
7
7
|
import { testFnWrapper, wrapGlobalTestMethod } from './test-framework/index.js';
|
|
8
8
|
import { isW3C, capabilitiesEnvironmentDetector, sessionEnvironmentDetector, devtoolsEnvironmentDetector } from './envDetector.js';
|
|
9
9
|
import { startWebDriver } from './driver/index.js';
|
|
10
10
|
import { setupDriver, setupBrowser } from './driver/manager.js';
|
|
11
11
|
import { UNICODE_CHARACTERS } from './constants.js';
|
|
12
|
-
export { initialisePlugin, initialiseLauncherService, initialiseWorkerService, isFunctionAsync, transformCommandLogResult, webdriverMonad, commandCallStructure, isValidParameter, getArgumentType, safeImport, canAccess, sleep, startWebDriver, setupBrowser, setupDriver,
|
|
12
|
+
export { initialisePlugin, initialiseLauncherService, initialiseWorkerService, isFunctionAsync, transformCommandLogResult, webdriverMonad, commandCallStructure, isValidParameter, getArgumentType, safeImport, canAccess, sleep, isAppiumCapability, startWebDriver, setupBrowser, setupDriver,
|
|
13
13
|
/**
|
|
14
14
|
* runner shim
|
|
15
15
|
*/
|
package/build/utils.d.ts
CHANGED
|
@@ -73,4 +73,11 @@ export declare const canAccess: (file?: string) => boolean;
|
|
|
73
73
|
* @param {number=0} ms number in ms to sleep
|
|
74
74
|
*/
|
|
75
75
|
export declare const sleep: (ms?: number) => Promise<unknown>;
|
|
76
|
+
/**
|
|
77
|
+
* Checks if the provided WebdriverIO capabilities object is related to Appium.
|
|
78
|
+
*
|
|
79
|
+
* @param {WebdriverIO.Capabilities} caps - The capabilities object to check.
|
|
80
|
+
* @returns {boolean} Returns true if the provided capabilities are related to Appium, false otherwise.
|
|
81
|
+
*/
|
|
82
|
+
export declare function isAppiumCapability(caps: WebdriverIO.Capabilities): boolean;
|
|
76
83
|
//# 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":"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,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,CA2DtF;AAED;;;;GAIG;AACH,w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AACH,wBAAgB,cAAc,CAAE,IAAI,EAAE,GAAG,EAAE,SAE1C;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,WAenC;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,UAAW,MAAM,YAWtC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,KAAK,mCAAoD,CAAA;AAEtE;;;;;EAKE;AACF,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,WAAW,CAAC,YAAY,GAAG,OAAO,CAM1E"}
|
package/build/utils.js
CHANGED
|
@@ -4,7 +4,7 @@ import { pathToFileURL } from 'node:url';
|
|
|
4
4
|
import { resolve } from 'import-meta-resolve';
|
|
5
5
|
const SCREENSHOT_REPLACEMENT = '"<Screenshot[base64]>"';
|
|
6
6
|
const SCRIPT_PLACEHOLDER = '"<Script[base64]>"';
|
|
7
|
-
const REGEX_SCRIPT_NAME = /return \(function (\w+)/;
|
|
7
|
+
const REGEX_SCRIPT_NAME = /return \((async )?function (\w+)/;
|
|
8
8
|
/**
|
|
9
9
|
* overwrite native element commands with user defined
|
|
10
10
|
* @param {object} propertiesObject propertiesObject
|
|
@@ -49,7 +49,7 @@ export function overwriteElementCommands(propertiesObject) {
|
|
|
49
49
|
*/
|
|
50
50
|
export function commandCallStructure(commandName, args, unfurl = false) {
|
|
51
51
|
const callArgs = args.map((arg) => {
|
|
52
|
-
if (typeof arg === 'string' && (arg.startsWith('!function(') || arg.startsWith('return (function'))) {
|
|
52
|
+
if (typeof arg === 'string' && (arg.startsWith('!function(') || arg.startsWith('return (function') || arg.startsWith('return (async function'))) {
|
|
53
53
|
arg = '<fn>';
|
|
54
54
|
}
|
|
55
55
|
else if (typeof arg === 'string' &&
|
|
@@ -94,7 +94,7 @@ export function transformCommandLogResult(result) {
|
|
|
94
94
|
return SCRIPT_PLACEHOLDER;
|
|
95
95
|
}
|
|
96
96
|
else if (typeof result.script === 'string' && result.script.match(REGEX_SCRIPT_NAME)) {
|
|
97
|
-
const newScript = result.script.match(REGEX_SCRIPT_NAME)[
|
|
97
|
+
const newScript = result.script.match(REGEX_SCRIPT_NAME)[2];
|
|
98
98
|
return { ...result, script: `${newScript}(...) [${Buffer.byteLength(result.script, 'utf-8')} bytes]` };
|
|
99
99
|
}
|
|
100
100
|
else if (typeof result.script === 'string' && result.script.startsWith('!function(')) {
|
|
@@ -266,3 +266,14 @@ export const canAccess = (file) => {
|
|
|
266
266
|
* @param {number=0} ms number in ms to sleep
|
|
267
267
|
*/
|
|
268
268
|
export const sleep = (ms = 0) => new Promise((r) => setTimeout(r, ms));
|
|
269
|
+
/**
|
|
270
|
+
* Checks if the provided WebdriverIO capabilities object is related to Appium.
|
|
271
|
+
*
|
|
272
|
+
* @param {WebdriverIO.Capabilities} caps - The capabilities object to check.
|
|
273
|
+
* @returns {boolean} Returns true if the provided capabilities are related to Appium, false otherwise.
|
|
274
|
+
*/
|
|
275
|
+
export function isAppiumCapability(caps) {
|
|
276
|
+
return Boolean(caps &&
|
|
277
|
+
// @ts-expect-error outdated jsonwp cap
|
|
278
|
+
(caps.automationName || caps['appium:automationName'] || caps.deviceName || caps.appiumVersion));
|
|
279
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/utils",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.18.2",
|
|
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",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "910c79f1640f0100e763a507fdcaee9e4f52560f"
|
|
52
52
|
}
|