From 49f8052b157374370ac71373708933c6e639944e Mon Sep 17 00:00:00 2001 From: Danica Shen Date: Tue, 30 May 2023 14:48:43 +0100 Subject: [PATCH] feature(17901): fix failing network error and remove duplicated e2e for mv3 (#19292) * feature(17901): fix failing network error e2e for mv3 * feature(17901): remove dapp interaction for duplication --------- Co-authored-by: legobeat <109787230+legobeat@users.noreply.github.com> --- test/e2e/mv3/dapp-interactions.spec.js | 72 -------------------------- test/e2e/tests/network-error.spec.js | 9 +++- 2 files changed, 8 insertions(+), 73 deletions(-) delete mode 100644 test/e2e/mv3/dapp-interactions.spec.js diff --git a/test/e2e/mv3/dapp-interactions.spec.js b/test/e2e/mv3/dapp-interactions.spec.js deleted file mode 100644 index 96dee4d8a..000000000 --- a/test/e2e/mv3/dapp-interactions.spec.js +++ /dev/null @@ -1,72 +0,0 @@ -const { strict: assert } = require('assert'); -const { - convertToHexValue, - withFixtures, - openDapp, - SERVICE_WORKER_URL, -} = require('../helpers'); -const FixtureBuilder = require('../fixture-builder'); - -describe('MV3 - Dapp interactions', function () { - let windowHandles; - const ganacheOptions = { - accounts: [ - { - secretKey: - '0x7C9529A67102755B7E6102D6D950AC5D5863C98713805CEC576B945B15B71EAC', - balance: convertToHexValue(25000000000000000000), - }, - ], - concurrent: { port: 8546, chainId: 1338 }, - }; - it('should continue to support dapp interactions after service worker re-start', async function () { - await withFixtures( - { - dapp: true, - fixtures: new FixtureBuilder() - .withPermissionControllerConnectedToTestDapp() - .build(), - ganacheOptions: { - ...ganacheOptions, - }, - title: this.test.title, - }, - async ({ driver }) => { - await driver.navigate(); - await driver.fill('#password', 'correct horse battery staple'); - await driver.press('#password', driver.Key.ENTER); - - await openDapp(driver); - - // Terminate Service Worker - await driver.openNewPage(SERVICE_WORKER_URL); - await driver.clickElement({ - text: 'Service workers', - tag: 'button', - }); - - await driver.clickElement({ - text: 'terminate', - tag: 'span', - }); - - // Trigger Notification - windowHandles = await driver.getAllWindowHandles(); - await driver.switchToWindowWithTitle('E2E Test Dapp', windowHandles); - await driver.clickElement('#addEthereumChain'); - await driver.waitUntilXWindowHandles(4); - await driver.switchToWindowWithTitle( - 'MetaMask Notification', - windowHandles, - ); - - const notification = await driver.isElementPresent({ - text: 'Allow this site to add a network?', - tag: 'h3', - }); - - assert.ok(notification, 'Dapp action does not appear in Metamask'); - }, - ); - }); -}); diff --git a/test/e2e/tests/network-error.spec.js b/test/e2e/tests/network-error.spec.js index 778d32b35..31c47752b 100644 --- a/test/e2e/tests/network-error.spec.js +++ b/test/e2e/tests/network-error.spec.js @@ -1,5 +1,9 @@ const { strict: assert } = require('assert'); -const { convertToHexValue, withFixtures } = require('../helpers'); +const { + convertToHexValue, + withFixtures, + regularDelayMs, +} = require('../helpers'); const FixtureBuilder = require('../fixture-builder'); describe('Gas API fallback', function () { @@ -79,6 +83,9 @@ describe('Gas API fallback', function () { await driver.clickElement({ text: 'Next', tag: 'button' }); + await driver.delay(regularDelayMs); + await driver.findElement('.transaction-alerts'); + const error = await driver.isElementPresent({ text: 'Network is busy. Gas prices are high and estimates are less accurate.', });