From 02f5502e16fefc8d92392e614861e3f672c4f909 Mon Sep 17 00:00:00 2001 From: kumavis Date: Mon, 11 Jun 2018 11:04:28 -0700 Subject: test - e2e - inject metamask config to point at localhost --- test/e2e/metamask.spec.js | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'test') 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 = [ -- cgit v1.2.3