Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@wdio/firefox-profile-service

Package Overview
Dependencies
Maintainers
3
Versions
225
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wdio/firefox-profile-service - npm Package Compare versions

Comparing version 9.0.0-alpha.426 to 9.0.0

82

build/index.js

@@ -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
};

12

package.json
{
"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"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc