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

devtools

Package Overview
Dependencies
Maintainers
7
Versions
384
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

devtools - npm Package Compare versions

Comparing version 6.0.0-alpha.1 to 6.0.0-beta.0

build/commands/performActions.js

9

build/commands/status.js

@@ -16,6 +16,11 @@ "use strict";

const puppeteerFirefoxPath = require.resolve('puppeteer-firefox');
let puppeteerFirefoxPath;
let puppeteerFirefoxPkg;
const puppeteerFirefoxPkg = require(`${_path.default.dirname(puppeteerFirefoxPath)}/package.json`);
try {
puppeteerFirefoxPath = require.resolve('puppeteer-firefox');
} catch (error) {}
puppeteerFirefoxPkg = puppeteerFirefoxPath ? require(`${_path.default.dirname(puppeteerFirefoxPath)}/package.json`) : {};
async function status() {

@@ -22,0 +27,0 @@ return {

@@ -6,3 +6,3 @@ "use strict";

});
exports.ERROR_MESSAGES = exports.SERIALIZE_FLAG = exports.SERIALIZE_PROPERTY = exports.SUPPORTED_SELECTOR_STRATEGIES = exports.DEFAULT_SCRIPT_TIMEOUT = exports.DEFAULT_PAGELOAD_TIMEOUT = exports.DEFAULT_IMPLICIT_TIMEOUT = exports.DEFAULTS = exports.EDGE_NAMES = exports.FIREFOX_NAMES = exports.CHROME_NAMES = exports.DEFAULT_FLAGS = exports.ELEMENT_KEY = exports.DEFAULT_Y_POSITION = exports.DEFAULT_X_POSITION = exports.DEFAULT_HEIGHT = exports.DEFAULT_WIDTH = void 0;
exports.ERROR_MESSAGES = exports.SERIALIZE_FLAG = exports.SERIALIZE_PROPERTY = exports.SUPPORTED_SELECTOR_STRATEGIES = exports.DEFAULT_SCRIPT_TIMEOUT = exports.DEFAULT_PAGELOAD_TIMEOUT = exports.DEFAULT_IMPLICIT_TIMEOUT = exports.DEFAULTS = exports.SUPPORTED_BROWSER = exports.EDGE_NAMES = exports.FIREFOX_NAMES = exports.CHROME_NAMES = exports.DEFAULT_FLAGS = exports.ELEMENT_KEY = exports.DEFAULT_Y_POSITION = exports.DEFAULT_X_POSITION = exports.DEFAULT_HEIGHT = exports.DEFAULT_WIDTH = void 0;
const DEFAULT_WIDTH = 1200;

@@ -26,2 +26,4 @@ exports.DEFAULT_WIDTH = DEFAULT_WIDTH;

exports.EDGE_NAMES = EDGE_NAMES;
const SUPPORTED_BROWSER = [...CHROME_NAMES, ...FIREFOX_NAMES, ...EDGE_NAMES];
exports.SUPPORTED_BROWSER = SUPPORTED_BROWSER;
const DEFAULTS = {

@@ -28,0 +30,0 @@ capabilities: {

@@ -50,2 +50,3 @@ "use strict";

this.windows.set(pageId, page);
this.currentFrame = page;
this.currentWindowHandle = pageId;

@@ -117,3 +118,8 @@ }

});
log.info('RESULT', command.toLowerCase().includes('screenshot') && typeof result === 'string' && result.length > 64 ? `${result.substr(0, 61)}...` : result);
if (typeof result !== 'undefined') {
const isScreenshot = command.toLowerCase().includes('screenshot') && typeof result === 'string' && result.length > 64;
log.info('RESULT', isScreenshot ? `${result.substr(0, 61)}...` : result);
}
return result;

@@ -120,0 +126,0 @@ };

@@ -6,2 +6,8 @@ "use strict";

});
Object.defineProperty(exports, "SUPPORTED_BROWSER", {
enumerable: true,
get: function () {
return _constants.SUPPORTED_BROWSER;
}
});
exports.default = exports.sessionMap = void 0;

@@ -11,2 +17,4 @@

var _path = _interopRequireDefault(require("path"));
var _v = _interopRequireDefault(require("uuid/v4"));

@@ -36,2 +44,15 @@

const log = (0, _logger.default)('devtools:puppeteer');
const PREFIX = 'puppeteer:protocol';
const puppeteerDebugPkg = _path.default.resolve(_path.default.dirname(require.resolve('puppeteer-core')), 'node_modules', 'debug');
require(puppeteerDebugPkg).log = msg => {
if (msg.includes('puppeteer:protocol')) {
msg = msg.slice(msg.indexOf(PREFIX) + PREFIX.length).trim();
}
log.debug(msg);
};
const sessionMap = new Map();

@@ -38,0 +59,0 @@ exports.sessionMap = sessionMap;

@@ -14,2 +14,6 @@ "use strict";

var _edge = _interopRequireDefault(require("./finder/edge"));
var _firefox = _interopRequireDefault(require("./finder/firefox"));
var _utils = require("./utils");

@@ -21,2 +25,8 @@

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
const log = (0, _logger.default)('devtools');

@@ -27,3 +37,3 @@

const chromeFlags = [..._constants.DEFAULT_FLAGS, ...[`--window-position=${_constants.DEFAULT_X_POSITION},${_constants.DEFAULT_Y_POSITION}`, `--window-size=${_constants.DEFAULT_WIDTH},${_constants.DEFAULT_HEIGHT}`], ...(chromeOptions.headless ? ['--headless', '--no-sandbox'] : []), ...(chromeOptions.args || [])];
log.info(`Launch Chrome with flags: ${chromeFlags.join(' ')}`);
log.info(`Launch Google Chrome with flags: ${chromeFlags.join(' ')}`);
const chrome = await (0, _chromeLauncher.launch)({

@@ -34,6 +44,6 @@ chromePath: chromeOptions.binary,

log.info(`Connect Puppeteer with browser on port ${chrome.port}`);
const browser = await _puppeteerCore.default.connect({
const browser = await _puppeteerCore.default.connect(_objectSpread({}, chromeOptions, {
browserURL: `http://localhost:${chrome.port}`,
defaultViewport: null
});
}));
const pages = await (0, _utils.getPages)(browser);

@@ -50,18 +60,38 @@

function launchBrowser(capabilities, executablePath, vendorCapKey) {
const puppeteerOptions = Object.assign({
executablePath,
defaultViewport: {
width: _constants.DEFAULT_WIDTH,
height: _constants.DEFAULT_HEIGHT
}
}, capabilities[vendorCapKey] || {});
if (!executablePath) {
throw new Error('Couldn\'t find executeable for browser');
}
log.info(`Launch ${executablePath} with config: ${JSON.stringify(puppeteerOptions)}`);
return _puppeteerCore.default.launch(puppeteerOptions);
}
function launchFirefox(capabilities) {
const puppeteerFirefox = require('puppeteer-firefox');
const executablePath = _firefox.default[process.platform]()[0];
const firefoxOptions = capabilities['moz:firefoxOptions'] || {};
return puppeteerFirefox.launch({
args: firefoxOptions.args || [],
headless: Boolean(firefoxOptions.headless),
defaultViewport: {
width: firefoxOptions.width || _constants.DEFAULT_WIDTH,
height: firefoxOptions.height || _constants.DEFAULT_HEIGHT
}
const vendorPrefix = 'moz:firefoxOptions';
if (!capabilities[vendorPrefix]) {
capabilities[vendorPrefix] = {};
}
capabilities[vendorPrefix].product = 'firefox';
return launchBrowser(capabilities, executablePath, vendorPrefix, {
product: 'firefox'
});
}
function launchEdge() {
throw new Error('not yet implemented');
function launchEdge(capabilities) {
const executablePath = _edge.default[process.platform]()[0];
return launchBrowser(capabilities, executablePath, 'ms:edgeOptions');
}

@@ -68,0 +98,0 @@

@@ -14,4 +14,12 @@ "use strict";

exports.getPages = getPages;
exports.sort = sort;
exports.canAccess = canAccess;
exports.uniq = uniq;
exports.findByWhich = findByWhich;
exports.validate = void 0;
var _fs = _interopRequireDefault(require("fs"));
var _child_process = require("child_process");
var _logger = _interopRequireDefault(require("@wdio/logger"));

@@ -195,2 +203,51 @@

return pages;
}
function sort(installations, priorities) {
const defaultPriority = 10;
return installations.map(inst => {
for (const pair of priorities) {
if (pair.regex.test(inst)) {
return {
path: inst,
weight: pair.weight
};
}
}
return {
path: inst,
weight: defaultPriority
};
}).sort((a, b) => b.weight - a.weight).map(pair => pair.path);
}
function canAccess(file) {
try {
_fs.default.accessSync(file);
return true;
} catch (e) {
return false;
}
}
function uniq(arr) {
return Array.from(new Set(arr));
}
function findByWhich(executables, priorities) {
const installations = [];
executables.forEach(executable => {
try {
const browserPath = (0, _child_process.execFileSync)('which', [executable], {
stdio: 'pipe'
}).toString().split(/\r?\n/)[0];
if (canAccess(browserPath)) {
installations.push(browserPath);
}
} catch (e) {}
});
return sort(uniq(installations.filter(Boolean)), priorities);
}
{
"name": "devtools",
"version": "6.0.0-alpha.1",
"version": "6.0.0-beta.0",
"description": "A Chrome DevTools protocol binding that maps WebDriver commands into Chrome DevTools commands using Puppeteer",

@@ -33,16 +33,13 @@ "author": "Christian Bromann <christian@saucelabs.com>",

"dependencies": {
"@wdio/config": "6.0.0-alpha.1",
"@wdio/logger": "6.0.0-alpha.0",
"@wdio/protocols": "6.0.0-alpha.1",
"@wdio/utils": "6.0.0-alpha.1",
"@wdio/config": "6.0.0-beta.0",
"@wdio/logger": "6.0.0-beta.0",
"@wdio/protocols": "6.0.0-beta.0",
"@wdio/utils": "6.0.0-beta.0",
"chrome-launcher": "^0.11.1",
"puppeteer-core": "^1.18.1"
"puppeteer-core": "^2.1.1"
},
"devDependencies": {
"@types/puppeteer": "^1.19.0"
"@types/puppeteer": "^2.0.0"
},
"optionalDependencies": {
"puppeteer-firefox": "^0.5.0"
},
"gitHead": "1b11d192fa30cd92724a21e3febbf40b9e5b3ba2"
"gitHead": "478c5546246ce47c8344d29a4d36d067ab3a6983"
}
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