diff --git a/test/e2e/fixture-builder.js b/test/e2e/fixture-builder.js index 283ed7678edf..f5873fb4cd6a 100644 --- a/test/e2e/fixture-builder.js +++ b/test/e2e/fixture-builder.js @@ -530,6 +530,12 @@ class FixtureBuilder { }); } + withPreferencesControllerTxSimulationsDisabled() { + return this.withPreferencesController({ + useTransactionSimulations: false, + }); + } + withAccountsController(data) { merge(this.fixture.data.AccountsController, data); return this; @@ -814,8 +820,28 @@ class FixtureBuilder { timestamp: 1631545992244, value: false, }, + { + op: 'add', + path: '/simulationData', + value: { + error: { + code: 'disabled', + message: 'Simulation disabled', + }, + tokenBalanceChanges: [], + }, + note: 'TransactionController#updateSimulationData - Update simulation data', + timestamp: 1631545992244, + }, ], ], + simulationData: { + error: { + code: 'disabled', + message: 'Simulation disabled', + }, + tokenBalanceChanges: [], + }, id: '7087d1d7-f0e8-4c0f-a903-6d9daa392baf', loadingDefaults: false, origin: 'https://metamask.github.io', @@ -869,8 +895,28 @@ class FixtureBuilder { timestamp: 1631545994695, value: false, }, + { + op: 'add', + path: '/simulationData', + value: { + error: { + code: 'disabled', + message: 'Simulation disabled', + }, + tokenBalanceChanges: [], + }, + note: 'TransactionController#updateSimulationData - Update simulation data', + timestamp: 1631545992244, + }, ], ], + simulationData: { + error: { + code: 'disabled', + message: 'Simulation disabled', + }, + tokenBalanceChanges: [], + }, id: '6eab4240-3762-4581-abc5-cd91eab6964e', loadingDefaults: false, origin: 'https://metamask.github.io', @@ -924,8 +970,28 @@ class FixtureBuilder { timestamp: 1631545996678, value: false, }, + { + op: 'add', + path: '/simulationData', + value: { + error: { + code: 'disabled', + message: 'Simulation disabled', + }, + tokenBalanceChanges: [], + }, + note: 'TransactionController#updateSimulationData - Update simulation data', + timestamp: 1631545992244, + }, ], ], + simulationData: { + error: { + code: 'disabled', + message: 'Simulation disabled', + }, + tokenBalanceChanges: [], + }, id: 'c15eee26-11d6-4914-a70e-36ef9a3bcacb', loadingDefaults: false, origin: 'https://metamask.github.io', @@ -979,8 +1045,28 @@ class FixtureBuilder { timestamp: 1631545998677, value: false, }, + { + op: 'add', + path: '/simulationData', + value: { + error: { + code: 'disabled', + message: 'Simulation disabled', + }, + tokenBalanceChanges: [], + }, + note: 'TransactionController#updateSimulationData - Update simulation data', + timestamp: 1631545992244, + }, ], ], + simulationData: { + error: { + code: 'disabled', + message: 'Simulation disabled', + }, + tokenBalanceChanges: [], + }, id: 'dfa9e5ad-d069-46b1-976e-a23734971d87', loadingDefaults: false, origin: 'https://metamask.github.io', diff --git a/test/e2e/tests/transaction/navigate-transactions.spec.js b/test/e2e/tests/transaction/navigate-transactions.spec.js index 99807d54f461..12c1144d5472 100644 --- a/test/e2e/tests/transaction/navigate-transactions.spec.js +++ b/test/e2e/tests/transaction/navigate-transactions.spec.js @@ -13,6 +13,7 @@ describe('Navigate transactions', function () { await withFixtures( { fixtures: new FixtureBuilder() + .withPreferencesControllerTxSimulationsDisabled() .withTransactionControllerMultipleTransactions() .build(), ganacheOptions: generateGanacheOptions({ hardfork: 'london' }), @@ -21,6 +22,12 @@ describe('Navigate transactions', function () { async ({ driver }) => { await unlockWallet(driver); + // Wait until total amount is loaded to mitigate flakiness on reject + await driver.findElement({ + tag: 'span', + text: '3.0000315', + }); + // navigate transactions await driver.clickElement('[data-testid="next-page"]'); let navigationElement = await driver.findElement( @@ -102,6 +109,7 @@ describe('Navigate transactions', function () { dapp: true, fixtures: new FixtureBuilder() .withPermissionControllerConnectedToTestDapp() + .withPreferencesControllerTxSimulationsDisabled() .withTransactionControllerMultipleTransactions() .build(), ganacheOptions: generateGanacheOptions({ hardfork: 'london' }), @@ -110,6 +118,12 @@ describe('Navigate transactions', function () { async ({ driver }) => { await unlockWallet(driver); + // Wait until total amount is loaded to mitigate flakiness on reject + await driver.findElement({ + tag: 'span', + text: '3.0000315', + }); + await driver.clickElement('[data-testid="next-page"]'); let navigationElement = await driver.findElement( '.confirm-page-container-navigation', @@ -146,6 +160,7 @@ describe('Navigate transactions', function () { await withFixtures( { fixtures: new FixtureBuilder() + .withPreferencesControllerTxSimulationsDisabled() .withTransactionControllerMultipleTransactions() .build(), ganacheOptions: generateGanacheOptions({ hardfork: 'london' }), @@ -154,6 +169,12 @@ describe('Navigate transactions', function () { async ({ driver }) => { await unlockWallet(driver); + // Wait until total amount is loaded to mitigate flakiness on reject + await driver.findElement({ + tag: 'span', + text: '3.0000315', + }); + // reject transaction await driver.clickElement({ text: 'Reject', tag: 'button' }); const navigationElement = await driver.waitForSelector({ @@ -174,6 +195,7 @@ describe('Navigate transactions', function () { await withFixtures( { fixtures: new FixtureBuilder() + .withPreferencesControllerTxSimulationsDisabled() .withTransactionControllerMultipleTransactions() .build(), ganacheOptions: generateGanacheOptions({ hardfork: 'london' }), @@ -182,6 +204,12 @@ describe('Navigate transactions', function () { async ({ driver }) => { await unlockWallet(driver); + // Wait until total amount is loaded to mitigate flakiness on reject + await driver.findElement({ + tag: 'span', + text: '3.0000315', + }); + // confirm transaction await driver.clickElement({ text: 'Confirm', tag: 'button' }); const navigationElement = await driver.waitForSelector({ @@ -202,6 +230,7 @@ describe('Navigate transactions', function () { await withFixtures( { fixtures: new FixtureBuilder() + .withPreferencesControllerTxSimulationsDisabled() .withTransactionControllerMultipleTransactions() .build(), ganacheOptions: generateGanacheOptions({ hardfork: 'london' }), @@ -210,6 +239,12 @@ describe('Navigate transactions', function () { async ({ driver, ganacheServer }) => { await unlockWallet(driver); + // Wait until total amount is loaded to mitigate flakiness on reject + await driver.findElement({ + tag: 'span', + text: '3.0000315', + }); + // reject transactions await driver.clickElement({ text: 'Reject 4', tag: 'a' }); await driver.clickElement({ text: 'Reject all', tag: 'button' }); diff --git a/ui/pages/routes/routes.component.js b/ui/pages/routes/routes.component.js index 640cf27751b5..1e795f056eba 100644 --- a/ui/pages/routes/routes.component.js +++ b/ui/pages/routes/routes.component.js @@ -851,7 +851,9 @@ export default class Routes extends Component { } > {shouldShowNetworkDeprecationWarning ? : null} - {shouldShowNetworkInfo && } + {location.pathname === DEFAULT_ROUTE && shouldShowNetworkInfo ? ( + + ) : null}