@wdio/utils
Advanced tools
Comparing version 9.0.0-alpha.115 to 9.0.0-alpha.321
@@ -7,3 +7,3 @@ import type { Capabilities } from '@wdio/types'; | ||
*/ | ||
export declare function isW3C(capabilities?: Capabilities.DesiredCapabilities): boolean; | ||
export declare function isW3C(capabilities?: WebdriverIO.Capabilities): boolean; | ||
/** | ||
@@ -31,4 +31,4 @@ * returns information about the environment before the session is created | ||
export declare function sessionEnvironmentDetector({ capabilities, requestedCapabilities }: { | ||
capabilities: Capabilities.RemoteCapability; | ||
requestedCapabilities: Capabilities.RemoteCapability; | ||
capabilities: WebdriverIO.Capabilities; | ||
requestedCapabilities: Capabilities.RequestedStandaloneCapabilities; | ||
}): { | ||
@@ -35,0 +35,0 @@ isW3C: boolean; |
@@ -26,8 +26,5 @@ import { SUPPORTED_BROWSERNAMES } from './constants.js'; | ||
*/ | ||
const isAppium = Boolean( | ||
// @ts-expect-error outdated jsonwp cap | ||
capabilities.automationName || | ||
capabilities['appium:automationName'] || | ||
capabilities.deviceName || | ||
capabilities.appiumVersion); | ||
const isAppium = Boolean(capabilities['appium:automationName'] || | ||
capabilities['appium:deviceName'] || | ||
capabilities['appium:appiumVersion']); | ||
const hasW3CCaps = Boolean( | ||
@@ -43,4 +40,3 @@ /** | ||
*/ | ||
(capabilities.platformVersion || | ||
capabilities['appium:platformVersion'] || | ||
(capabilities['appium:platformVersion'] || | ||
Object.prototype.hasOwnProperty.call(capabilities, 'setWindowRect'))); | ||
@@ -59,3 +55,3 @@ const hasWebdriverFlag = Boolean(capabilities['ms:experimental-webdriver']); | ||
} | ||
return Boolean(capabilities.chrome || capabilities['goog:chromeOptions']); | ||
return Boolean(capabilities['goog:chromeOptions'] && capabilities.browserName === 'chrome'); | ||
} | ||
@@ -136,3 +132,3 @@ /** | ||
return Boolean((capabilities.platformName && capabilities.platformName.match(/iOS/i)) || | ||
(capabilities.deviceName && capabilities.deviceName.match(/(iPad|iPhone)/i)) || | ||
(capabilities['appium:deviceName'] && capabilities['appium:deviceName'].match(/(iPad|iPhone)/i)) || | ||
(/iOS/i.test(bsOptions.platformName || '')) || | ||
@@ -165,8 +161,7 @@ (/(iPad|iPhone)/i.test(bsOptions.deviceName || ''))); | ||
} | ||
const caps = capabilities.alwaysMatch | ||
const caps = 'alwaysMatch' in capabilities | ||
? capabilities.alwaysMatch | ||
: capabilities; | ||
return Boolean(caps.extendedDebugging || | ||
(caps['sauce:options'] && | ||
caps['sauce:options'].extendedDebugging)); | ||
return Boolean(caps['sauce:options'] && | ||
caps['sauce:options'].extendedDebugging); | ||
} | ||
@@ -182,6 +177,3 @@ /** | ||
} | ||
const caps = capabilities.alwaysMatch | ||
? capabilities.alwaysMatch | ||
: capabilities; | ||
return Boolean(caps.webSocketUrl); | ||
return Boolean(capabilities.webSocketUrl); | ||
} | ||
@@ -201,2 +193,3 @@ /** | ||
*/ | ||
// @ts-expect-error outdated JSONWP capabilities | ||
Boolean(capabilities['webdriver.remote.sessionid']) || | ||
@@ -243,17 +236,14 @@ /** | ||
export function sessionEnvironmentDetector({ capabilities, requestedCapabilities }) { | ||
const cap = 'alwaysMatch' in capabilities | ||
? capabilities.alwaysMatch | ||
: capabilities; | ||
return { | ||
isW3C: isW3C(cap), | ||
isChrome: isChrome(cap), | ||
isFirefox: isFirefox(cap), | ||
isMobile: isMobile(cap), | ||
isIOS: isIOS(cap), | ||
isAndroid: isAndroid(cap), | ||
isW3C: isW3C(capabilities), | ||
isChrome: isChrome(capabilities), | ||
isFirefox: isFirefox(capabilities), | ||
isMobile: isMobile(capabilities), | ||
isIOS: isIOS(capabilities), | ||
isAndroid: isAndroid(capabilities), | ||
isSauce: isSauce(requestedCapabilities), | ||
isSeleniumStandalone: isSeleniumStandalone(cap), | ||
isSeleniumStandalone: isSeleniumStandalone(capabilities), | ||
isBidi: isBidi(capabilities), | ||
isChromium: isChromium(cap) | ||
isChromium: isChromium(capabilities) | ||
}; | ||
} |
@@ -1,2 +0,2 @@ | ||
import type { Capabilities, Services, Options } from '@wdio/types'; | ||
import type { Services, Options, Capabilities } from '@wdio/types'; | ||
/** | ||
@@ -10,3 +10,3 @@ * initialize service for launcher process | ||
*/ | ||
export declare function initializeLauncherService(config: Omit<Options.Testrunner, 'capabilities' | keyof Services.HookFunctions>, caps: Capabilities.DesiredCapabilities): Promise<{ | ||
export declare function initializeLauncherService(config: Omit<Options.Testrunner, 'capabilities' | keyof Services.HookFunctions>, caps: Capabilities.TestrunnerCapabilities): Promise<{ | ||
ignoredWorkerServices: string[]; | ||
@@ -23,3 +23,3 @@ launcherServices: Services.ServiceInstance[]; | ||
*/ | ||
export declare function initializeWorkerService(config: Options.Testrunner, caps: Capabilities.DesiredCapabilities, ignoredWorkerServices?: string[]): Promise<Services.ServiceInstance[]>; | ||
export declare function initializeWorkerService(config: Options.Testrunner, caps: WebdriverIO.Capabilities, ignoredWorkerServices?: string[]): Promise<Services.ServiceInstance[]>; | ||
//# sourceMappingURL=initializeServices.d.ts.map |
@@ -49,3 +49,3 @@ import logger from '@wdio/logger'; | ||
* ``` | ||
* services: ['@wdio/devtools-service'] | ||
* services: ['@wdio/lighthouse-service'] | ||
* ``` | ||
@@ -52,0 +52,0 @@ */ |
import type { Options, Capabilities } from '@wdio/types'; | ||
export declare function setupDriver(options: Omit<Options.WebDriver, 'capabilities'>, caps: Capabilities.RemoteCapabilities): Promise<unknown[] | undefined>; | ||
export declare function setupBrowser(options: Omit<Options.WebDriver, 'capabilities'>, caps: Capabilities.RemoteCapabilities): Promise<unknown[]> | undefined; | ||
export declare function setupDriver(options: Omit<Options.WebDriver, 'capabilities'>, caps: Capabilities.TestrunnerCapabilities): Promise<unknown[] | undefined>; | ||
export declare function setupBrowser(options: Omit<Options.WebDriver, 'capabilities'>, caps: Capabilities.TestrunnerCapabilities): Promise<unknown[]> | undefined; | ||
//# sourceMappingURL=manager.d.ts.map |
@@ -16,7 +16,9 @@ import logger from '@wdio/logger'; | ||
const multiremoteCaps = cap; | ||
const isMultiremote = Boolean(multiremoteCaps[Object.keys(cap)[0]].capabilities); | ||
if (isMultiremote) { | ||
return Object.values(multiremoteCaps).map((c) => c.capabilities); | ||
const multiremoteInstanceNames = Object.keys(multiremoteCaps); | ||
if (typeof multiremoteCaps[multiremoteInstanceNames[0]] === 'object' && 'capabilities' in multiremoteCaps[multiremoteInstanceNames[0]]) { | ||
return Object.values(multiremoteCaps).map((c) => ('alwaysMatch' in c.capabilities | ||
? c.capabilities.alwaysMatch | ||
: c.capabilities)); | ||
} | ||
else if (w3cCaps.alwaysMatch) { | ||
if (w3cCaps.alwaysMatch) { | ||
return w3cCaps.alwaysMatch; | ||
@@ -23,0 +25,0 @@ } |
@@ -7,3 +7,3 @@ /// <reference types="node" resolution-mode="require"/> | ||
import type { InstallOptions } from '@puppeteer/browsers'; | ||
import type { Options } from '@wdio/types'; | ||
import type { Capabilities } from '@wdio/types'; | ||
export type ChromedriverParameters = Partial<InstallOptions> & Omit<EdgedriverParameters, 'port' | 'edgeDriverVersion' | 'customEdgeDriverPath'>; | ||
@@ -22,3 +22,3 @@ declare global { | ||
} | ||
export declare function startWebDriver(options: Options.WebDriver): Promise<cp.ChildProcess | undefined>; | ||
export declare function startWebDriver(options: Capabilities.RemoteConfig): Promise<cp.ChildProcess | undefined>; | ||
//# sourceMappingURL=startWebDriver.d.ts.map |
import fs from 'node:fs'; | ||
import os from 'node:os'; | ||
import path from 'node:path'; | ||
@@ -49,5 +48,10 @@ import cp from 'node:child_process'; | ||
const chromedriverOptions = caps['wdio:chromedriverOptions'] || {}; | ||
/** | ||
* support for custom chromedriver path via environment variable like | ||
* other drivers do as well | ||
*/ | ||
const chromedriverBinary = chromedriverOptions.binary || process.env.CHROMEDRIVER_PATH; | ||
const { executablePath: chromeExecuteablePath, browserVersion } = await setupPuppeteerBrowser(cacheDir, caps); | ||
const { executablePath: chromedriverExcecuteablePath } = chromedriverOptions.binary | ||
? { executablePath: chromedriverOptions.binary } | ||
const { executablePath: chromedriverExcecuteablePath } = chromedriverBinary | ||
? { executablePath: chromedriverBinary } | ||
: await setupChromedriver(cacheDir, browserVersion); | ||
@@ -111,5 +115,6 @@ caps['goog:chromeOptions'] = deepmerge({ binary: chromeExecuteablePath }, caps['goog:chromeOptions'] || {}); | ||
*/ | ||
if (!caps['ms:edgeOptions']?.binary && os.platform() !== 'darwin' && os.platform() !== 'win32') { | ||
if (!caps['ms:edgeOptions']?.binary) { | ||
caps['ms:edgeOptions'] = caps['ms:edgeOptions'] || {}; | ||
caps['ms:edgeOptions'].binary = findEdgePath(); | ||
log.info(`Found Edge binary at ${caps['ms:edgeOptions'].binary}`); | ||
} | ||
@@ -116,0 +121,0 @@ } |
@@ -17,2 +17,3 @@ /// <reference types="@wdio/globals/types" /> | ||
const PROMISE_METHODS = ['then', 'catch', 'finally']; | ||
const ELEMENT_RETURN_COMMANDS = ['getElement', 'getElements']; | ||
const TIME_BUFFER = 3; | ||
@@ -207,2 +208,11 @@ export async function executeHooksWithArgs(hookName, hooks = [], args = []) { | ||
/** | ||
* Convenience methods to get the element promise. Technically we could just | ||
* await an `ChainablePromiseElement` directly but this causes bad DX when | ||
* chaining commands and e.g. VS Code tries to wrap promises around thenable | ||
* objects. | ||
*/ | ||
if (ELEMENT_RETURN_COMMANDS.includes(prop)) { | ||
return () => target; | ||
} | ||
/** | ||
* call a command on an element query, e.g.: | ||
@@ -209,0 +219,0 @@ * ```js |
/// <reference types="node" resolution-mode="require"/> | ||
import type { Options } from '@wdio/types'; | ||
export declare function startWebDriver(options: Options.WebDriver): Promise<import("child_process").ChildProcess | undefined>; | ||
import type { Capabilities } from '@wdio/types'; | ||
export declare function startWebDriver(options: Capabilities.RemoteConfig): Promise<import("child_process").ChildProcess | undefined>; | ||
//# sourceMappingURL=startWebDriver.d.ts.map |
{ | ||
"name": "@wdio/utils", | ||
"version": "9.0.0-alpha.115+8196c4ccb", | ||
"version": "9.0.0-alpha.321+63953a607", | ||
"description": "A WDIO helper utility to provide several utility functions used across the project.", | ||
@@ -41,7 +41,7 @@ "author": "Christian Bromann <mail@bromann.dev>", | ||
"@puppeteer/browsers": "^2.2.0", | ||
"@wdio/logger": "9.0.0-alpha.115+8196c4ccb", | ||
"@wdio/types": "9.0.0-alpha.115+8196c4ccb", | ||
"@wdio/logger": "9.0.0-alpha.321+63953a607", | ||
"@wdio/types": "9.0.0-alpha.321+63953a607", | ||
"decamelize": "^6.0.0", | ||
"deepmerge-ts": "^5.1.0", | ||
"edgedriver": "^5.3.10", | ||
"deepmerge-ts": "^7.0.3", | ||
"edgedriver": "^5.5.0", | ||
"geckodriver": "^4.3.3", | ||
@@ -58,3 +58,3 @@ "get-port": "^7.0.0", | ||
}, | ||
"gitHead": "8196c4ccb4f66e217e161804ef549f18b60dccb3" | ||
"gitHead": "63953a6079023cb390a113fe5ce1c1b01b8e4bb6" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
162772
3338
66
7
+ Addeddeepmerge-ts@7.1.3(transitive)
+ Addedstreamx@2.20.1(transitive)
- Removeddeepmerge-ts@5.1.0(transitive)
- Removedstreamx@2.20.2(transitive)
Updateddeepmerge-ts@^7.0.3
Updatededgedriver@^5.5.0