aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-06-12 02:04:28 +0800
committerkumavis <aaron@kumavis.me>2018-06-12 02:04:28 +0800
commit02f5502e16fefc8d92392e614861e3f672c4f909 (patch)
treee23fe7247e3581a6221b3b28ae6674067b9d03db /test
parent0db776c3cc58e817d108d38ca389893cb13e3f92 (diff)
downloadtangerine-wallet-browser-02f5502e16fefc8d92392e614861e3f672c4f909.tar
tangerine-wallet-browser-02f5502e16fefc8d92392e614861e3f672c4f909.tar.gz
tangerine-wallet-browser-02f5502e16fefc8d92392e614861e3f672c4f909.tar.bz2
tangerine-wallet-browser-02f5502e16fefc8d92392e614861e3f672c4f909.tar.lz
tangerine-wallet-browser-02f5502e16fefc8d92392e614861e3f672c4f909.tar.xz
tangerine-wallet-browser-02f5502e16fefc8d92392e614861e3f672c4f909.tar.zst
tangerine-wallet-browser-02f5502e16fefc8d92392e614861e3f672c4f909.zip
test - e2e - inject metamask config to point at localhost
Diffstat (limited to 'test')
-rw-r--r--test/e2e/metamask.spec.js21
1 files changed, 10 insertions, 11 deletions
diff --git a/test/e2e/metamask.spec.js b/test/e2e/metamask.spec.js
index f993f3fca..06c13b3d0 100644
--- a/test/e2e/metamask.spec.js
+++ b/test/e2e/metamask.spec.js
@@ -1,8 +1,9 @@
-const fs = require('fs')
+const fs = require('fs-extra')
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')
@@ -14,7 +15,13 @@ describe('Metamask popup page', function () {
this.timeout(0)
before(async function () {
- const extPath = path.resolve(`dist/${browser}`)
+ 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`)
+
if (browser === 'chrome') {
driver = buildChromeWebDriver(extPath)
extensionId = await getExtensionIdChrome(driver)
@@ -46,6 +53,7 @@ describe('Metamask popup page', function () {
// gather extra data if test failed
if (this.currentTest.state === 'failed') {
await verboseReportOnFailure(this.currentTest)
+ await delay(1000000)
}
})
@@ -61,11 +69,6 @@ describe('Metamask popup page', function () {
await driver.switchTo().window(windowHandles[0])
})
- it('sets provider type to localhost', async function () {
- await delay(300)
- await setProviderType('localhost')
- })
-
})
describe('Account Creation', () => {
@@ -313,10 +316,6 @@ describe('Metamask popup page', function () {
})
})
- async function setProviderType (type) {
- await driver.executeScript('window.metamask.setProviderType(arguments[0])', type)
- }
-
async function checkBrowserForConsoleErrors() {
const ignoredLogTypes = ['WARNING']
const ignoredErrorMessages = [