aboutsummaryrefslogtreecommitdiffstats
path: root/test/e2e/metamask.spec.js
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-06-12 05:25:49 +0800
committerkumavis <aaron@kumavis.me>2018-06-12 05:25:49 +0800
commitebb9447593a877cd299e701ddfcb217070068fac (patch)
tree74380d5656a8ff3d36aa47ae27d4c69b225f76ff /test/e2e/metamask.spec.js
parent02f5502e16fefc8d92392e614861e3f672c4f909 (diff)
downloadtangerine-wallet-browser-ebb9447593a877cd299e701ddfcb217070068fac.tar
tangerine-wallet-browser-ebb9447593a877cd299e701ddfcb217070068fac.tar.gz
tangerine-wallet-browser-ebb9447593a877cd299e701ddfcb217070068fac.tar.bz2
tangerine-wallet-browser-ebb9447593a877cd299e701ddfcb217070068fac.tar.lz
tangerine-wallet-browser-ebb9447593a877cd299e701ddfcb217070068fac.tar.xz
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/metamask.spec.js')
-rw-r--r--test/e2e/metamask.spec.js29
1 files changed, 6 insertions, 23 deletions
diff --git a/test/e2e/metamask.spec.js b/test/e2e/metamask.spec.js
index 06c13b3d0..0d6ab9b35 100644
--- a/test/e2e/metamask.spec.js
+++ b/test/e2e/metamask.spec.js
@@ -3,10 +3,8 @@ const mkdirp = require('mkdirp')
const path = require('path')
const assert = require('assert')
const pify = require('pify')
-const prependFile = pify(require('prepend-file'))
-const webdriver = require('selenium-webdriver')
-const { By, Key } = webdriver
-const { delay, buildChromeWebDriver, buildFirefoxWebdriver, installWebExt, getExtensionIdChrome, getExtensionIdFirefox } = require('./func')
+const { By, Key } = require('selenium-webdriver')
+const { delay, createModifiedTestBuild, setupBrowserAndExtension } = require('./func')
describe('Metamask popup page', function () {
const browser = process.env.SELENIUM_BROWSER
@@ -16,25 +14,11 @@ describe('Metamask popup page', function () {
before(async function () {
const srcPath = path.resolve(`dist/${browser}`)
- const extPath = path.resolve(`test-builds/${browser}`)
- await fs.ensureDir(extPath)
- await fs.copy(srcPath, extPath)
- const config = { NetworkController: { provider: { type: 'localhost' } } }
- await prependFile(`${extPath}/background.js`, `window.METAMASK_CONFIG=${JSON.stringify(config)};\n`)
+ const { extPath } = await createModifiedTestBuild({ browser, srcPath })
+ const installResult = await setupBrowserAndExtension({ browser, extPath })
+ driver = installResult.driver
+ extensionUri = installResult.extensionUri
- if (browser === 'chrome') {
- driver = buildChromeWebDriver(extPath)
- extensionId = await getExtensionIdChrome(driver)
- extensionUri = `chrome-extension://${extensionId}/popup.html`
- } else if (browser === 'firefox') {
- driver = buildFirefoxWebdriver()
- await installWebExt(driver, extPath)
- await delay(700)
- extensionId = await getExtensionIdFirefox(driver)
- extensionUri = `moz-extension://${extensionId}/popup.html`
- } else {
- throw new Error(`Unknown Browser "${browser}"`)
- }
await driver.get(extensionUri)
})
@@ -53,7 +37,6 @@ describe('Metamask popup page', function () {
// gather extra data if test failed
if (this.currentTest.state === 'failed') {
await verboseReportOnFailure(this.currentTest)
- await delay(1000000)
}
})