@wdio/utils 8.18.2 → 8.20.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/constants.d.ts +4 -0
- package/build/constants.d.ts.map +1 -1
- package/build/constants.js +24 -0
- package/build/index.d.ts +6 -7
- package/build/index.d.ts.map +1 -1
- package/build/index.js +6 -7
- package/build/initialisePlugin.d.ts.map +1 -1
- package/build/initialisePlugin.js +2 -3
- package/build/node/index.d.ts +4 -0
- package/build/node/index.d.ts.map +1 -0
- package/build/node/index.js +3 -0
- package/build/node/manager.d.ts.map +1 -0
- package/build/{driver → node}/manager.js +2 -1
- package/build/{driver/index.d.ts → node/startWebDriver.d.ts} +2 -2
- package/build/node/startWebDriver.d.ts.map +1 -0
- package/build/{driver/index.js → node/startWebDriver.js} +2 -9
- package/build/{driver → node}/utils.d.ts +6 -13
- package/build/node/utils.d.ts.map +1 -0
- package/build/{driver → node}/utils.js +17 -28
- package/build/shim.d.ts +4 -19
- package/build/shim.d.ts.map +1 -1
- package/build/shim.js +5 -6
- package/build/startWebDriver.d.ts +4 -0
- package/build/startWebDriver.d.ts.map +1 -0
- package/build/startWebDriver.js +17 -0
- package/build/utils.d.ts +15 -7
- package/build/utils.d.ts.map +1 -1
- package/build/utils.js +52 -29
- package/package.json +12 -5
- package/build/driver/index.d.ts.map +0 -1
- package/build/driver/manager.d.ts.map +0 -1
- package/build/driver/utils.d.ts.map +0 -1
- /package/build/{driver → node}/manager.d.ts +0 -0
package/build/constants.d.ts
CHANGED
|
@@ -88,4 +88,8 @@ export declare const SUPPORTED_BROWSERNAMES: {
|
|
|
88
88
|
export declare const DEFAULT_HOSTNAME = "0.0.0.0";
|
|
89
89
|
export declare const DEFAULT_PROTOCOL = "http";
|
|
90
90
|
export declare const DEFAULT_PATH = "/";
|
|
91
|
+
export declare const HOOK_DEFINITION: {
|
|
92
|
+
type: "object";
|
|
93
|
+
validate: (param: any) => void;
|
|
94
|
+
};
|
|
91
95
|
//# sourceMappingURL=constants.d.ts.map
|
package/build/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4ErB,CAAA;AAEV,eAAO,MAAM,sBAAsB;;;;;CAKlC,CAAA;AAED,eAAO,MAAM,gBAAgB,YAAY,CAAA;AACzC,eAAO,MAAM,gBAAgB,SAAS,CAAA;AACtC,eAAO,MAAM,YAAY,MAAM,CAAA"}
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4ErB,CAAA;AAEV,eAAO,MAAM,sBAAsB;;;;;CAKlC,CAAA;AAED,eAAO,MAAM,gBAAgB,YAAY,CAAA;AACzC,eAAO,MAAM,gBAAgB,SAAS,CAAA;AACtC,eAAO,MAAM,YAAY,MAAM,CAAA;AAE/B,eAAO,MAAM,eAAe;;sBAEN,GAAG;CAsBxB,CAAA"}
|
package/build/constants.js
CHANGED
|
@@ -88,3 +88,27 @@ export const SUPPORTED_BROWSERNAMES = {
|
|
|
88
88
|
export const DEFAULT_HOSTNAME = '0.0.0.0';
|
|
89
89
|
export const DEFAULT_PROTOCOL = 'http';
|
|
90
90
|
export const DEFAULT_PATH = '/';
|
|
91
|
+
/* istanbul ignore next */
|
|
92
|
+
export const HOOK_DEFINITION = {
|
|
93
|
+
type: 'object',
|
|
94
|
+
validate: (param) => {
|
|
95
|
+
/**
|
|
96
|
+
* option must be an array
|
|
97
|
+
*/
|
|
98
|
+
if (!Array.isArray(param)) {
|
|
99
|
+
throw new Error('a hook option needs to be a list of functions');
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* array elements must be functions
|
|
103
|
+
*/
|
|
104
|
+
for (const option of param) {
|
|
105
|
+
/**
|
|
106
|
+
* either a string
|
|
107
|
+
*/
|
|
108
|
+
if (typeof option === 'function') {
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
throw new Error('expected hook to be type of function');
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
};
|
package/build/index.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
+
import webdriverMonad from './monad.js';
|
|
1
2
|
import initialisePlugin from './initialisePlugin.js';
|
|
3
|
+
import { startWebDriver } from './startWebDriver.js';
|
|
2
4
|
import { initialiseWorkerService, initialiseLauncherService } from './initialiseServices.js';
|
|
3
|
-
import
|
|
4
|
-
import { commandCallStructure, isValidParameter, getArgumentType, safeImport, isFunctionAsync, transformCommandLogResult, canAccess, sleep, isAppiumCapability } from './utils.js';
|
|
5
|
+
import { commandCallStructure, isValidParameter, getArgumentType, safeImport, isFunctionAsync, transformCommandLogResult, sleep, isAppiumCapability } from './utils.js';
|
|
5
6
|
import { wrapCommand, executeHooksWithArgs, executeAsync } from './shim.js';
|
|
6
7
|
import { testFnWrapper, wrapGlobalTestMethod } from './test-framework/index.js';
|
|
7
8
|
import { isW3C, capabilitiesEnvironmentDetector, sessionEnvironmentDetector, devtoolsEnvironmentDetector } from './envDetector.js';
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
import { UNICODE_CHARACTERS } from './constants.js';
|
|
11
|
-
export { initialisePlugin, initialiseLauncherService, initialiseWorkerService, isFunctionAsync, transformCommandLogResult, webdriverMonad, commandCallStructure, isValidParameter, getArgumentType, safeImport, canAccess, sleep, isAppiumCapability, startWebDriver, setupBrowser, setupDriver,
|
|
9
|
+
import { UNICODE_CHARACTERS, HOOK_DEFINITION } from './constants.js';
|
|
10
|
+
export { startWebDriver, initialisePlugin, initialiseLauncherService, initialiseWorkerService, isFunctionAsync, transformCommandLogResult, webdriverMonad, commandCallStructure, isValidParameter, getArgumentType, safeImport, sleep, isAppiumCapability,
|
|
12
11
|
/**
|
|
13
12
|
* runner shim
|
|
14
13
|
*/
|
|
@@ -20,5 +19,5 @@ isW3C, sessionEnvironmentDetector, capabilitiesEnvironmentDetector, devtoolsEnvi
|
|
|
20
19
|
/**
|
|
21
20
|
* constants
|
|
22
21
|
*/
|
|
23
|
-
UNICODE_CHARACTERS };
|
|
22
|
+
UNICODE_CHARACTERS, HOOK_DEFINITION };
|
|
24
23
|
//# sourceMappingURL=index.d.ts.map
|
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,
|
|
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,EACxE,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAC3E,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;AAElB;;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
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
/* istanbul ignore file */
|
|
2
|
+
import webdriverMonad from './monad.js';
|
|
2
3
|
import initialisePlugin from './initialisePlugin.js';
|
|
4
|
+
import { startWebDriver } from './startWebDriver.js';
|
|
3
5
|
import { initialiseWorkerService, initialiseLauncherService } from './initialiseServices.js';
|
|
4
|
-
import
|
|
5
|
-
import { commandCallStructure, isValidParameter, getArgumentType, safeImport, isFunctionAsync, transformCommandLogResult, canAccess, sleep, isAppiumCapability } from './utils.js';
|
|
6
|
+
import { commandCallStructure, isValidParameter, getArgumentType, safeImport, isFunctionAsync, transformCommandLogResult, sleep, isAppiumCapability } from './utils.js';
|
|
6
7
|
import { wrapCommand, executeHooksWithArgs, executeAsync } from './shim.js';
|
|
7
8
|
import { testFnWrapper, wrapGlobalTestMethod } from './test-framework/index.js';
|
|
8
9
|
import { isW3C, capabilitiesEnvironmentDetector, sessionEnvironmentDetector, devtoolsEnvironmentDetector } from './envDetector.js';
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
import { UNICODE_CHARACTERS } from './constants.js';
|
|
12
|
-
export { initialisePlugin, initialiseLauncherService, initialiseWorkerService, isFunctionAsync, transformCommandLogResult, webdriverMonad, commandCallStructure, isValidParameter, getArgumentType, safeImport, canAccess, sleep, isAppiumCapability, startWebDriver, setupBrowser, setupDriver,
|
|
10
|
+
import { UNICODE_CHARACTERS, HOOK_DEFINITION } from './constants.js';
|
|
11
|
+
export { startWebDriver, initialisePlugin, initialiseLauncherService, initialiseWorkerService, isFunctionAsync, transformCommandLogResult, webdriverMonad, commandCallStructure, isValidParameter, getArgumentType, safeImport, sleep, isAppiumCapability,
|
|
13
12
|
/**
|
|
14
13
|
* runner shim
|
|
15
14
|
*/
|
|
@@ -21,4 +20,4 @@ isW3C, sessionEnvironmentDetector, capabilitiesEnvironmentDetector, devtoolsEnvi
|
|
|
21
20
|
/**
|
|
22
21
|
* constants
|
|
23
22
|
*/
|
|
24
|
-
UNICODE_CHARACTERS };
|
|
23
|
+
UNICODE_CHARACTERS, HOOK_DEFINITION };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialisePlugin.d.ts","sourceRoot":"","sources":["../src/initialisePlugin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"initialisePlugin.d.ts","sourceRoot":"","sources":["../src/initialisePlugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAI3C;;;;;GAKG;AACH,wBAA8B,gBAAgB,CAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,aAAa,GAAG,QAAQ,CAAC,YAAY,CAAC,CAqCpI"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { safeImport } from './utils.js';
|
|
1
|
+
import { safeImport, isAbsolute } from './utils.js';
|
|
3
2
|
/**
|
|
4
3
|
* initialise WebdriverIO compliant plugins like reporter or services in the following way:
|
|
5
4
|
* 1. if package name is scoped (starts with "@"), require scoped package name
|
|
@@ -10,7 +9,7 @@ export default async function initialisePlugin(name, type) {
|
|
|
10
9
|
/**
|
|
11
10
|
* directly import packages that are scoped or start with an absolute path
|
|
12
11
|
*/
|
|
13
|
-
if (name[0] === '@' ||
|
|
12
|
+
if (name[0] === '@' || isAbsolute(name)) {
|
|
14
13
|
const service = await safeImport(name);
|
|
15
14
|
if (service) {
|
|
16
15
|
return service;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/node/manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AA4GxD,wBAAsB,WAAW,CAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,kBAAkB,kCAezH;AAED,wBAAgB,YAAY,CAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,kBAAkB,kCAYpH"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import logger from '@wdio/logger';
|
|
2
|
-
import { getCacheDir,
|
|
2
|
+
import { getCacheDir, getDriverOptions, setupChromedriver, setupEdgedriver, setupGeckodriver, setupPuppeteerBrowser } from './utils.js';
|
|
3
|
+
import { definesRemoteDriver, isSafari, isEdge, isFirefox, isChrome } from '../utils.js';
|
|
3
4
|
const log = logger('@wdio/utils');
|
|
4
5
|
const UNDEFINED_BROWSER_VERSION = null;
|
|
5
6
|
var BrowserDriverTaskLabel;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
import cp from 'node:child_process';
|
|
3
3
|
import { type SafaridriverOptions as SafaridriverParameters } from 'safaridriver';
|
|
4
4
|
import { type GeckodriverParameters } from 'geckodriver';
|
|
@@ -19,4 +19,4 @@ declare global {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
export declare function startWebDriver(options: Options.WebDriver): Promise<cp.ChildProcess | undefined>;
|
|
22
|
-
//# sourceMappingURL=
|
|
22
|
+
//# sourceMappingURL=startWebDriver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startWebDriver.d.ts","sourceRoot":"","sources":["../../src/node/startWebDriver.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;AAMxD,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,wCAkJ/D"}
|
|
@@ -10,8 +10,8 @@ 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 {
|
|
14
|
-
import {
|
|
13
|
+
import { parseParams, setupPuppeteerBrowser, setupChromedriver, getCacheDir } from './utils.js';
|
|
14
|
+
import { isChrome, isFirefox, isEdge, isSafari, isAppiumCapability } from '../utils.js';
|
|
15
15
|
import { SUPPORTED_BROWSERNAMES } from '../constants.js';
|
|
16
16
|
const log = logger('@wdio/utils');
|
|
17
17
|
const DRIVER_WAIT_TIMEOUT = 10 * 1000; // 10s
|
|
@@ -24,13 +24,6 @@ export async function startWebDriver(options) {
|
|
|
24
24
|
options.port = 4321;
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
-
/**
|
|
28
|
-
* if any of the connection parameter are set, don't start any driver
|
|
29
|
-
*/
|
|
30
|
-
if (definesRemoteDriver(options)) {
|
|
31
|
-
log.info(`Connecting to existing driver at ${options.protocol}://${options.hostname}:${options.port}${options.path}`);
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
27
|
let driverProcess;
|
|
35
28
|
let driver = '';
|
|
36
29
|
const start = Date.now();
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { EdgedriverParameters } from 'edgedriver';
|
|
2
2
|
import type { Options } from '@wdio/types';
|
|
3
|
+
/**
|
|
4
|
+
* Helper utility to check file access
|
|
5
|
+
* @param {string} file file to check access for
|
|
6
|
+
* @return true if file can be accessed
|
|
7
|
+
*/
|
|
8
|
+
export declare const canAccess: (file?: string) => boolean;
|
|
3
9
|
export declare function parseParams(params: EdgedriverParameters): string[];
|
|
4
10
|
export declare function getBuildIdByChromePath(chromePath?: string): string | undefined;
|
|
5
11
|
export declare function getBuildIdByFirefoxPath(firefoxPath?: string): Promise<string | undefined>;
|
|
@@ -19,17 +25,4 @@ export declare function setupChromedriver(cacheDir: string, driverVersion?: stri
|
|
|
19
25
|
}>;
|
|
20
26
|
export declare function setupGeckodriver(cacheDir: string, driverVersion?: string): Promise<string>;
|
|
21
27
|
export declare function setupEdgedriver(cacheDir: string, driverVersion?: string): Promise<string>;
|
|
22
|
-
/**
|
|
23
|
-
* helper method to determine if we need to setup a browser driver
|
|
24
|
-
* which is:
|
|
25
|
-
* - whenever the user has set connection options that differ
|
|
26
|
-
* from the default, or a port is set
|
|
27
|
-
* - whenever the user defines `user` and `key` which later will
|
|
28
|
-
* update the connection options
|
|
29
|
-
*/
|
|
30
|
-
export declare function definesRemoteDriver(options: Pick<Options.WebDriver, 'user' | 'key' | 'protocol' | 'hostname' | 'port' | 'path'>): boolean;
|
|
31
|
-
export declare function isChrome(browserName?: string): boolean;
|
|
32
|
-
export declare function isSafari(browserName?: string): boolean;
|
|
33
|
-
export declare function isFirefox(browserName?: string): boolean;
|
|
34
|
-
export declare function isEdge(browserName?: string): boolean;
|
|
35
28
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/node/utils.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAK1C;;;;GAIG;AACH,eAAO,MAAM,SAAS,UAAW,MAAM,YAWtC,CAAA;AAED,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"}
|
|
@@ -9,9 +9,25 @@ import { install, canDownload, resolveBuildId, detectBrowserPlatform, Browser, C
|
|
|
9
9
|
import { download as downloadGeckodriver } from 'geckodriver';
|
|
10
10
|
import { download as downloadEdgedriver } from 'edgedriver';
|
|
11
11
|
import { locateChrome, locateFirefox } from 'locate-app';
|
|
12
|
-
import { DEFAULT_HOSTNAME, DEFAULT_PROTOCOL, DEFAULT_PATH, SUPPORTED_BROWSERNAMES } from '../constants.js';
|
|
13
12
|
const log = logger('webdriver');
|
|
14
13
|
const EXCLUDED_PARAMS = ['version', 'help'];
|
|
14
|
+
/**
|
|
15
|
+
* Helper utility to check file access
|
|
16
|
+
* @param {string} file file to check access for
|
|
17
|
+
* @return true if file can be accessed
|
|
18
|
+
*/
|
|
19
|
+
export const canAccess = (file) => {
|
|
20
|
+
if (!file) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
fs.accessSync(file);
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
15
31
|
export function parseParams(params) {
|
|
16
32
|
return Object.entries(params)
|
|
17
33
|
.filter(([key,]) => !EXCLUDED_PARAMS.includes(key))
|
|
@@ -230,30 +246,3 @@ export function setupGeckodriver(cacheDir, driverVersion) {
|
|
|
230
246
|
export function setupEdgedriver(cacheDir, driverVersion) {
|
|
231
247
|
return downloadEdgedriver(driverVersion, cacheDir);
|
|
232
248
|
}
|
|
233
|
-
/**
|
|
234
|
-
* helper method to determine if we need to setup a browser driver
|
|
235
|
-
* which is:
|
|
236
|
-
* - whenever the user has set connection options that differ
|
|
237
|
-
* from the default, or a port is set
|
|
238
|
-
* - whenever the user defines `user` and `key` which later will
|
|
239
|
-
* update the connection options
|
|
240
|
-
*/
|
|
241
|
-
export function definesRemoteDriver(options) {
|
|
242
|
-
return Boolean((options.protocol && options.protocol !== DEFAULT_PROTOCOL) ||
|
|
243
|
-
(options.hostname && options.hostname !== DEFAULT_HOSTNAME) ||
|
|
244
|
-
Boolean(options.port) ||
|
|
245
|
-
(options.path && options.path !== DEFAULT_PATH) ||
|
|
246
|
-
Boolean(options.user && options.key));
|
|
247
|
-
}
|
|
248
|
-
export function isChrome(browserName) {
|
|
249
|
-
return Boolean(browserName && SUPPORTED_BROWSERNAMES.chrome.includes(browserName.toLowerCase()));
|
|
250
|
-
}
|
|
251
|
-
export function isSafari(browserName) {
|
|
252
|
-
return Boolean(browserName && SUPPORTED_BROWSERNAMES.safari.includes(browserName.toLowerCase()));
|
|
253
|
-
}
|
|
254
|
-
export function isFirefox(browserName) {
|
|
255
|
-
return Boolean(browserName && SUPPORTED_BROWSERNAMES.firefox.includes(browserName.toLowerCase()));
|
|
256
|
-
}
|
|
257
|
-
export function isEdge(browserName) {
|
|
258
|
-
return Boolean(browserName && SUPPORTED_BROWSERNAMES.edge.includes(browserName.toLowerCase()));
|
|
259
|
-
}
|
package/build/shim.d.ts
CHANGED
|
@@ -1,25 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
attempts: number;
|
|
4
|
-
}
|
|
5
|
-
declare global {
|
|
6
|
-
var expectAsync: any;
|
|
7
|
-
}
|
|
8
|
-
declare global {
|
|
9
|
-
namespace NodeJS {
|
|
10
|
-
interface Global {
|
|
11
|
-
expect: any;
|
|
12
|
-
expectAsync: any;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
declare const executeHooksWithArgs: <T>(this: any, hookName: string, hooks?: Function | Function[], args?: any[]) => Promise<(Error | T)[]>;
|
|
1
|
+
import type { Frameworks } from '@wdio/types';
|
|
2
|
+
export declare function executeHooksWithArgs<T>(this: any, hookName: string, hooks?: Function | Function[], args?: any[]): Promise<(T | Error)[]>;
|
|
17
3
|
/**
|
|
18
4
|
* wrap command to enable before and after command to be executed
|
|
19
5
|
* @param commandName name of the command (e.g. getTitle)
|
|
20
6
|
* @param fn command function
|
|
21
7
|
*/
|
|
22
|
-
declare
|
|
8
|
+
export declare function wrapCommand<T>(commandName: string, fn: Function): (...args: any) => Promise<T>;
|
|
23
9
|
/**
|
|
24
10
|
* execute test or hook asynchronously
|
|
25
11
|
*
|
|
@@ -29,6 +15,5 @@ declare const wrapCommand: <T>(commandName: string, fn: Function) => (...args: a
|
|
|
29
15
|
* @param {number} timeout The maximum time (in milliseconds) to wait for the function to complete
|
|
30
16
|
* @return {Promise} that gets resolved once test/hook is done or was retried enough
|
|
31
17
|
*/
|
|
32
|
-
declare function executeAsync(this: any, fn: Function, retries:
|
|
33
|
-
export { executeHooksWithArgs, wrapCommand, executeAsync, };
|
|
18
|
+
export declare function executeAsync(this: any, fn: Function, retries: Frameworks.TestRetries, args?: any[], timeout?: number): Promise<unknown>;
|
|
34
19
|
//# sourceMappingURL=shim.d.ts.map
|
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":"AACA,OAAO,KAAK,EAAW,UAAU,EAAE,MAAM,aAAa,CAAA;AAmBtD,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,CAqCxJ"}
|
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
|
+
export async function executeHooksWithArgs(hookName, hooks = [], args = []) {
|
|
16
16
|
/**
|
|
17
17
|
* make sure hooks are an array of functions
|
|
18
18
|
*/
|
|
@@ -61,13 +61,13 @@ const executeHooksWithArgs = async function executeHooksWithArgsShim(hookName, h
|
|
|
61
61
|
log.debug(`Finished to run "${hookName}" hook in ${Date.now() - start}ms`);
|
|
62
62
|
}
|
|
63
63
|
return result;
|
|
64
|
-
}
|
|
64
|
+
}
|
|
65
65
|
/**
|
|
66
66
|
* wrap command to enable before and after command to be executed
|
|
67
67
|
* @param commandName name of the command (e.g. getTitle)
|
|
68
68
|
* @param fn command function
|
|
69
69
|
*/
|
|
70
|
-
|
|
70
|
+
export function wrapCommand(commandName, fn) {
|
|
71
71
|
async function wrapCommandFn(...args) {
|
|
72
72
|
const beforeHookArgs = [commandName, args];
|
|
73
73
|
if (!inCommandHook && this.options.beforeCommand) {
|
|
@@ -232,7 +232,7 @@ const wrapCommand = function wrapCommand(commandName, fn) {
|
|
|
232
232
|
: wrapCommandFn;
|
|
233
233
|
return command.apply(this, args);
|
|
234
234
|
};
|
|
235
|
-
}
|
|
235
|
+
}
|
|
236
236
|
/**
|
|
237
237
|
* execute test or hook asynchronously
|
|
238
238
|
*
|
|
@@ -242,7 +242,7 @@ const wrapCommand = function wrapCommand(commandName, fn) {
|
|
|
242
242
|
* @param {number} timeout The maximum time (in milliseconds) to wait for the function to complete
|
|
243
243
|
* @return {Promise} that gets resolved once test/hook is done or was retried enough
|
|
244
244
|
*/
|
|
245
|
-
async function executeAsync(fn, retries, args = [], timeout = 20000) {
|
|
245
|
+
export async function executeAsync(fn, retries, args = [], timeout = 20000) {
|
|
246
246
|
this.wdioRetries = retries.attempts;
|
|
247
247
|
try {
|
|
248
248
|
// @ts-expect-error
|
|
@@ -278,4 +278,3 @@ async function executeAsync(fn, retries, args = [], timeout = 20000) {
|
|
|
278
278
|
throw err;
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
|
-
export { executeHooksWithArgs, wrapCommand, executeAsync, };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
|
+
import type { Options } from '@wdio/types';
|
|
3
|
+
export declare function startWebDriver(options: Options.WebDriver): Promise<import("child_process").ChildProcess | undefined>;
|
|
4
|
+
//# sourceMappingURL=startWebDriver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"startWebDriver.d.ts","sourceRoot":"","sources":["../src/startWebDriver.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAM1C,wBAAsB,cAAc,CAAE,OAAO,EAAE,OAAO,CAAC,SAAS,6DAe/D"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import logger from '@wdio/logger';
|
|
2
|
+
import { definesRemoteDriver } from './utils.js';
|
|
3
|
+
const log = logger('@wdio/utils');
|
|
4
|
+
export async function startWebDriver(options) {
|
|
5
|
+
/**
|
|
6
|
+
* if any of the connection parameter are set, don't start any driver
|
|
7
|
+
*/
|
|
8
|
+
if (definesRemoteDriver(options)) {
|
|
9
|
+
log.info(`Connecting to existing driver at ${options.protocol}://${options.hostname}:${options.port}${options.path}`);
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
if (globalThis.process) {
|
|
13
|
+
const { startWebDriver } = await import('./node/index.js');
|
|
14
|
+
return startWebDriver(options);
|
|
15
|
+
}
|
|
16
|
+
throw new Error('Please provide a valid `hostname` and `port` to start WebDriver sessions in the browser!');
|
|
17
|
+
}
|
package/build/utils.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { Services } from '@wdio/types';
|
|
1
|
+
import type { Options, Services } from '@wdio/types';
|
|
2
|
+
export declare function isAbsolute(p: string): boolean;
|
|
2
3
|
/**
|
|
3
4
|
* overwrite native element commands with user defined
|
|
4
5
|
* @param {object} propertiesObject propertiesObject
|
|
@@ -62,12 +63,6 @@ export declare function filterSpecArgs(args: any[]): any[];
|
|
|
62
63
|
* @return {boolean} `true` if the provided string is Base64
|
|
63
64
|
*/
|
|
64
65
|
export declare function isBase64(str: string): boolean;
|
|
65
|
-
/**
|
|
66
|
-
* Helper utility to check file access
|
|
67
|
-
* @param {string} file file to check access for
|
|
68
|
-
* @return true if file can be accessed
|
|
69
|
-
*/
|
|
70
|
-
export declare const canAccess: (file?: string) => boolean;
|
|
71
66
|
/**
|
|
72
67
|
* sleep
|
|
73
68
|
* @param {number=0} ms number in ms to sleep
|
|
@@ -80,4 +75,17 @@ export declare const sleep: (ms?: number) => Promise<unknown>;
|
|
|
80
75
|
* @returns {boolean} Returns true if the provided capabilities are related to Appium, false otherwise.
|
|
81
76
|
*/
|
|
82
77
|
export declare function isAppiumCapability(caps: WebdriverIO.Capabilities): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* helper method to determine if we need to setup a browser driver
|
|
80
|
+
* which is:
|
|
81
|
+
* - whenever the user has set connection options that differ
|
|
82
|
+
* from the default, or a port is set
|
|
83
|
+
* - whenever the user defines `user` and `key` which later will
|
|
84
|
+
* update the connection options
|
|
85
|
+
*/
|
|
86
|
+
export declare function definesRemoteDriver(options: Pick<Options.WebDriver, 'user' | 'key' | 'protocol' | 'hostname' | 'port' | 'path'>): boolean;
|
|
87
|
+
export declare function isChrome(browserName?: string): boolean;
|
|
88
|
+
export declare function isSafari(browserName?: string): boolean;
|
|
89
|
+
export declare function isFirefox(browserName?: string): boolean;
|
|
90
|
+
export declare function isEdge(browserName?: string): boolean;
|
|
83
91
|
//# 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":"AAAA,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"}
|
package/build/utils.js
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { pathToFileURL } from 'node:url';
|
|
4
|
-
import { resolve } from 'import-meta-resolve';
|
|
1
|
+
import { SUPPORTED_BROWSERNAMES, DEFAULT_PROTOCOL, DEFAULT_HOSTNAME, DEFAULT_PATH } from './constants.js';
|
|
5
2
|
const SCREENSHOT_REPLACEMENT = '"<Screenshot[base64]>"';
|
|
6
3
|
const SCRIPT_PLACEHOLDER = '"<Script[base64]>"';
|
|
7
4
|
const REGEX_SCRIPT_NAME = /return \((async )?function (\w+)/;
|
|
5
|
+
const SLASH = '/';
|
|
6
|
+
function assertPath(path) {
|
|
7
|
+
if (typeof path !== 'string') {
|
|
8
|
+
throw new TypeError('Path must be a string. Received ' + JSON.stringify(path));
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export function isAbsolute(p) {
|
|
12
|
+
assertPath(p);
|
|
13
|
+
return p.length > 0 && p.charCodeAt(0) === SLASH.codePointAt(0);
|
|
14
|
+
}
|
|
8
15
|
/**
|
|
9
16
|
* overwrite native element commands with user defined
|
|
10
17
|
* @param {object} propertiesObject propertiesObject
|
|
@@ -166,18 +173,24 @@ export async function safeImport(name) {
|
|
|
166
173
|
* then we also need to search in the project, we do that by defining
|
|
167
174
|
* 'localNodeModules' and searching from that also.
|
|
168
175
|
*
|
|
169
|
-
* Note that import-meta-resolve will resolve to CJS no ESM export is found
|
|
176
|
+
* Note that import-meta-resolve will resolve to CJS no ESM export is found.
|
|
177
|
+
* Only in Node.js environments
|
|
170
178
|
*/
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
importPath = await resolve(name, import.meta.url);
|
|
174
|
-
}
|
|
175
|
-
catch (err) {
|
|
179
|
+
if (!globalThis.window) {
|
|
180
|
+
const { resolve } = await import('import-meta-resolve');
|
|
176
181
|
try {
|
|
177
|
-
importPath = await resolve(name,
|
|
182
|
+
importPath = await resolve(name, import.meta.url);
|
|
178
183
|
}
|
|
179
184
|
catch (err) {
|
|
180
|
-
|
|
185
|
+
const { join } = await import('node:path');
|
|
186
|
+
const { pathToFileURL } = await import('node:url');
|
|
187
|
+
const localNodeModules = join(process.cwd(), 'node_modules');
|
|
188
|
+
try {
|
|
189
|
+
importPath = await resolve(name, pathToFileURL(localNodeModules).toString());
|
|
190
|
+
}
|
|
191
|
+
catch (err) {
|
|
192
|
+
return null;
|
|
193
|
+
}
|
|
181
194
|
}
|
|
182
195
|
}
|
|
183
196
|
}
|
|
@@ -244,23 +257,6 @@ export function isBase64(str) {
|
|
|
244
257
|
firstPaddingChar === len - 1 ||
|
|
245
258
|
(firstPaddingChar === len - 2 && str[len - 1] === '='));
|
|
246
259
|
}
|
|
247
|
-
/**
|
|
248
|
-
* Helper utility to check file access
|
|
249
|
-
* @param {string} file file to check access for
|
|
250
|
-
* @return true if file can be accessed
|
|
251
|
-
*/
|
|
252
|
-
export const canAccess = (file) => {
|
|
253
|
-
if (!file) {
|
|
254
|
-
return false;
|
|
255
|
-
}
|
|
256
|
-
try {
|
|
257
|
-
fs.accessSync(file);
|
|
258
|
-
return true;
|
|
259
|
-
}
|
|
260
|
-
catch (err) {
|
|
261
|
-
return false;
|
|
262
|
-
}
|
|
263
|
-
};
|
|
264
260
|
/**
|
|
265
261
|
* sleep
|
|
266
262
|
* @param {number=0} ms number in ms to sleep
|
|
@@ -277,3 +273,30 @@ export function isAppiumCapability(caps) {
|
|
|
277
273
|
// @ts-expect-error outdated jsonwp cap
|
|
278
274
|
(caps.automationName || caps['appium:automationName'] || caps.deviceName || caps.appiumVersion));
|
|
279
275
|
}
|
|
276
|
+
/**
|
|
277
|
+
* helper method to determine if we need to setup a browser driver
|
|
278
|
+
* which is:
|
|
279
|
+
* - whenever the user has set connection options that differ
|
|
280
|
+
* from the default, or a port is set
|
|
281
|
+
* - whenever the user defines `user` and `key` which later will
|
|
282
|
+
* update the connection options
|
|
283
|
+
*/
|
|
284
|
+
export function definesRemoteDriver(options) {
|
|
285
|
+
return Boolean((options.protocol && options.protocol !== DEFAULT_PROTOCOL) ||
|
|
286
|
+
(options.hostname && options.hostname !== DEFAULT_HOSTNAME) ||
|
|
287
|
+
Boolean(options.port) ||
|
|
288
|
+
(options.path && options.path !== DEFAULT_PATH) ||
|
|
289
|
+
Boolean(options.user && options.key));
|
|
290
|
+
}
|
|
291
|
+
export function isChrome(browserName) {
|
|
292
|
+
return Boolean(browserName && SUPPORTED_BROWSERNAMES.chrome.includes(browserName.toLowerCase()));
|
|
293
|
+
}
|
|
294
|
+
export function isSafari(browserName) {
|
|
295
|
+
return Boolean(browserName && SUPPORTED_BROWSERNAMES.safari.includes(browserName.toLowerCase()));
|
|
296
|
+
}
|
|
297
|
+
export function isFirefox(browserName) {
|
|
298
|
+
return Boolean(browserName && SUPPORTED_BROWSERNAMES.firefox.includes(browserName.toLowerCase()));
|
|
299
|
+
}
|
|
300
|
+
export function isEdge(browserName) {
|
|
301
|
+
return Boolean(browserName && SUPPORTED_BROWSERNAMES.edge.includes(browserName.toLowerCase()));
|
|
302
|
+
}
|
package/package.json
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/utils",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.20.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",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"type": "module",
|
|
9
|
-
"types": "./build/index.d.ts",
|
|
10
9
|
"exports": {
|
|
11
|
-
".":
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./build/index.js",
|
|
12
|
+
"types": "./build/index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"./node": {
|
|
15
|
+
"import": "./build/node/index.js",
|
|
16
|
+
"types": "./build/node/index.d.ts"
|
|
17
|
+
},
|
|
12
18
|
"./package.json": "./package.json"
|
|
13
19
|
},
|
|
20
|
+
"types": "./build/index.d.ts",
|
|
14
21
|
"typeScriptVersion": "3.8.3",
|
|
15
22
|
"engines": {
|
|
16
23
|
"node": "^16.13 || >=18"
|
|
@@ -32,7 +39,7 @@
|
|
|
32
39
|
"dependencies": {
|
|
33
40
|
"@puppeteer/browsers": "^1.6.0",
|
|
34
41
|
"@wdio/logger": "8.16.17",
|
|
35
|
-
"@wdio/types": "8.
|
|
42
|
+
"@wdio/types": "8.20.0",
|
|
36
43
|
"decamelize": "^6.0.0",
|
|
37
44
|
"deepmerge-ts": "^5.1.0",
|
|
38
45
|
"edgedriver": "^5.3.5",
|
|
@@ -48,5 +55,5 @@
|
|
|
48
55
|
"publishConfig": {
|
|
49
56
|
"access": "public"
|
|
50
57
|
},
|
|
51
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "6aa9e33233a6abc832bb16d2e24aaaa382e206b6"
|
|
52
59
|
}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","sourceRoot":"","sources":["../../src/driver/manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AA4GxD,wBAAsB,WAAW,CAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,kBAAkB,kCAezH;AAED,wBAAgB,YAAY,CAAE,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,cAAc,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,kBAAkB,kCAYpH"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
File without changes
|