From a8259f7f6a26fe5ae21b26b2a5c05dfdb09e32bd Mon Sep 17 00:00:00 2001 From: Dan Miller Date: Mon, 5 Nov 2018 13:20:06 -0330 Subject: Update e2e tests for new gas customization modal. --- test/e2e/beta/from-import-beta-ui.spec.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'test/e2e/beta/from-import-beta-ui.spec.js') diff --git a/test/e2e/beta/from-import-beta-ui.spec.js b/test/e2e/beta/from-import-beta-ui.spec.js index a180689e5..aa951a243 100644 --- a/test/e2e/beta/from-import-beta-ui.spec.js +++ b/test/e2e/beta/from-import-beta-ui.spec.js @@ -17,6 +17,7 @@ const { findElement, findElements, } = require('./helpers') +const fetchMockResponses = require('./fetch-mocks.js') describe('Using MetaMask with an existing account', function () { @@ -62,6 +63,18 @@ describe('Using MetaMask with an existing account', function () { await driver.get(extensionUrl) }) + beforeEach(async function () { + await driver.executeScript( + 'window.fetch = ' + + '(...args) => { ' + + 'if (args[0] === "https://ethgasstation.info/json/ethgasAPI.json") { return ' + + 'Promise.resolve({ json: () => Promise.resolve(JSON.parse(\'' + fetchMockResponses.ethGasBasic + '\')) }); } else if ' + + '(args[0] === "https://ethgasstation.info/json/predictTable.json") { return ' + + 'Promise.resolve({ json: () => Promise.resolve(JSON.parse(\'' + fetchMockResponses.ethGasPredictTable + '\')) }); } ' + + 'return window.fetch(...args); }' + ) + }) + afterEach(async function () { if (process.env.SELENIUM_BROWSER === 'chrome') { const errors = await checkBrowserForConsoleErrors(driver) @@ -230,7 +243,7 @@ describe('Using MetaMask with an existing account', function () { }) describe('Send ETH from inside MetaMask', () => { - it('starts to send a transaction', async function () { + it('starts a send transaction', async function () { const sendButton = await findElement(driver, By.xpath(`//button[contains(text(), 'Send')]`)) await sendButton.click() await delay(regularDelayMs) @@ -241,7 +254,7 @@ describe('Using MetaMask with an existing account', function () { await inputAmount.sendKeys('1') // Set the gas limit - const configureGas = await findElement(driver, By.css('.send-v2__gas-fee-display button')) + const configureGas = await findElement(driver, By.css('.advanced-gas-options-btn')) await configureGas.click() await delay(regularDelayMs) -- cgit