1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-30 08:09:15 +01:00
metamask-extension/test/e2e/webdriver/index.js
seaona 8eb8fc1591
Remove unused function (#14423)
* Remove unused function

* Removed fetch mocks file as it's no longer used
2022-04-12 18:33:16 +02:00

39 lines
946 B
JavaScript

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