1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-23 02:10:12 +01:00
metamask-extension/test/e2e/webdriver/index.js
Pedro Figueiredo bfbe10ba28
e2e test for action metrics (#18347)
* e2e test for action metrics

* add tests to implementing sw restart delay tracking

* wip

* wip

* wip

* wip

* remove unneeded code

* remove scuttling changes contemplated in #18989
2023-05-04 10:38:09 +04:00

39 lines
970 B
JavaScript

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