diff options
author | kumavis <aaron@kumavis.me> | 2018-06-12 05:25:49 +0800 |
---|---|---|
committer | kumavis <aaron@kumavis.me> | 2018-06-12 05:25:49 +0800 |
commit | ebb9447593a877cd299e701ddfcb217070068fac (patch) | |
tree | 74380d5656a8ff3d36aa47ae27d4c69b225f76ff /test/e2e/beta/metamask-beta-ui.spec.js | |
parent | 02f5502e16fefc8d92392e614861e3f672c4f909 (diff) | |
download | tangerine-wallet-browser-ebb9447593a877cd299e701ddfcb217070068fac.tar.gz tangerine-wallet-browser-ebb9447593a877cd299e701ddfcb217070068fac.tar.zst tangerine-wallet-browser-ebb9447593a877cd299e701ddfcb217070068fac.zip |
test - e2e - factor out setup phase + rename METAMASK_CONFIG to METAMASK_TEST_CONFIG
Diffstat (limited to 'test/e2e/beta/metamask-beta-ui.spec.js')
-rw-r--r-- | test/e2e/beta/metamask-beta-ui.spec.js | 32 |
1 files changed, 9 insertions, 23 deletions
diff --git a/test/e2e/beta/metamask-beta-ui.spec.js b/test/e2e/beta/metamask-beta-ui.spec.js index ceeea31a5..8960e7e79 100644 --- a/test/e2e/beta/metamask-beta-ui.spec.js +++ b/test/e2e/beta/metamask-beta-ui.spec.js @@ -4,11 +4,8 @@ const webdriver = require('selenium-webdriver') const { By, Key, until } = webdriver const { delay, - buildChromeWebDriver, - buildFirefoxWebdriver, - installWebExt, - getExtensionIdChrome, - getExtensionIdFirefox, + createModifiedTestBuild, + setupBrowserAndExtension, } = require('../func') const { findElement, @@ -19,6 +16,7 @@ const { } = require('./helpers') describe('MetaMask', function () { + const browser = process.env.SELENIUM_BROWSER let extensionId let driver let tokenAddress @@ -33,27 +31,15 @@ describe('MetaMask', function () { this.bail(true) before(async function () { - switch (process.env.SELENIUM_BROWSER) { - case 'chrome': { - const extPath = path.resolve('dist/chrome') - driver = buildChromeWebDriver(extPath) - extensionId = await getExtensionIdChrome(driver) - await driver.get(`chrome-extension://${extensionId}/popup.html`) - break - } - case 'firefox': { - const extPath = path.resolve('dist/firefox') - driver = buildFirefoxWebdriver() - await installWebExt(driver, extPath) - await delay(700) - extensionId = await getExtensionIdFirefox(driver) - await driver.get(`moz-extension://${extensionId}/popup.html`) - } - } + const srcPath = path.resolve(`dist/${browser}`) + const { extPath } = await createModifiedTestBuild({ browser, srcPath }) + const installResult = await setupBrowserAndExtension({ browser, extPath }) + driver = installResult.driver + extensionUri = installResult.extensionUri }) afterEach(async function () { - if (process.env.SELENIUM_BROWSER === 'chrome') { + if (browser === 'chrome') { const errors = await checkBrowserForConsoleErrors(driver) if (errors.length) { const errorReports = errors.map(err => err.message) |