@wdio/firefox-profile-service
Advanced tools
Comparing version 9.0.0-alpha.426 to 9.0.0
@@ -1,4 +0,78 @@ | ||
/* istanbul ignore file */ | ||
import FirefoxProfileLauncher from './launcher.js'; | ||
export const launcher = FirefoxProfileLauncher; | ||
export * from './types.js'; | ||
// src/launcher.ts | ||
import Profile from "firefox-profile"; | ||
import { promisify } from "node:util"; | ||
var FirefoxProfileLauncher = class { | ||
constructor(_options) { | ||
this._options = _options; | ||
} | ||
_profile; | ||
async onPrepare(config, capabilities) { | ||
if (Object.keys(this._options).length === 0) { | ||
return; | ||
} | ||
this._profile = this._options.profileDirectory ? await promisify(Profile.copy)(this._options.profileDirectory) : new Profile(); | ||
if (!this._profile) { | ||
return; | ||
} | ||
this._setPreferences(); | ||
if (!Array.isArray(this._options.extensions)) { | ||
return this._buildExtension(capabilities); | ||
} | ||
await promisify(this._profile.addExtensions.bind(this._profile))(this._options.extensions); | ||
return this._buildExtension(capabilities); | ||
} | ||
/** | ||
* Sets any preferences and proxy | ||
*/ | ||
_setPreferences() { | ||
if (!this._profile) { | ||
return; | ||
} | ||
for (const [preference, value] of Object.entries(this._options)) { | ||
if (["extensions", "proxy", "legacy", "profileDirectory"].includes(preference)) { | ||
continue; | ||
} | ||
this._profile.setPreference(preference, value); | ||
} | ||
if (this._options.proxy) { | ||
this._profile.setProxy(this._options.proxy); | ||
} | ||
this._profile.updatePreferences(); | ||
} | ||
async _buildExtension(capabilities) { | ||
if (!this._profile) { | ||
return; | ||
} | ||
const zippedProfile = await promisify(this._profile.encoded.bind(this._profile))(); | ||
if (Array.isArray(capabilities)) { | ||
capabilities.flatMap((c) => { | ||
if (Object.values(c).length > 0 && Object.values(c).every((c2) => typeof c2 === "object" && c2.capabilities)) { | ||
return Object.values(c).map((o) => o.capabilities); | ||
} | ||
return c; | ||
}).filter((capability) => capability.browserName === "firefox").forEach((capability) => { | ||
this._setProfile(capability, zippedProfile); | ||
}); | ||
return; | ||
} | ||
for (const browser in capabilities) { | ||
const capability = capabilities[browser].capabilities; | ||
const cap = capability && ("alwaysMatch" in capability ? capability.alwaysMatch : capability); | ||
if (!capability || cap.browserName !== "firefox") { | ||
continue; | ||
} | ||
this._setProfile(capability, zippedProfile); | ||
} | ||
} | ||
_setProfile(capability, zippedProfile) { | ||
const cap = "alwaysMatch" in capability ? capability.alwaysMatch : capability; | ||
cap["moz:firefoxOptions"] = cap["moz:firefoxOptions"] || {}; | ||
cap["moz:firefoxOptions"].profile = zippedProfile; | ||
} | ||
}; | ||
// src/index.ts | ||
var launcher = FirefoxProfileLauncher; | ||
export { | ||
launcher | ||
}; |
{ | ||
"name": "@wdio/firefox-profile-service", | ||
"version": "9.0.0-alpha.426+d760644c4", | ||
"version": "9.0.0", | ||
"description": "WebdriverIO service that lets you define your Firefox profile in your wdio.conf.js", | ||
@@ -34,8 +34,10 @@ "author": "Christian Bromann <mail@bromann.dev>", | ||
"exports": { | ||
".": "./build/index.js", | ||
"./package.json": "./package.json" | ||
".": { | ||
"import": "./build/index.js", | ||
"types": "./build/index.d.ts" | ||
} | ||
}, | ||
"typeScriptVersion": "3.8.3", | ||
"dependencies": { | ||
"@wdio/types": "9.0.0-alpha.426+d760644c4", | ||
"@wdio/types": "9.0.0", | ||
"firefox-profile": "^4.5.0" | ||
@@ -46,3 +48,3 @@ }, | ||
}, | ||
"gitHead": "d760644c4c6e1ef910c0bee120cb422e25dbbe06" | ||
"gitHead": "957693463371a4cb329395dcdbce8fb0c930ab93" | ||
} |
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
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
0
15518
10
202
+ Added@types/node@20.17.7(transitive)
+ Added@wdio/types@9.0.0(transitive)
+ Addedundici-types@6.19.8(transitive)
Updated@wdio/types@9.0.0