New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@awsui/browser-test-tools

Package Overview
Dependencies
Maintainers
3
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@awsui/browser-test-tools - npm Package Compare versions

Comparing version 3.0.60 to 3.0.61

browser-scripts/events-spy.d.ts

3

browser.d.ts

@@ -1,1 +0,2 @@

export * from './dist/browser';export { default } from './dist/browser';
import * as browsers from './browsers';
export default function getBrowserCreator(browserName: string | undefined, seleniumType: string, options: Record<string, any>): browsers.browserstack | browsers.devicefarm | browsers.devicefarmMobile | browsers.local;

@@ -1,1 +0,40 @@

module.exports = require('./dist/browser');
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
const browsers = __importStar(require("./browsers"));
const exceptions_1 = require("./exceptions");
function hasType(value) {
return value in browsers;
}
function getBrowserCreator(browserName = 'ChromeHeadless', seleniumType, options) {
if (!hasType(seleniumType)) {
throw new exceptions_1.FatalError('Incorrect selenium provider: ' + seleniumType);
}
const Creator = browsers[seleniumType];
return new Creator(browserName, options);
}
exports.default = getBrowserCreator;

@@ -1,1 +0,2 @@

export * from './dist/chrome-launcher';export { default } from './dist/chrome-launcher';
export declare function shutdownWebdriver(): void;
export declare function startWebdriver(port?: string): Promise<void>;

@@ -1,1 +0,52 @@

module.exports = require('./dist/chrome-launcher');
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.startWebdriver = exports.shutdownWebdriver = void 0;
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
const child_process_1 = require("child_process");
const exceptions_1 = require("./exceptions");
const readline_1 = __importDefault(require("readline"));
function spawnChromeDriver(port) {
const params = [`--port=${port}`, '--log-level=SEVERE', '--path=/'];
try {
(0, child_process_1.execSync)('hash chromedriver');
}
catch {
throw new exceptions_1.FatalError("Cannot find local chromedriver. Did you run 'npm i -g chromedriver'?");
}
return (0, child_process_1.spawn)('chromedriver', params);
}
let webdriverProcess;
function shutdownWebdriver() {
if (webdriverProcess) {
webdriverProcess.kill();
webdriverProcess = undefined;
}
}
exports.shutdownWebdriver = shutdownWebdriver;
function startWebdriver(port = '9515') {
return new Promise((resolve, reject) => {
webdriverProcess = spawnChromeDriver(port);
webdriverProcess.on('error', error => {
shutdownWebdriver();
reject(error);
});
webdriverProcess.on('exit', () => {
shutdownWebdriver();
reject(new Error('Webdriver process exited too early'));
});
webdriverProcess.stdout.once('data', () => resolve());
const errorReader = readline_1.default.createInterface({ input: webdriverProcess.stderr });
errorReader.on('line', (line) => {
// chromeDriver spams to the error stream on macOS
// https://bugs.chromium.org/p/chromedriver/issues/detail?id=2909
if (line.indexOf('Please call TIS/TSM in main thread!!!') === -1) {
console.error(line);
}
});
});
}
exports.startWebdriver = startWebdriver;
{
"commit": "6a3d3f52021c260a08dd7f89691062f97bf477ff"
"commit": "16582ae9ea0ecd9b4b2e3583c74c1c069b36d8a0"
}

@@ -16,13 +16,7 @@ {

"./chrome-launcher": "./chrome-launcher.js",
"./image-utils": "./image-utils.js",
"./page-objects": "./page-objects.js",
"./image-utils": "./image-utils/index.js",
"./page-objects": "./page-objects/index.js",
"./use-browser": "./use-browser.js",
"./browser": "./browser.js"
},
"files": [
"dist",
"*.js",
"*.d.ts",
"internal"
],
"homepage": "https://github.com/aws/awsui-documentation",

@@ -60,5 +54,5 @@ "jest": {

"name": "@awsui/browser-test-tools",
"version": "3.0.60",
"version": "3.0.61",
"license": "Apache-2.0",
"scripts": {}
}

@@ -1,1 +0,16 @@

export * from './dist/use-browser';export { default } from './dist/use-browser';
/// <reference types="webdriverio/async" />
import { WebDriverOptions } from './browsers/browser-creator';
type BrowserOptions = {
browserName: string;
seleniumType: string;
browserCreatorOptions: Record<string, any>;
webdriverOptions: Partial<WebDriverOptions>;
skipConsoleErrorsCheck: boolean;
};
interface TestFunction {
(browser: WebdriverIO.Browser): Promise<void> | void;
}
declare function useBrowser(optionsOverride: Partial<WebDriverOptions>, testFn: TestFunction): () => Promise<void>;
declare function useBrowser(testFn: TestFunction): () => Promise<void>;
export default useBrowser;
export declare function configure(newOptions: Partial<BrowserOptions>): void;

@@ -1,1 +0,50 @@

module.exports = require('./dist/use-browser');
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.configure = void 0;
const browser_1 = __importDefault(require("./browser"));
const merge_1 = __importDefault(require("lodash/merge"));
const options = {
browserName: 'ChromeHeadless',
seleniumType: 'local',
browserCreatorOptions: {},
webdriverOptions: {},
skipConsoleErrorsCheck: false,
};
function useBrowser(...args) {
// How to do type-safe function overloads: https://stackoverflow.com/questions/55852612/typescript-overloads-optional-arguments-and-type-inference
const optionsOverride = args.length === 1 ? {} : args[0];
const testFn = args.length === 1 ? args[0] : args[1];
return async () => {
const creator = (0, browser_1.default)(options.browserName, options.seleniumType, options.browserCreatorOptions);
const browser = await creator.getBrowser({ ...options.webdriverOptions, ...optionsOverride });
try {
if ('getLogs' in browser) {
// dispose logs from previous sessions, if there are any
await browser.getLogs('browser');
}
await testFn(browser);
// This method does not exist in w3c protocol
if (!options.skipConsoleErrorsCheck && 'getLogs' in browser) {
const logs = (await browser.getLogs('browser'));
const errors = logs.filter(entry => entry.level === 'SEVERE');
if (errors.length > 0) {
throw new Error('Unexpected errors in browser console:\n' + JSON.stringify(errors, null, 2));
}
}
else if (!options.skipConsoleErrorsCheck) {
console.warn('Unable to check browser console, webdriver does not support this feature');
}
}
finally {
await browser.deleteSession();
}
};
}
exports.default = useBrowser;
function configure(newOptions) {
(0, merge_1.default)(options, newOptions);
}
exports.configure = configure;
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