A Metamask fork with Infura removed and default networks editable
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ciphermask/test/e2e/webdriver/index.js

39 lines
946 B

const { Browser } = require('selenium-webdriver');
const Driver = require('./driver');
const ChromeDriver = require('./chrome');
const FirefoxDriver = require('./firefox');
async function buildWebDriver({ responsive, port, type } = {}) {
const browser = process.env.SELENIUM_BROWSER;
const {
driver: seleniumDriver,
extensionId,
extensionUrl,
} = await buildBrowserWebDriver(browser, { responsive, port, type });
const driver = new Driver(seleniumDriver, browser, extensionUrl);
return {
driver,
extensionId,
};
}
async function buildBrowserWebDriver(browser, webDriverOptions) {
switch (browser) {
case Browser.CHROME: {
return await ChromeDriver.build(webDriverOptions);
}
case Browser.FIREFOX: {
return await FirefoxDriver.build(webDriverOptions);
}
default: {
throw new Error(`Unrecognized browser: ${browser}`);
}
}
}
module.exports = {
buildWebDriver,
};