1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-26 20:39:08 +01:00
metamask-extension/test/e2e/webdriver/index.js
PeterYinusa 9ae909d6a7
[E2E] Install Firefox extension from dist folder (#15255)
* update webdriver

* install extension from dist folder

* remove redundant code
2022-07-18 09:22:23 +01:00

39 lines
934 B
JavaScript

const { Browser } = require('selenium-webdriver');
const Driver = require('./driver');
const ChromeDriver = require('./chrome');
const FirefoxDriver = require('./firefox');
async function buildWebDriver({ responsive, port } = {}) {
const browser = process.env.SELENIUM_BROWSER;
const {
driver: seleniumDriver,
extensionId,
extensionUrl,
} = await buildBrowserWebDriver(browser, { responsive, port });
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,
};