From 0b4532ec1b4bde5760e9263811a9ea6d70bce01b Mon Sep 17 00:00:00 2001 From: Peter Yinusa <53189696+PeterYinusa@users.noreply.github.com> Date: Fri, 28 Oct 2022 09:42:12 +0100 Subject: [PATCH] E2e test fixtures (#16061) * remove state.json files * move file * Update Readme * Create fixture builder * load test fixture * remove redundant method * update snap tests * update stats tests * update extension tests * update extension tests * Update fixture data * snap test dapp connection * Update fixture data * add onboarding fixture * use onboarding fixture * reuse import account vault * remove unnecessary use of class * use fixture builder in new tests * switch to function * update default fixture * update default fixture * update test * update 1559 test fixttures * update 1559 test fixtures * update 1559 test fixtures * dismiss 3box whats new * remove redundant code * move docs * remove unused code * token detection * use default timeout * remove redundant code * Update fixture builder hide `Protect your funds` dialog remove browser environment remove default network details hide dismiss seed backup reminder recursively merges fixture data * add token to tokencontroller * remove network details * add missing identities to preference controller * remove duplicate properties * update bip-32 to use fixturebuilder * alphabetise snap permissions * update get snaps to use fixturebuilder * Update test-snap-bip-32.spec.js wait for window * add popular network state * update test * lint --- .../generating-fixture-data.md | 7 - test/e2e/benchmark.js | 24 +- test/e2e/fixture-builder.js | 1002 +++++++++++++++++ test/e2e/fixture-server.js | 18 +- test/e2e/fixtures/address-entry/state.json | 169 --- test/e2e/fixtures/connected-state/state.json | 200 ---- test/e2e/fixtures/custom-rpc/state.json | 170 --- test/e2e/fixtures/custom-token/state.json | 178 --- test/e2e/fixtures/eip-1559-v2-dapp/state.json | 160 --- test/e2e/fixtures/eip-1559-v2/state.json | 229 ---- test/e2e/fixtures/import-ui/state.json | 272 ----- test/e2e/fixtures/imported-account/state.json | 157 --- test/e2e/fixtures/localization/state.json | 156 --- test/e2e/fixtures/metrics-enabled/state.json | 200 ---- .../fixtures/navigate-transactions/state.json | 442 -------- test/e2e/fixtures/onboarding/state.json | 59 - test/e2e/fixtures/send-edit-v2/state.json | 229 ---- test/e2e/fixtures/send-edit/state.json | 235 ---- test/e2e/fixtures/special-settings/state.json | 158 --- test/e2e/fixtures/threebox-enabled/state.json | 155 --- test/e2e/helpers.js | 23 +- .../test-json-import-account-file.json | 0 test/e2e/lavamoat-stats.js | 58 +- test/e2e/mv3-perf-stats/init-load-stats.js | 72 +- test/e2e/mv3-stats.js | 72 +- test/e2e/snaps/test-snap-bip-32.spec.js | 24 +- test/e2e/snaps/test-snap-bip-44.spec.js | 24 +- test/e2e/snaps/test-snap-confirm.spec.js | 24 +- test/e2e/snaps/test-snap-error.spec.js | 24 +- test/e2e/snaps/test-snap-get-snaps.spec.js | 42 +- test/e2e/snaps/test-snap-managestate.spec.js | 23 +- test/e2e/snaps/test-snap-notification.spec.js | 23 +- test/e2e/snaps/test-snap-update.spec.js | 24 +- test/e2e/tests/account-details.spec.js | 3 +- test/e2e/tests/add-account.spec.js | 7 +- test/e2e/tests/add-hide-token.spec.js | 35 +- test/e2e/tests/address-book.spec.js | 19 +- test/e2e/tests/advanced-settings.spec.js | 5 +- test/e2e/tests/auto-lock.spec.js | 3 +- test/e2e/tests/backup.spec.js | 3 +- test/e2e/tests/chain-interactions.spec.js | 9 +- test/e2e/tests/collectibles.spec.js | 17 +- test/e2e/tests/contract-interactions.spec.js | 5 +- test/e2e/tests/custom-rpc-history.spec.js | 55 +- .../tests/custom-token-add-approve.spec.js | 17 +- test/e2e/tests/dapp-interactions.spec.js | 19 +- test/e2e/tests/edit-gas-fee.spec.js | 35 +- test/e2e/tests/encrypt-decrypt.spec.js | 5 +- test/e2e/tests/errors.spec.js | 8 +- test/e2e/tests/eth-sign.spec.js | 5 +- test/e2e/tests/failing-contract.spec.js | 5 +- test/e2e/tests/from-import-ui.spec.js | 23 +- test/e2e/tests/gas-api-fallback.spec.js | 3 +- test/e2e/tests/incremental-security.spec.js | 3 +- test/e2e/tests/localization.spec.js | 16 +- test/e2e/tests/lock-account.spec.js | 3 +- test/e2e/tests/lockdown.spec.js | 3 +- test/e2e/tests/metamask-responsive-ui.spec.js | 7 +- test/e2e/tests/metrics.spec.js | 8 +- test/e2e/tests/navigate-transactions.spec.js | 22 +- test/e2e/tests/permissions.spec.js | 3 +- test/e2e/tests/personal-sign.spec.js | 5 +- test/e2e/tests/phishing-detection.spec.js | 9 +- test/e2e/tests/portfolio-site.spec.js | 3 +- test/e2e/tests/provider-api.spec.js | 9 +- test/e2e/tests/send-edit.spec.js | 12 +- test/e2e/tests/send-eth.spec.js | 17 +- test/e2e/tests/send-hex-address.spec.js | 13 +- test/e2e/tests/send-to-contract.spec.js | 5 +- test/e2e/tests/settings-general.spec.js | 3 +- test/e2e/tests/settings-search.spec.js | 19 +- test/e2e/tests/signature-request.spec.js | 13 +- test/e2e/tests/simple-send.spec.js | 7 +- test/e2e/tests/state-logs.spec.js | 3 +- test/e2e/tests/swap-eth.spec.js | 3 +- test/e2e/tests/threebox.spec.js | 14 +- test/e2e/tests/token-details.spec.js | 3 +- test/e2e/user-actions-benchmark.js | 5 +- 78 files changed, 1534 insertions(+), 3608 deletions(-) rename test/e2e/fixtures/README.md => docs/generating-fixture-data.md (63%) create mode 100644 test/e2e/fixture-builder.js delete mode 100644 test/e2e/fixtures/address-entry/state.json delete mode 100644 test/e2e/fixtures/connected-state/state.json delete mode 100644 test/e2e/fixtures/custom-rpc/state.json delete mode 100644 test/e2e/fixtures/custom-token/state.json delete mode 100644 test/e2e/fixtures/eip-1559-v2-dapp/state.json delete mode 100644 test/e2e/fixtures/eip-1559-v2/state.json delete mode 100644 test/e2e/fixtures/import-ui/state.json delete mode 100644 test/e2e/fixtures/imported-account/state.json delete mode 100644 test/e2e/fixtures/localization/state.json delete mode 100644 test/e2e/fixtures/metrics-enabled/state.json delete mode 100644 test/e2e/fixtures/navigate-transactions/state.json delete mode 100644 test/e2e/fixtures/onboarding/state.json delete mode 100644 test/e2e/fixtures/send-edit-v2/state.json delete mode 100644 test/e2e/fixtures/send-edit/state.json delete mode 100644 test/e2e/fixtures/special-settings/state.json delete mode 100644 test/e2e/fixtures/threebox-enabled/state.json rename test/e2e/{fixtures => }/import-utc-json/test-json-import-account-file.json (100%) diff --git a/test/e2e/fixtures/README.md b/docs/generating-fixture-data.md similarity index 63% rename from test/e2e/fixtures/README.md rename to docs/generating-fixture-data.md index e8bbe39ac..77b90f3c2 100644 --- a/test/e2e/fixtures/README.md +++ b/docs/generating-fixture-data.md @@ -1,10 +1,3 @@ -# End-to-end tests - -This directory contains the fixture data used to bootstrap the individual e2e tests. Each sub-directory contains -one thing: - -1. A `state.json` file that represents a the saved state for the extension (see _Generating fixture data_ below) - ## Generating fixture data Fixture data can be generated by following these steps: diff --git a/test/e2e/benchmark.js b/test/e2e/benchmark.js index df4c95756..760f4f70b 100755 --- a/test/e2e/benchmark.js +++ b/test/e2e/benchmark.js @@ -13,22 +13,26 @@ const { } = require('../helpers/file'); const { withFixtures, tinyDelayMs } = require('./helpers'); const { PAGES } = require('./webdriver/driver'); +const FixtureBuilder = require('./fixture-builder'); const DEFAULT_NUM_SAMPLES = 20; const ALL_PAGES = Object.values(PAGES); async function measurePage(pageName) { let metrics; - await withFixtures({ fixtures: 'imported-account' }, async ({ driver }) => { - await driver.delay(tinyDelayMs); - await driver.navigate(); - await driver.fill('#password', 'correct horse battery staple'); - await driver.press('#password', driver.Key.ENTER); - await driver.findElement('.selected-account__name'); - await driver.navigate(pageName); - await driver.delay(1000); - metrics = await driver.collectMetrics(); - }); + await withFixtures( + { fixtures: new FixtureBuilder().build() }, + async ({ driver }) => { + await driver.delay(tinyDelayMs); + await driver.navigate(); + await driver.fill('#password', 'correct horse battery staple'); + await driver.press('#password', driver.Key.ENTER); + await driver.findElement('.selected-account__name'); + await driver.navigate(pageName); + await driver.delay(1000); + metrics = await driver.collectMetrics(); + }, + ); return metrics; } diff --git a/test/e2e/fixture-builder.js b/test/e2e/fixture-builder.js new file mode 100644 index 000000000..589cbea9a --- /dev/null +++ b/test/e2e/fixture-builder.js @@ -0,0 +1,1002 @@ +const { merge } = require('lodash'); + +function defaultFixture() { + return { + data: { + AlertController: { + alertEnabledness: { + unconnectedAccount: true, + web3ShimUsage: true, + }, + unconnectedAccountAlertShownOrigins: {}, + web3ShimUsageOrigins: {}, + }, + AnnouncementController: { + announcements: { + 1: { + date: '2021-03-17', + id: 1, + image: { + height: '230px', + placeImageBelowDescription: true, + src: 'images/mobile-link-qr.svg', + width: '230px', + }, + isShown: false, + }, + 3: { + date: '2021-03-08', + id: 3, + isShown: false, + }, + 4: { + date: '2021-05-11', + id: 4, + image: { + src: 'images/source-logos-bsc.svg', + width: '100%', + }, + isShown: false, + }, + 5: { + date: '2021-06-09', + id: 5, + isShown: false, + }, + 6: { + date: '2021-05-26', + id: 6, + isShown: false, + }, + 7: { + date: '2021-09-17', + id: 7, + isShown: false, + }, + 8: { + date: '2021-11-01', + id: 8, + isShown: false, + }, + 9: { + date: '2021-12-07', + id: 9, + image: { + src: 'images/txinsights.png', + width: '80%', + }, + isShown: false, + }, + 10: { + date: '2022-09-15', + id: 10, + image: { + src: 'images/token-detection.svg', + width: '100%', + }, + isShown: true, + }, + 11: { + date: '2022-09-15', + id: 11, + isShown: true, + }, + 12: { + date: '2022-05-18', + id: 12, + image: { + src: 'images/darkmode-banner.png', + width: '100%', + }, + isShown: false, + }, + 13: { + date: '2022-09-15', + id: 13, + isShown: false, + }, + 14: { + date: '2022-09-15', + id: 14, + isShown: true, + }, + 15: { + date: '2022-09-15', + id: 15, + isShown: true, + }, + }, + }, + AppStateController: { + browserEnvironment: {}, + collectiblesDetectionNoticeDismissed: false, + collectiblesDropdownState: {}, + connectedStatusPopoverHasBeenShown: true, + defaultHomeActiveTabName: null, + enableEIP1559V2NoticeDismissed: false, + fullScreenGasPollTokens: [], + notificationGasPollTokens: [], + popupGasPollTokens: [], + qrHardware: {}, + recoveryPhraseReminderHasBeenShown: true, + recoveryPhraseReminderLastShown: + '__FIXTURE_SUBSTITUTION__currentDateInMilliseconds', + showPortfolioTooltip: false, + showTestnetMessageInDropdown: true, + trezorModel: null, + usedNetworks: { + '0x1': true, + '0x5': true, + '0x539': true, + }, + }, + CachedBalancesController: { + cachedBalances: { + '0x539': {}, + }, + }, + CurrencyController: { + conversionDate: 1665507600.0, + conversionRate: 1300.0, + currentCurrency: 'usd', + nativeCurrency: 'ETH', + usdConversionRate: 1300.0, + }, + GasFeeController: { + estimatedGasFeeTimeBounds: {}, + gasEstimateType: 'none', + gasFeeEstimates: {}, + }, + IncomingTransactionsController: { + incomingTransactions: {}, + incomingTxLastFetchedBlockByChainId: { + '0x1': null, + '0x5': null, + '0xaa36a7': null, + }, + }, + KeyringController: { + vault: + '{"data":"s6TpYjlUNsn7ifhEFTkuDGBUM1GyOlPrim7JSjtfIxgTt8/6MiXgiR/CtFfR4dWW2xhq85/NGIBYEeWrZThGdKGarBzeIqBfLFhw9n509jprzJ0zc2Rf+9HVFGLw+xxC4xPxgCS0IIWeAJQ+XtGcHmn0UZXriXm8Ja4kdlow6SWinB7sr/WM3R0+frYs4WgllkwggDf2/Tv6VHygvLnhtzp6hIJFyTjh+l/KnyJTyZW1TkZhDaNDzX3SCOHT","iv":"FbeHDAW5afeWNORfNJBR0Q==","salt":"TxZ+WbCW6891C9LK/hbMAoUsSEW1E8pyGLVBU6x5KR8="}', + }, + MetaMetricsController: { + eventsBeforeMetricsOptIn: [], + fragments: {}, + metaMetricsId: null, + participateInMetaMetrics: false, + traits: {}, + }, + NetworkController: { + network: '1337', + provider: { + chainId: '0x539', + nickname: 'Localhost 8545', + rpcPrefs: {}, + rpcUrl: 'http://localhost:8545', + ticker: 'ETH', + type: 'rpc', + }, + }, + OnboardingController: { + completedOnboarding: true, + firstTimeFlowType: 'import', + onboardingTabs: {}, + seedPhraseBackedUp: true, + }, + PermissionController: { + subjects: {}, + }, + PreferencesController: { + advancedGasFee: null, + currentLocale: 'en', + dismissSeedBackUpReminder: true, + featureFlags: { + showIncomingTransactions: true, + }, + forgottenPassword: false, + frequentRpcListDetail: [ + { + chainId: '0x539', + nickname: 'Localhost 8545', + rpcPrefs: {}, + rpcUrl: 'http://localhost:8545', + ticker: 'ETH', + }, + ], + identities: { + '0x5cfe73b6021e818b776b421b1c4db2474086a7e1': { + address: '0x5cfe73b6021e818b776b421b1c4db2474086a7e1', + lastSelected: 1665507600000, + name: 'Account 1', + }, + }, + infuraBlocked: false, + ipfsGateway: 'dweb.link', + knownMethodData: {}, + ledgerTransportType: 'webhid', + lostIdentities: {}, + openSeaEnabled: false, + preferences: { + hideZeroBalanceTokens: false, + showFiatInTestnets: false, + showTestNetworks: false, + useNativeCurrencyAsPrimaryCurrency: true, + }, + selectedAddress: '0x5cfe73b6021e818b776b421b1c4db2474086a7e1', + theme: 'light', + useBlockie: false, + useCollectibleDetection: false, + useNonceField: false, + usePhishDetect: true, + useTokenDetection: false, + }, + SmartTransactionsController: { + smartTransactionsState: { + fees: {}, + liveness: true, + smartTransactions: { + '0x1': [], + }, + }, + }, + SubjectMetadataController: { + subjectMetadata: { + 'https://metamask.github.io': { + extensionId: null, + iconUrl: null, + name: 'MetaMask < = > Ledger Bridge', + origin: 'https://metamask.github.io', + subjectType: 'website', + }, + }, + }, + TokensController: { + allDetectedTokens: {}, + allIgnoredTokens: {}, + allTokens: {}, + detectedTokens: [], + ignoredTokens: [], + suggestedAssets: [], + tokens: [], + }, + TransactionController: { + transactions: {}, + }, + config: {}, + firstTimeInfo: { + date: 1665507600000, + version: '10.21.0', + }, + }, + }; +} +function onboardingFixture() { + return { + data: { + AppStateController: { + browserEnvironment: {}, + collectiblesDetectionNoticeDismissed: false, + collectiblesDropdownState: {}, + connectedStatusPopoverHasBeenShown: true, + defaultHomeActiveTabName: null, + enableEIP1559V2NoticeDismissed: false, + fullScreenGasPollTokens: [], + notificationGasPollTokens: [], + popupGasPollTokens: [], + qrHardware: {}, + recoveryPhraseReminderHasBeenShown: false, + recoveryPhraseReminderLastShown: + '__FIXTURE_SUBSTITUTION__currentDateInMilliseconds', + showPortfolioTooltip: true, + showTestnetMessageInDropdown: true, + trezorModel: null, + usedNetworks: { + '0x1': true, + '0x5': true, + '0x539': true, + }, + }, + NetworkController: { + network: '1337', + provider: { + ticker: 'ETH', + type: 'rpc', + rpcUrl: 'http://localhost:8545', + chainId: '0x539', + nickname: 'Localhost 8545', + }, + }, + PreferencesController: { + advancedGasFee: null, + currentLocale: 'en', + dismissSeedBackUpReminder: false, + featureFlags: { + showIncomingTransactions: true, + }, + forgottenPassword: false, + frequentRpcListDetail: [ + { + chainId: '0x539', + nickname: 'Localhost 8545', + rpcPrefs: {}, + rpcUrl: 'http://localhost:8545', + ticker: 'ETH', + }, + ], + identities: {}, + infuraBlocked: false, + ipfsGateway: 'dweb.link', + knownMethodData: {}, + ledgerTransportType: 'webhid', + lostIdentities: {}, + openSeaEnabled: false, + preferences: { + hideZeroBalanceTokens: false, + showFiatInTestnets: false, + showTestNetworks: false, + useNativeCurrencyAsPrimaryCurrency: true, + }, + theme: 'light', + useBlockie: false, + useCollectibleDetection: false, + useNonceField: false, + usePhishDetect: true, + useTokenDetection: false, + }, + SmartTransactionsController: { + smartTransactionsState: { + fees: {}, + liveness: true, + smartTransactions: { + '0x1': [], + }, + }, + }, + TokensController: { + allDetectedTokens: {}, + allIgnoredTokens: {}, + allTokens: {}, + detectedTokens: [], + ignoredTokens: [], + suggestedAssets: [], + tokens: [], + }, + config: {}, + firstTimeInfo: { + date: 1665507600000, + version: '10.21.0', + }, + }, + }; +} + +class FixtureBuilder { + constructor({ onboarding = false } = {}) { + this.fixture = onboarding === true ? onboardingFixture() : defaultFixture(); + } + + withAddressBookController(data) { + merge( + this.fixture.data.AddressBookController + ? this.fixture.data.AddressBookController + : (this.fixture.data.AddressBookController = {}), + data, + ); + return this; + } + + withAlertController(data) { + merge(this.fixture.data.AlertController, data); + return this; + } + + withAnnouncementController(data) { + merge(this.fixture.data.AnnouncementController, data); + return this; + } + + withAppStateController(data) { + merge(this.fixture.data.AppStateController, data); + return this; + } + + withCachedBalancesController(data) { + merge(this.fixture.data.CachedBalancesController, data); + return this; + } + + withCollectiblesController(data) { + merge( + this.fixture.data.CollectiblesController + ? this.fixture.data.CollectiblesController + : (this.fixture.data.CollectiblesController = {}), + data, + ); + return this; + } + + withCurrencyController(data) { + merge(this.fixture.data.CurrencyController, data); + return this; + } + + withGasFeeController(data) { + merge(this.fixture.data.GasFeeController, data); + return this; + } + + withIncomingTransactionsController(data) { + merge( + this.fixture.data.IncomingTransactionsController + ? this.fixture.data.IncomingTransactionsController + : (this.fixture.data.IncomingTransactionsController = {}), + data, + ); + return this; + } + + withKeyringController(data) { + merge(this.fixture.data.KeyringController, data); + return this; + } + + withKeyringControllerImportedAccountVault() { + return this.withKeyringController({ + vault: + '{"data":"Ot+BTtJPag0xubdiv1nO9bsSvTHivHCd6CD7Lxgb1McYw3VqMjgp5rPMZmblJ1lscuMxyiqp99G52uXO9S0em6F9htpa+t/wn6qubRKTTNG9fxNzQrKXRDNhdgfYckVk5VAZ4fgl2iMZcRDvS8H/+gucVKJ33Sl6mXyPofdexXhWDCU6uR2YecnfaIum9cL2u/GqOMPE3jxzy0Wip0x2Jyp3QOKhvu8A3GIjzagLOaQ7a1APdl8=","iv":"lbsyPeGYWU6U1+jvmW9UHg==","salt":"Zmbhpskwxe4rYfXtELBvlcvW4HISPBATRmMqzsnZPMg="}', + }); + } + + withMetaMetricsController(data) { + merge(this.fixture.data.MetaMetricsController, data); + return this; + } + + withNetworkController(data) { + merge(this.fixture.data.NetworkController, data); + return this; + } + + withOnboardingController(data) { + merge(this.fixture.data.OnboardingController, data); + return this; + } + + withPermissionController(data) { + merge(this.fixture.data.PermissionController, data); + return this; + } + + withPermissionControllerConnectedToTestDapp() { + return this.withPermissionController({ + subjects: { + 'http://127.0.0.1:8080': { + origin: 'http://127.0.0.1:8080', + permissions: { + eth_accounts: { + id: 'ZaqPEWxyhNCJYACFw93jE', + parentCapability: 'eth_accounts', + invoker: 'http://127.0.0.1:8080', + caveats: [ + { + type: 'restrictReturnedAccounts', + value: ['0x5cfe73b6021e818b776b421b1c4db2474086a7e1'], + }, + ], + date: 1664388714636, + }, + }, + }, + }, + }); + } + + withPermissionControllerConnectedToSnapDapp() { + return this.withPermissionController({ + subjects: { + 'https://metamask.github.io': { + origin: 'https://metamask.github.io', + permissions: { + 'wallet_snap_npm:@metamask/test-snap-bip32': { + id: 'CwdJq0x8N_b9FNxn6dVuP', + parentCapability: 'wallet_snap_npm:@metamask/test-snap-bip32', + invoker: 'https://metamask.github.io', + caveats: null, + date: 1664388714636, + }, + 'wallet_snap_npm:@metamask/test-snap-bip44': { + id: '8zH-0opWuZhvJew41FMVh', + parentCapability: 'wallet_snap_npm:@metamask/test-snap-bip44', + invoker: 'https://metamask.github.io', + caveats: null, + date: 1664388714636, + }, + 'wallet_snap_npm:@metamask/test-snap-confirm': { + id: 'Wb_1c9toBggBQWfOJwjMg', + parentCapability: 'wallet_snap_npm:@metamask/test-snap-confirm', + invoker: 'https://metamask.github.io', + caveats: null, + date: 1664388714636, + }, + 'wallet_snap_npm:@metamask/test-snap-error': { + id: '5FUZoCyimOWKTbuLCEOWa', + parentCapability: 'wallet_snap_npm:@metamask/test-snap-error', + invoker: 'https://metamask.github.io', + caveats: null, + date: 1664388714636, + }, + 'wallet_snap_npm:@metamask/test-snap-managestate': { + id: 'Z6XPdyuCHCf1pyqSiU7nh', + parentCapability: + 'wallet_snap_npm:@metamask/test-snap-managestate', + invoker: 'https://metamask.github.io', + caveats: null, + date: 1664388714636, + }, + 'wallet_snap_npm:@metamask/test-snap-notification': { + id: '_xfRMXzq0bs8QcXRcvjcP', + parentCapability: + 'wallet_snap_npm:@metamask/test-snap-notification', + invoker: 'https://metamask.github.io', + caveats: null, + date: 1664388714636, + }, + }, + }, + }, + }); + } + + withPermissionLogController(data) { + merge( + this.fixture.data.PermissionLogController + ? this.fixture.data.PermissionLogController + : (this.fixture.data.PermissionLogController = {}), + data, + ); + return this; + } + + withPreferencesController(data) { + merge(this.fixture.data.PreferencesController, data); + return this; + } + + withPreferencesControllerImportedAccountIdentities() { + return this.withPreferencesController({ + identities: { + '0x0cc5261ab8ce458dc977078a3623e2badd27afd3': { + name: 'Account 1', + address: '0x0cc5261ab8ce458dc977078a3623e2badd27afd3', + lastSelected: 1665507600000, + }, + '0x3ed0ee22e0685ebbf07b2360a8331693c413cc59': { + name: 'Account 2', + address: '0x3ed0ee22e0685ebbf07b2360a8331693c413cc59', + }, + '0xd38d853771fb546bd8b18b2f3638491bc0b0e906': { + name: 'Account 3', + address: '0xd38d853771fb546bd8b18b2f3638491bc0b0e906', + }, + }, + selectedAddress: '0x0cc5261ab8ce458dc977078a3623e2badd27afd3', + }); + } + + withSmartTransactionsController(data) { + merge(this.fixture.data.SmartTransactionsController, data); + return this; + } + + withSubjectMetadataController(data) { + merge(this.fixture.data.SubjectMetadataController, data); + return this; + } + + withThreeBoxController(data) { + merge( + this.fixture.data.ThreeBoxController + ? this.fixture.data.ThreeBoxController + : (this.fixture.data.ThreeBoxController = {}), + data, + ); + return this; + } + + withTokenListController(data) { + merge( + this.fixture.data.TokenListController + ? this.fixture.data.TokenListController + : (this.fixture.data.TokenListController = {}), + data, + ); + return this; + } + + withTokensController(data) { + merge(this.fixture.data.TokensController, data); + return this; + } + + withTransactionController(data) { + merge( + this.fixture.data.TransactionController + ? this.fixture.data.TransactionController + : (this.fixture.data.TransactionController = {}), + data, + ); + return this; + } + + withTransactionControllerMultipleTransactions() { + return this.withTransactionController({ + transactions: { + 7911313280012623: { + chainId: '0x539', + dappSuggestedGasFees: { + gas: '0x5208', + gasPrice: '0x4a817c800', + }, + history: [ + { + chainId: '0x539', + dappSuggestedGasFees: { + gas: '0x5208', + gasPrice: '0x4a817c800', + }, + id: 7911313280012623, + loadingDefaults: true, + metamaskNetworkId: '1337', + origin: 'https://metamask.github.io', + status: 'unapproved', + time: 1631545991949, + txParams: { + from: '0x5cfe73b6021e818b776b421b1c4db2474086a7e1', + gas: '0x5208', + gasPrice: '0x4a817c800', + to: '0x2f318c334780961fb129d2a6c30d0763d9a5c970', + value: '0x29a2241af62c0000', + }, + type: 'simpleSend', + }, + [ + { + note: 'Added new unapproved transaction.', + op: 'replace', + path: '/loadingDefaults', + timestamp: 1631545992244, + value: false, + }, + ], + ], + id: 7911313280012623, + loadingDefaults: false, + metamaskNetworkId: '1337', + origin: 'https://metamask.github.io', + status: 'unapproved', + time: 1631545991949, + txParams: { + from: '0x5cfe73b6021e818b776b421b1c4db2474086a7e1', + gas: '0x5208', + gasPrice: '0x4a817c800', + to: '0x2f318c334780961fb129d2a6c30d0763d9a5c970', + value: '0x29a2241af62c0000', + }, + type: 'simpleSend', + }, + 7911313280012624: { + chainId: '0x539', + dappSuggestedGasFees: { + gas: '0x5208', + gasPrice: '0x4a817c800', + }, + history: [ + { + chainId: '0x539', + dappSuggestedGasFees: { + gas: '0x5208', + gasPrice: '0x4a817c800', + }, + id: 7911313280012624, + loadingDefaults: true, + metamaskNetworkId: '1337', + origin: 'https://metamask.github.io', + status: 'unapproved', + time: 1631545994578, + txParams: { + from: '0x5cfe73b6021e818b776b421b1c4db2474086a7e1', + gas: '0x5208', + gasPrice: '0x4a817c800', + to: '0x2f318c334780961fb129d2a6c30d0763d9a5c970', + value: '0x29a2241af62c0000', + }, + type: 'simpleSend', + }, + [ + { + note: 'Added new unapproved transaction.', + op: 'replace', + path: '/loadingDefaults', + timestamp: 1631545994695, + value: false, + }, + ], + ], + id: 7911313280012624, + loadingDefaults: false, + metamaskNetworkId: '1337', + origin: 'https://metamask.github.io', + status: 'unapproved', + time: 1631545994578, + txParams: { + from: '0x5cfe73b6021e818b776b421b1c4db2474086a7e1', + gas: '0x5208', + gasPrice: '0x4a817c800', + to: '0x2f318c334780961fb129d2a6c30d0763d9a5c970', + value: '0x29a2241af62c0000', + }, + type: 'simpleSend', + }, + 7911313280012625: { + chainId: '0x539', + dappSuggestedGasFees: { + gas: '0x5208', + gasPrice: '0x4a817c800', + }, + history: [ + { + chainId: '0x539', + dappSuggestedGasFees: { + gas: '0x5208', + gasPrice: '0x4a817c800', + }, + id: 7911313280012625, + loadingDefaults: true, + metamaskNetworkId: '1337', + origin: 'https://metamask.github.io', + status: 'unapproved', + time: 1631545996673, + txParams: { + from: '0x5cfe73b6021e818b776b421b1c4db2474086a7e1', + gas: '0x5208', + gasPrice: '0x4a817c800', + to: '0x2f318c334780961fb129d2a6c30d0763d9a5c970', + value: '0x29a2241af62c0000', + }, + type: 'simpleSend', + }, + [ + { + note: 'Added new unapproved transaction.', + op: 'replace', + path: '/loadingDefaults', + timestamp: 1631545996678, + value: false, + }, + ], + ], + id: 7911313280012625, + loadingDefaults: false, + metamaskNetworkId: '1337', + origin: 'https://metamask.github.io', + status: 'unapproved', + time: 1631545996673, + txParams: { + from: '0x5cfe73b6021e818b776b421b1c4db2474086a7e1', + gas: '0x5208', + gasPrice: '0x4a817c800', + to: '0x2f318c334780961fb129d2a6c30d0763d9a5c970', + value: '0x29a2241af62c0000', + }, + type: 'simpleSend', + }, + 7911313280012626: { + chainId: '0x539', + dappSuggestedGasFees: { + gas: '0x5208', + gasPrice: '0x4a817c800', + }, + history: [ + { + chainId: '0x539', + dappSuggestedGasFees: { + gas: '0x5208', + gasPrice: '0x4a817c800', + }, + id: 7911313280012626, + loadingDefaults: true, + metamaskNetworkId: '1337', + origin: 'https://metamask.github.io', + status: 'unapproved', + time: 1631545998675, + txParams: { + from: '0x5cfe73b6021e818b776b421b1c4db2474086a7e1', + gas: '0x5208', + gasPrice: '0x4a817c800', + to: '0x2f318c334780961fb129d2a6c30d0763d9a5c970', + value: '0x29a2241af62c0000', + }, + type: 'simpleSend', + }, + [ + { + note: 'Added new unapproved transaction.', + op: 'replace', + path: '/loadingDefaults', + timestamp: 1631545998677, + value: false, + }, + ], + ], + id: 7911313280012626, + loadingDefaults: false, + metamaskNetworkId: '1337', + origin: 'https://metamask.github.io', + status: 'unapproved', + time: 1631545998675, + txParams: { + from: '0x5cfe73b6021e818b776b421b1c4db2474086a7e1', + gas: '0x5208', + gasPrice: '0x4a817c800', + to: '0x2f318c334780961fb129d2a6c30d0763d9a5c970', + value: '0x29a2241af62c0000', + }, + type: 'simpleSend', + }, + }, + }); + } + + withTransactionControllerTypeOneTransaction() { + return this.withTransactionController({ + transactions: { + 4046084157914634: { + chainId: '0x539', + history: [ + { + chainId: '0x539', + id: 4046084157914634, + loadingDefaults: true, + metamaskNetworkId: '1337', + origin: 'metamask', + status: 'unapproved', + time: 1617228030067, + txParams: { + from: '0x5cfe73b6021e818b776b421b1c4db2474086a7e1', + gas: '0x61a8', + gasPrice: '0x2540be400', + to: '0x2f318C334780961FB129D2a6c30D0763d9a5C970', + value: '0xde0b6b3a7640000', + }, + type: 'simpleSend', + }, + [ + { + note: 'Added new unapproved transaction.', + op: 'replace', + path: '/loadingDefaults', + timestamp: 1617228030069, + value: false, + }, + ], + ], + id: 4046084157914634, + loadingDefaults: false, + metamaskNetworkId: '1337', + origin: 'metamask', + primaryTransaction: { + chainId: '0x539', + id: 4046084157914634, + loadingDefaults: true, + metamaskNetworkId: '1337', + origin: 'metamask', + status: 'unapproved', + time: 1617228030067, + txParams: { + from: '0x5cfe73b6021e818b776b421b1c4db2474086a7e1', + gas: '0x61a8', + gasPrice: '0x2540be400', + to: '0x2f318C334780961FB129D2a6c30D0763d9a5C970', + value: '0xde0b6b3a7640000', + }, + type: 'sentEther', + }, + status: 'unapproved', + time: 1617228030067, + txParams: { + from: '0x5cfe73b6021e818b776b421b1c4db2474086a7e1', + gas: '0x61a8', + gasPrice: '0x2540be400', + to: '0x2f318C334780961FB129D2a6c30D0763d9a5C970', + value: '0xde0b6b3a7640000', + }, + type: 'simpleSend', + }, + }, + }); + } + + withTransactionControllerTypeTwoTransaction() { + return this.withTransactionController({ + transactions: { + 4046084157914634: { + chainId: '0x539', + history: [ + { + chainId: '0x539', + id: 4046084157914634, + loadingDefaults: true, + metamaskNetworkId: '1337', + origin: 'metamask', + status: 'unapproved', + time: 1617228030067, + txParams: { + from: '0x5cfe73b6021e818b776b421b1c4db2474086a7e1', + gas: '0x61a8', + maxFeePerGas: '0x59682f0c', + maxPriorityFeePerGas: '0x59682f00', + to: '0x2f318C334780961FB129D2a6c30D0763d9a5C970', + type: '0x2', + value: '0xde0b6b3a7640000', + }, + type: 'simpleSend', + }, + [ + { + note: 'Added new unapproved transaction.', + op: 'replace', + path: '/loadingDefaults', + timestamp: 1617228030069, + value: false, + }, + ], + ], + id: 4046084157914634, + loadingDefaults: false, + metamaskNetworkId: '1337', + origin: 'metamask', + primaryTransaction: { + chainId: '0x539', + id: 4046084157914634, + loadingDefaults: true, + metamaskNetworkId: '1337', + origin: 'metamask', + status: 'unapproved', + time: 1617228030067, + txParams: { + from: '0x5cfe73b6021e818b776b421b1c4db2474086a7e1', + gas: '0x61a8', + maxFeePerGas: '0x59682f0c', + maxPriorityFeePerGas: '0x59682f00', + to: '0x2f318C334780961FB129D2a6c30D0763d9a5C970', + type: '0x2', + value: '0xde0b6b3a7640000', + }, + type: 'sentEther', + }, + status: 'unapproved', + time: 1617228030067, + txParams: { + from: '0x5cfe73b6021e818b776b421b1c4db2474086a7e1', + gas: '0x61a8', + maxFeePerGas: '0x59682f0c', + maxPriorityFeePerGas: '0x59682f00', + to: '0x2f318C334780961FB129D2a6c30D0763d9a5C970', + type: '0x2', + value: '0xde0b6b3a7640000', + }, + type: 'simpleSend', + }, + }, + }); + } + + build() { + this.fixture.meta = { + version: 74, + }; + return this.fixture; + } +} + +module.exports = FixtureBuilder; diff --git a/test/e2e/fixture-server.js b/test/e2e/fixture-server.js index e27f0cfa2..bad4bc165 100644 --- a/test/e2e/fixture-server.js +++ b/test/e2e/fixture-server.js @@ -1,5 +1,3 @@ -const { promises: fs } = require('fs'); -const path = require('path'); const Koa = require('koa'); const { isObject, mapValues } = require('lodash'); @@ -57,7 +55,6 @@ class FixtureServer { constructor() { this._app = new Koa(); this._stateMap = new Map([[DEFAULT_STATE_KEY, Object.create(null)]]); - this._initialStateCache = new Map(); this._app.use(async (ctx) => { // Firefox is _super_ strict about needing CORS headers @@ -94,19 +91,8 @@ class FixtureServer { }); } - async loadState(directory) { - const statePath = path.resolve(__dirname, directory, 'state.json'); - - let state; - if (this._initialStateCache.has(statePath)) { - state = this._initialStateCache.get(statePath); - } else { - const data = await fs.readFile(statePath); - const rawState = JSON.parse(data.toString('utf-8')); - state = performStateSubstitutions(rawState); - this._initialStateCache.set(statePath, state); - } - + loadJsonState(rawState) { + const state = performStateSubstitutions(rawState); this._stateMap.set(CURRENT_STATE_KEY, state); } diff --git a/test/e2e/fixtures/address-entry/state.json b/test/e2e/fixtures/address-entry/state.json deleted file mode 100644 index 6cfdc82e6..000000000 --- a/test/e2e/fixtures/address-entry/state.json +++ /dev/null @@ -1,169 +0,0 @@ -{ - "data": { - "AddressBookController": { - "addressBook": { - "0x539": { - "0x2f318C334780961FB129D2a6c30D0763d9a5C970": { - "address": "0x2f318C334780961FB129D2a6c30D0763d9a5C970", - "chainId": "0x539", - "isEns": false, - "memo": "", - "name": "Test Name 1" - } - } - } - }, - "AppStateController": { - "mkrMigrationReminderTimestamp": null, - "swapsWelcomeMessageHasBeenShown": true, - "showPortfolioTooltip": false - }, - "CachedBalancesController": { - "cachedBalances": { - "4": {} - } - }, - "CurrencyController": { - "conversionDate": 1575697244.188, - "conversionRate": 149.61, - "currentCurrency": "usd", - "nativeCurrency": "ETH" - }, - "IncomingTransactionsController": { - "incomingTransactions": {}, - "incomingTxLastFetchedBlocksByNetwork": { - "goerli": null, - "mainnet": null, - "sepolia": null - } - }, - "KeyringController": { - "vault": "{\"data\":\"s6TpYjlUNsn7ifhEFTkuDGBUM1GyOlPrim7JSjtfIxgTt8/6MiXgiR/CtFfR4dWW2xhq85/NGIBYEeWrZThGdKGarBzeIqBfLFhw9n509jprzJ0zc2Rf+9HVFGLw+xxC4xPxgCS0IIWeAJQ+XtGcHmn0UZXriXm8Ja4kdlow6SWinB7sr/WM3R0+frYs4WgllkwggDf2/Tv6VHygvLnhtzp6hIJFyTjh+l/KnyJTyZW1TkZhDaNDzX3SCOHT\",\"iv\":\"FbeHDAW5afeWNORfNJBR0Q==\",\"salt\":\"TxZ+WbCW6891C9LK/hbMAoUsSEW1E8pyGLVBU6x5KR8=\"}" - }, - "NetworkController": { - "network": "1337", - "provider": { - "nickname": "Localhost 8545", - "rpcUrl": "http://localhost:8545", - "chainId": "0x539", - "ticker": "ETH", - "type": "rpc" - } - }, - "NotificationController": { - "notifications": { - "1": { - "isShown": true - }, - "3": { - "isShown": true - }, - "5": { - "isShown": true - }, - "6": { - "isShown": true - }, - "8": { - "isShown": true - }, - "10": { - "isShown": true - }, - "11": { - "isShown": true - }, - "12": { - "isShown": true - }, - "14": { - "isShown": true - }, - "15": { - "isShown": true - } - } - }, - "OnboardingController": { - "onboardingTabs": {}, - "seedPhraseBackedUp": false - }, - "PermissionsMetadata": { - "domainMetadata": { - "metamask.github.io": { - "icon": null, - "name": "M E T A M A S K M E S H T E S T" - } - }, - "permissionsHistory": {}, - "permissionsLog": [ - { - "id": 746677923, - "method": "eth_accounts", - "methodType": "restricted", - "origin": "metamask.github.io", - "request": { - "id": 746677923, - "jsonrpc": "2.0", - "method": "eth_accounts", - "origin": "metamask.github.io", - "params": [] - }, - "requestTime": 1575697241368, - "response": { - "id": 746677923, - "jsonrpc": "2.0", - "result": [] - }, - "responseTime": 1575697241370, - "success": true - } - ] - }, - "PreferencesController": { - "accountTokens": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": { - "goerli": [], - "sepolia": [] - } - }, - "assetImages": {}, - "completedOnboarding": true, - "currentLocale": "en", - "featureFlags": { - "showIncomingTransactions": true, - "transactionTime": false - }, - "firstTimeFlowType": "create", - "forgottenPassword": false, - "frequentRpcListDetail": [], - "identities": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": { - "address": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "name": "Account 1" - } - }, - "knownMethodData": {}, - "lostIdentities": {}, - "metaMetricsId": null, - "participateInMetaMetrics": false, - "preferences": { - "useNativeCurrencyAsPrimaryCurrency": true - }, - "selectedAddress": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "suggestedTokens": {}, - "tokens": [], - "useBlockie": false, - "useNonceField": false, - "usePhishDetect": true - }, - "config": {}, - "firstTimeInfo": { - "date": 1575697234195, - "version": "7.7.0" - } - }, - "meta": { - "version": 40 - } -} diff --git a/test/e2e/fixtures/connected-state/state.json b/test/e2e/fixtures/connected-state/state.json deleted file mode 100644 index 4eebbb241..000000000 --- a/test/e2e/fixtures/connected-state/state.json +++ /dev/null @@ -1,200 +0,0 @@ -{ - "data": { - "AppStateController": { - "connectedStatusPopoverHasBeenShown": false, - "showPortfolioTooltip": false - }, - "CachedBalancesController": { - "cachedBalances": { - "4": {}, - "1337": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": "0x15af1d78b58c40000" - } - } - }, - "CurrencyController": { - "conversionDate": 1594348502.519, - "conversionRate": 240.09, - "currentCurrency": "usd", - "nativeCurrency": "ETH" - }, - "IncomingTransactionsController": { - "incomingTransactions": {}, - "incomingTxLastFetchedBlocksByNetwork": { - "goerli": null, - "mainnet": null, - "sepolia": null, - "localhost": 98 - } - }, - "KeyringController": { - "vault": "{\"data\":\"s6TpYjlUNsn7ifhEFTkuDGBUM1GyOlPrim7JSjtfIxgTt8/6MiXgiR/CtFfR4dWW2xhq85/NGIBYEeWrZThGdKGarBzeIqBfLFhw9n509jprzJ0zc2Rf+9HVFGLw+xxC4xPxgCS0IIWeAJQ+XtGcHmn0UZXriXm8Ja4kdlow6SWinB7sr/WM3R0+frYs4WgllkwggDf2/Tv6VHygvLnhtzp6hIJFyTjh+l/KnyJTyZW1TkZhDaNDzX3SCOHT\",\"iv\":\"FbeHDAW5afeWNORfNJBR0Q==\",\"salt\":\"TxZ+WbCW6891C9LK/hbMAoUsSEW1E8pyGLVBU6x5KR8=\"}" - }, - "NetworkController": { - "provider": { - "nickname": "Localhost 8545", - "rpcUrl": "http://localhost:8545", - "chainId": "0x539", - "ticker": "ETH", - "type": "rpc" - }, - "network": "1337" - }, - "NotificationController": { - "notifications": { - "1": { - "isShown": true - }, - "3": { - "isShown": true - }, - "5": { - "isShown": true - }, - "6": { - "isShown": true - }, - "8": { - "isShown": true - }, - "10": { - "isShown": true - }, - "11": { - "isShown": true - }, - "12": { - "isShown": true - }, - "14": { - "isShown": true - }, - "15": { - "isShown": true - } - } - }, - "OnboardingController": { - "onboardingTabs": {}, - "seedPhraseBackedUp": false - }, - "PermissionsMetadata": { - "permissionsLog": [ - { - "id": 1764280960, - "method": "eth_requestAccounts", - "methodType": "restricted", - "origin": "http://127.0.0.1:8080", - "request": { - "method": "eth_requestAccounts", - "jsonrpc": "2.0", - "id": 1764280960, - "origin": "http://127.0.0.1:8080", - "tabId": 2 - }, - "requestTime": 1594348329232, - "response": { - "id": 1764280960, - "jsonrpc": "2.0", - "result": ["0x5cfe73b6021e818b776b421b1c4db2474086a7e1"] - }, - "responseTime": 1594348332276, - "success": true - } - ], - "permissionsHistory": { - "http://127.0.0.1:8080": { - "eth_accounts": { - "accounts": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": 1594348332276 - }, - "lastApproved": 1594348332276 - } - } - }, - "domainMetadata": { - "http://127.0.0.1:8080": { - "name": "E2E Test Dapp", - "icon": "http://127.0.0.1:8080/metamask-fox.svg", - "lastUpdated": 1594348323811, - "host": "127.0.0.1:8080" - } - } - }, - "PreferencesController": { - "frequentRpcListDetail": [], - "accountTokens": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": { - "goerli": [], - "sepolia": [] - } - }, - "assetImages": {}, - "tokens": [], - "suggestedTokens": {}, - "useBlockie": false, - "useNonceField": false, - "usePhishDetect": true, - "featureFlags": { - "showIncomingTransactions": true, - "transactionTime": false - }, - "knownMethodData": {}, - "participateInMetaMetrics": false, - "firstTimeFlowType": "create", - "currentLocale": "en", - "identities": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": { - "address": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "name": "Account 1" - } - }, - "lostIdentities": {}, - "forgottenPassword": false, - "preferences": { - "useNativeCurrencyAsPrimaryCurrency": true - }, - "completedOnboarding": true, - "metaMetricsId": null, - "ipfsGateway": "dweb.link", - "selectedAddress": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1" - }, - "config": {}, - "firstTimeInfo": { - "date": 1575697234195, - "version": "7.7.0" - }, - "PermissionsController": { - "permissionsRequests": [], - "permissionsDescriptions": {}, - "domains": { - "http://127.0.0.1:8080": { - "permissions": [ - { - "@context": ["https://github.com/MetaMask/rpc-cap"], - "parentCapability": "eth_accounts", - "id": "f55a1c15-ea48-4088-968e-63be474d42fa", - "date": 1594348332268, - "invoker": "http://127.0.0.1:8080", - "caveats": [ - { - "type": "limitResponseLength", - "value": 1, - "name": "primaryAccountOnly" - }, - { - "type": "filterResponse", - "value": ["0x5cfe73b6021e818b776b421b1c4db2474086a7e1"], - "name": "exposedAccounts" - } - ] - } - ] - } - } - } - }, - "meta": { - "version": 47 - } -} diff --git a/test/e2e/fixtures/custom-rpc/state.json b/test/e2e/fixtures/custom-rpc/state.json deleted file mode 100644 index ef85b1d44..000000000 --- a/test/e2e/fixtures/custom-rpc/state.json +++ /dev/null @@ -1,170 +0,0 @@ -{ - "data": { - "AppStateController": { - "mkrMigrationReminderTimestamp": null, - "showPortfolioTooltip": false - }, - "CachedBalancesController": { - "cachedBalances": { - "4": {} - } - }, - "CurrencyController": { - "conversionDate": 1575697244.188, - "conversionRate": 149.61, - "currentCurrency": "usd", - "nativeCurrency": "ETH" - }, - "IncomingTransactionsController": { - "incomingTransactions": {}, - "incomingTxLastFetchedBlocksByNetwork": { - "goerli": null, - "mainnet": null, - "sepolia": null - } - }, - "KeyringController": { - "vault": "{\"data\":\"s6TpYjlUNsn7ifhEFTkuDGBUM1GyOlPrim7JSjtfIxgTt8/6MiXgiR/CtFfR4dWW2xhq85/NGIBYEeWrZThGdKGarBzeIqBfLFhw9n509jprzJ0zc2Rf+9HVFGLw+xxC4xPxgCS0IIWeAJQ+XtGcHmn0UZXriXm8Ja4kdlow6SWinB7sr/WM3R0+frYs4WgllkwggDf2/Tv6VHygvLnhtzp6hIJFyTjh+l/KnyJTyZW1TkZhDaNDzX3SCOHT\",\"iv\":\"FbeHDAW5afeWNORfNJBR0Q==\",\"salt\":\"TxZ+WbCW6891C9LK/hbMAoUsSEW1E8pyGLVBU6x5KR8=\"}" - }, - "NetworkController": { - "network": "1337", - "provider": { - "nickname": "Localhost 8545", - "rpcUrl": "http://localhost:8545", - "chainId": "0x539", - "ticker": "ETH", - "type": "rpc" - } - }, - "NotificationController": { - "notifications": { - "1": { - "isShown": true - }, - "3": { - "isShown": true - }, - "5": { - "isShown": true - }, - "6": { - "isShown": true - }, - "8": { - "isShown": true - }, - "10": { - "isShown": true - }, - "11": { - "isShown": true - }, - "12": { - "isShown": true - }, - "14": { - "isShown": true - }, - "15": { - "isShown": true - } - } - }, - "OnboardingController": { - "onboardingTabs": {}, - "seedPhraseBackedUp": false - }, - "PermissionsMetadata": { - "domainMetadata": { - "metamask.github.io": { - "icon": null, - "name": "M E T A M A S K M E S H T E S T" - } - }, - "permissionsHistory": {}, - "permissionsLog": [ - { - "id": 746677923, - "method": "eth_accounts", - "methodType": "restricted", - "origin": "metamask.github.io", - "request": { - "id": 746677923, - "jsonrpc": "2.0", - "method": "eth_accounts", - "origin": "metamask.github.io", - "params": [] - }, - "requestTime": 1575697241368, - "response": { - "id": 746677923, - "jsonrpc": "2.0", - "result": [] - }, - "responseTime": 1575697241370, - "success": true - } - ] - }, - "PreferencesController": { - "frequentRpcListDetail": [ - { - "rpcUrl": "http://127.0.0.1:8545/1", - "chainId": "0x539", - "ticker": "ETH", - "nickname": "http://127.0.0.1:8545/1", - "rpcPrefs": {} - }, - { - "rpcUrl": "http://127.0.0.1:8545/2", - "chainId": "0x539", - "ticker": "ETH", - "nickname": "http://127.0.0.1:8545/2", - "rpcPrefs": {} - } - ], - "accountTokens": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": { - "goerli": [], - "sepolia": [] - } - }, - "assetImages": {}, - "completedOnboarding": true, - "currentLocale": "en", - "featureFlags": { - "showIncomingTransactions": true, - "transactionTime": false - }, - "firstTimeFlowType": "create", - "forgottenPassword": false, - "identities": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": { - "address": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "name": "Account 1" - } - }, - "knownMethodData": {}, - "lostIdentities": {}, - "metaMetricsId": null, - "participateInMetaMetrics": false, - "preferences": { - "useNativeCurrencyAsPrimaryCurrency": true - }, - "selectedAddress": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "suggestedTokens": {}, - "tokens": [], - "useBlockie": false, - "useNonceField": false, - "usePhishDetect": true - }, - "config": {}, - "firstTimeInfo": { - "date": 1575697234195, - "version": "7.7.0" - } - }, - "meta": { - "version": 40 - } -} diff --git a/test/e2e/fixtures/custom-token/state.json b/test/e2e/fixtures/custom-token/state.json deleted file mode 100644 index c04eee9d4..000000000 --- a/test/e2e/fixtures/custom-token/state.json +++ /dev/null @@ -1,178 +0,0 @@ -{ - "data": { - "AlertController": { - "alertEnabledness": { - "unconnectedAccount": true, - "web3ShimUsage": true - }, - "unconnectedAccountAlertShownOrigins": {}, - "web3ShimUsageOrigins": {} - }, - "AppStateController": { - "connectedStatusPopoverHasBeenShown": true, - "defaultHomeActiveTabName": null, - "recoveryPhraseReminderHasBeenShown": true, - "recoveryPhraseReminderLastShown": "__FIXTURE_SUBSTITUTION__currentDateInMilliseconds", - "showPortfolioTooltip": false - }, - "CachedBalancesController": { - "cachedBalances": { - "0x5": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": "0x0" - } - } - }, - "CurrencyController": { - "conversionDate": 1626907353.891, - "conversionRate": 1968.5, - "currentCurrency": "usd", - "nativeCurrency": "ETH", - "pendingCurrentCurrency": null, - "pendingNativeCurrency": null, - "usdConversionRate": 1968.5 - }, - "IncomingTransactionsController": { - "incomingTransactions": {}, - "incomingTxLastFetchedBlockByChainId": { - "0x1": null, - "0x5": 8977934 - } - }, - "KeyringController": { - "vault": "{\"data\":\"s6TpYjlUNsn7ifhEFTkuDGBUM1GyOlPrim7JSjtfIxgTt8/6MiXgiR/CtFfR4dWW2xhq85/NGIBYEeWrZThGdKGarBzeIqBfLFhw9n509jprzJ0zc2Rf+9HVFGLw+xxC4xPxgCS0IIWeAJQ+XtGcHmn0UZXriXm8Ja4kdlow6SWinB7sr/WM3R0+frYs4WgllkwggDf2/Tv6VHygvLnhtzp6hIJFyTjh+l/KnyJTyZW1TkZhDaNDzX3SCOHT\",\"iv\":\"FbeHDAW5afeWNORfNJBR0Q==\",\"salt\":\"TxZ+WbCW6891C9LK/hbMAoUsSEW1E8pyGLVBU6x5KR8=\"}" - }, - "MetaMetricsController": { - "metaMetricsId": "0xff3e952b9f5a27ffcab42b0b4abf689e77dcc1f9f441871dc962d622b089fb51", - "participateInMetaMetrics": true - }, - "NetworkController": { - "network": "1337", - "networkDetails": { - "EIPS": {} - }, - "previousProviderStore": { - "chainId": "0x5", - "ticker": "ETH", - "type": "goerli" - }, - "provider": { - "chainId": "0x539", - "nickname": "Localhost 8545", - "rpcPrefs": {}, - "rpcUrl": "http://localhost:8545", - "ticker": "ETH", - "type": "rpc" - } - }, - "NotificationController": { - "notifications": { - "8": { - "isShown": true - }, - "10": { - "isShown": true - }, - "11": { - "isShown": true - }, - "12": { - "isShown": true - }, - "14": { - "isShown": true - }, - "15": { - "isShown": true - } - } - }, - "OnboardingController": { - "onboardingTabs": {}, - "seedPhraseBackedUp": true - }, - "PermissionsController": { - "domains": {}, - "permissionsDescriptions": {}, - "permissionsRequests": [] - }, - "PreferencesController": { - "completedOnboarding": true, - "currentLocale": "en", - "dismissSeedBackUpReminder": true, - "featureFlags": { - "showIncomingTransactions": true - }, - "firstTimeFlowType": "import", - "forgottenPassword": false, - "frequentRpcListDetail": [ - { - "chainId": "0x539", - "nickname": "Localhost 8545", - "rpcPrefs": {}, - "rpcUrl": "http://localhost:8545", - "ticker": "ETH" - } - ], - "identities": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": { - "address": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "lastSelected": 1626907346643, - "name": "Account 1" - } - }, - "infuraBlocked": false, - "ipfsGateway": "dweb.link", - "knownMethodData": {}, - "lostIdentities": {}, - "preferences": { - "hideZeroBalanceTokens": false, - "showFiatInTestnets": false, - "useNativeCurrencyAsPrimaryCurrency": true - }, - "selectedAddress": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "useBlockie": false, - "useLedgerLive": false, - "useNonceField": false, - "usePhishDetect": true, - "useStaticTokenList": false - }, - "TokensController": { - "allTokens": { - "0x539": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": [ - { - "address": "0x86002be4cdd922de1ccb831582bf99284b99ac12", - "decimals": 4, - "image": null, - "isERC721": false, - "symbol": "TST" - } - ] - } - }, - "ignoredTokens": [], - "suggestedAssets": [], - "allIgnoredTokens": {}, - "tokens": [ - { - "address": "0x86002be4cdd922de1ccb831582bf99284b99ac12", - "decimals": 4, - "image": null, - "isERC721": false, - "symbol": "TST" - } - ] - }, - "TransactionController": { - "transactions": {} - }, - "config": {}, - "firstTimeInfo": { - "date": 1626907328205, - "version": "9.8.1" - } - }, - "meta": { - "version": 63 - } -} diff --git a/test/e2e/fixtures/eip-1559-v2-dapp/state.json b/test/e2e/fixtures/eip-1559-v2-dapp/state.json deleted file mode 100644 index 4a2effda3..000000000 --- a/test/e2e/fixtures/eip-1559-v2-dapp/state.json +++ /dev/null @@ -1,160 +0,0 @@ -{ - "data": { - "AppStateController": { - "mkrMigrationReminderTimestamp": null, - "swapsWelcomeMessageHasBeenShown": true, - "showPortfolioTooltip": false - }, - "CachedBalancesController": { - "cachedBalances": { - "4": {} - } - }, - "CurrencyController": { - "conversionDate": 1575697244.188, - "conversionRate": 149.61, - "currentCurrency": "usd", - "nativeCurrency": "ETH" - }, - "IncomingTransactionsController": { - "incomingTransactions": {}, - "incomingTxLastFetchedBlocksByNetwork": { - "goerli": null, - "mainnet": null, - "sepolia": null - } - }, - "KeyringController": { - "vault": "{\"data\":\"s6TpYjlUNsn7ifhEFTkuDGBUM1GyOlPrim7JSjtfIxgTt8/6MiXgiR/CtFfR4dWW2xhq85/NGIBYEeWrZThGdKGarBzeIqBfLFhw9n509jprzJ0zc2Rf+9HVFGLw+xxC4xPxgCS0IIWeAJQ+XtGcHmn0UZXriXm8Ja4kdlow6SWinB7sr/WM3R0+frYs4WgllkwggDf2/Tv6VHygvLnhtzp6hIJFyTjh+l/KnyJTyZW1TkZhDaNDzX3SCOHT\",\"iv\":\"FbeHDAW5afeWNORfNJBR0Q==\",\"salt\":\"TxZ+WbCW6891C9LK/hbMAoUsSEW1E8pyGLVBU6x5KR8=\"}" - }, - "NetworkController": { - "network": "1337", - "provider": { - "nickname": "Localhost 8545", - "rpcUrl": "http://localhost:8545", - "chainId": "0x539", - "ticker": "ETH", - "type": "rpc" - } - }, - "NotificationController": { - "notifications": { - "1": { - "isShown": true - }, - "3": { - "isShown": true - }, - "5": { - "isShown": true - }, - "6": { - "isShown": true - }, - "8": { - "isShown": true - }, - "10": { - "isShown": true - }, - "11": { - "isShown": true - }, - "12": { - "isShown": true - }, - "14": { - "isShown": true - }, - "15": { - "isShown": true - } - } - }, - "OnboardingController": { - "onboardingTabs": {}, - "seedPhraseBackedUp": false - }, - "PermissionsMetadata": { - "domainMetadata": { - "metamask.github.io": { - "icon": null, - "name": "M E T A M A S K M E S H T E S T" - } - }, - "permissionsHistory": {}, - "permissionsLog": [ - { - "id": 746677923, - "method": "eth_accounts", - "methodType": "restricted", - "origin": "metamask.github.io", - "request": { - "id": 746677923, - "jsonrpc": "2.0", - "method": "eth_accounts", - "origin": "metamask.github.io", - "params": [] - }, - "requestTime": 1575697241368, - "response": { - "id": 746677923, - "jsonrpc": "2.0", - "result": [] - }, - "responseTime": 1575697241370, - "success": true - } - ] - }, - "PreferencesController": { - "accountTokens": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": { - "goerli": [], - "sepolia": [] - } - }, - "assetImages": {}, - "completedOnboarding": true, - "eip1559V2Enabled": true, - "currentLocale": "en", - "featureFlags": { - "showIncomingTransactions": true, - "transactionTime": false - }, - "firstTimeFlowType": "create", - "forgottenPassword": false, - "frequentRpcListDetail": [], - "identities": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": { - "address": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "name": "Account 1" - } - }, - "knownMethodData": {}, - "lostIdentities": {}, - "metaMetricsId": null, - "participateInMetaMetrics": false, - "preferences": { - "useNativeCurrencyAsPrimaryCurrency": true - }, - "selectedAddress": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "suggestedTokens": {}, - "tokens": [], - "useBlockie": false, - "useNonceField": false, - "usePhishDetect": true - }, - "TransactionController": { - "transactions": {} - }, - "config": {}, - "firstTimeInfo": { - "date": 1575697234195, - "version": "7.7.0" - } - }, - "meta": { - "version": 40 - } -} diff --git a/test/e2e/fixtures/eip-1559-v2/state.json b/test/e2e/fixtures/eip-1559-v2/state.json deleted file mode 100644 index 1777bbf9f..000000000 --- a/test/e2e/fixtures/eip-1559-v2/state.json +++ /dev/null @@ -1,229 +0,0 @@ -{ - "data": { - "AppStateController": { - "mkrMigrationReminderTimestamp": null, - "swapsWelcomeMessageHasBeenShown": true, - "showPortfolioTooltip": false - }, - "CachedBalancesController": { - "cachedBalances": { - "4": {} - } - }, - "CurrencyController": { - "conversionDate": 1575697244.188, - "conversionRate": 149.61, - "currentCurrency": "usd", - "nativeCurrency": "ETH" - }, - "IncomingTransactionsController": { - "incomingTransactions": {}, - "incomingTxLastFetchedBlocksByNetwork": { - "goerli": null, - "mainnet": null, - "sepolia": null - } - }, - "KeyringController": { - "vault": "{\"data\":\"s6TpYjlUNsn7ifhEFTkuDGBUM1GyOlPrim7JSjtfIxgTt8/6MiXgiR/CtFfR4dWW2xhq85/NGIBYEeWrZThGdKGarBzeIqBfLFhw9n509jprzJ0zc2Rf+9HVFGLw+xxC4xPxgCS0IIWeAJQ+XtGcHmn0UZXriXm8Ja4kdlow6SWinB7sr/WM3R0+frYs4WgllkwggDf2/Tv6VHygvLnhtzp6hIJFyTjh+l/KnyJTyZW1TkZhDaNDzX3SCOHT\",\"iv\":\"FbeHDAW5afeWNORfNJBR0Q==\",\"salt\":\"TxZ+WbCW6891C9LK/hbMAoUsSEW1E8pyGLVBU6x5KR8=\"}" - }, - "NetworkController": { - "network": "1337", - "provider": { - "nickname": "Localhost 8545", - "rpcUrl": "http://localhost:8545", - "chainId": "0x539", - "ticker": "ETH", - "type": "rpc" - } - }, - "NotificationController": { - "notifications": { - "1": { - "isShown": true - }, - "3": { - "isShown": true - }, - "5": { - "isShown": true - }, - "6": { - "isShown": true - }, - "8": { - "isShown": true - }, - "10": { - "isShown": true - }, - "11": { - "isShown": true - }, - "12": { - "isShown": true - }, - "14": { - "isShown": true - }, - "15": { - "isShown": true - } - } - }, - "OnboardingController": { - "onboardingTabs": {}, - "seedPhraseBackedUp": false - }, - "PermissionsMetadata": { - "domainMetadata": { - "metamask.github.io": { - "icon": null, - "name": "M E T A M A S K M E S H T E S T" - } - }, - "permissionsHistory": {}, - "permissionsLog": [ - { - "id": 746677923, - "method": "eth_accounts", - "methodType": "restricted", - "origin": "metamask.github.io", - "request": { - "id": 746677923, - "jsonrpc": "2.0", - "method": "eth_accounts", - "origin": "metamask.github.io", - "params": [] - }, - "requestTime": 1575697241368, - "response": { - "id": 746677923, - "jsonrpc": "2.0", - "result": [] - }, - "responseTime": 1575697241370, - "success": true - } - ] - }, - "PreferencesController": { - "accountTokens": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": { - "goerli": [], - "sepolia": [] - } - }, - "assetImages": {}, - "completedOnboarding": true, - "eip1559V2Enabled": true, - "currentLocale": "en", - "featureFlags": { - "showIncomingTransactions": true, - "transactionTime": false - }, - "firstTimeFlowType": "create", - "forgottenPassword": false, - "frequentRpcListDetail": [], - "identities": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": { - "address": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "name": "Account 1" - } - }, - "knownMethodData": {}, - "lostIdentities": {}, - "metaMetricsId": null, - "participateInMetaMetrics": false, - "preferences": { - "useNativeCurrencyAsPrimaryCurrency": true - }, - "selectedAddress": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "suggestedTokens": {}, - "tokens": [], - "useBlockie": false, - "useNonceField": false, - "usePhishDetect": true - }, - "TransactionController": { - "transactions": { - "4046084157914634": { - "chainId": "0x539", - "primaryTransaction": { - "chainId": "0x539", - "id": 4046084157914634, - "loadingDefaults": true, - "metamaskNetworkId": "1337", - "origin": "metamask", - "status": "unapproved", - "time": 1617228030067, - "txParams": { - "from": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "gas": "0x61a8", - "maxFeePerGas": "0x59682f0c", - "maxPriorityFeePerGas": "0x59682f00", - "type": "0x2", - "to": "0x2f318C334780961FB129D2a6c30D0763d9a5C970", - "value": "0x1e87F85809dc0000" - }, - "type": "sentEther" - }, - "history": [ - { - "chainId": "0x539", - "id": 4046084157914634, - "loadingDefaults": true, - "metamaskNetworkId": "1337", - "origin": "metamask", - "status": "unapproved", - "time": 1617228030067, - "txParams": { - "from": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "gas": "0x61a8", - "maxFeePerGas": "0x59682f0c", - "maxPriorityFeePerGas": "0x59682f00", - "type": "0x2", - "to": "0x2f318C334780961FB129D2a6c30D0763d9a5C970", - "value": "0x1e87F85809dc0000" - }, - "type": "simpleSend" - }, - [ - { - "note": "Added new unapproved transaction.", - "op": "replace", - "path": "/loadingDefaults", - "timestamp": 1617228030069, - "value": false - } - ] - ], - "id": 4046084157914634, - "loadingDefaults": false, - "metamaskNetworkId": "1337", - "origin": "metamask", - "status": "unapproved", - "time": 1617228030067, - "txParams": { - "from": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "gas": "0x61a8", - "maxFeePerGas": "0x59682f0c", - "maxPriorityFeePerGas": "0x59682f00", - "type": "0x2", - "to": "0x2f318C334780961FB129D2a6c30D0763d9a5C970", - "value": "0x1e87F85809dc0000" - }, - "type": "simpleSend" - } - } - }, - "config": {}, - "firstTimeInfo": { - "date": 1575697234195, - "version": "7.7.0" - } - }, - "meta": { - "version": 40 - } -} diff --git a/test/e2e/fixtures/import-ui/state.json b/test/e2e/fixtures/import-ui/state.json deleted file mode 100644 index a055509ce..000000000 --- a/test/e2e/fixtures/import-ui/state.json +++ /dev/null @@ -1,272 +0,0 @@ -{ - "data": { - "config": {}, - "PreferencesController": { - "frequentRpcListDetail": [ - { - "rpcUrl": "http://localhost:8545", - "chainId": "0x539", - "ticker": "ETH", - "nickname": "Localhost 8545", - "rpcPrefs": {} - } - ], - "accountTokens": { - "0x0cc5261ab8ce458dc977078a3623e2badd27afd3": { - "0x539": [] - }, - "0x3ed0ee22e0685ebbf07b2360a8331693c413cc59": {}, - "0xd38d853771fb546bd8b18b2f3638491bc0b0e906": { - "0x539": [] - } - }, - "accountHiddenTokens": { - "0x0cc5261ab8ce458dc977078a3623e2badd27afd3": { - "0x539": [] - }, - "0x3ed0ee22e0685ebbf07b2360a8331693c413cc59": {}, - "0xd38d853771fb546bd8b18b2f3638491bc0b0e906": { - "0x539": [] - } - }, - "assetImages": {}, - "tokens": [], - "hiddenTokens": [], - "suggestedTokens": {}, - "useBlockie": false, - "useNonceField": false, - "usePhishDetect": true, - "featureFlags": { - "showIncomingTransactions": true - }, - "knownMethodData": {}, - "firstTimeFlowType": "import", - "currentLocale": "en", - "identities": { - "0x0cc5261ab8ce458dc977078a3623e2badd27afd3": { - "name": "Account 1", - "address": "0x0cc5261ab8ce458dc977078a3623e2badd27afd3", - "lastSelected": 1618940443499 - }, - "0x3ed0ee22e0685ebbf07b2360a8331693c413cc59": { - "name": "Account 2", - "address": "0x3ed0ee22e0685ebbf07b2360a8331693c413cc59" - }, - "0xd38d853771fb546bd8b18b2f3638491bc0b0e906": { - "name": "2nd account", - "address": "0xd38d853771fb546bd8b18b2f3638491bc0b0e906", - "lastSelected": 1618940443010 - } - }, - "lostIdentities": {}, - "forgottenPassword": false, - "preferences": { - "showFiatInTestnets": false, - "useNativeCurrencyAsPrimaryCurrency": true, - "hideZeroBalanceTokens": false - }, - "completedOnboarding": true, - "ipfsGateway": "dweb.link", - "infuraBlocked": false, - "selectedAddress": "0x0cc5261ab8ce458dc977078a3623e2badd27afd3" - }, - "firstTimeInfo": { - "version": "9.3.0", - "date": 1617927806790 - }, - "NetworkController": { - "provider": { - "ticker": "ETH", - "type": "rpc", - "rpcUrl": "http://localhost:8545", - "chainId": "0x539", - "nickname": "Localhost 8545" - }, - "previousProviderStore": { - "ticker": "ETH", - "type": "rpc", - "rpcUrl": "http://localhost:8545", - "chainId": "0x539", - "nickname": "Localhost 8545" - }, - "network": "1337" - }, - "NotificationController": { - "notifications": { - "1": { - "isShown": true - }, - "3": { - "isShown": true - }, - "5": { - "isShown": true - }, - "6": { - "isShown": true - }, - "8": { - "isShown": true - }, - "10": { - "isShown": true - }, - "11": { - "isShown": true - }, - "12": { - "isShown": true - }, - "14": { - "isShown": true - }, - "15": { - "isShown": true - } - } - }, - "CurrencyController": { - "conversionDate": 1618940438.187, - "conversionRate": 2254.54, - "currentCurrency": "usd", - "nativeCurrency": "ETH", - "usdConversionRate": 2254.54 - }, - "CachedBalancesController": { - "cachedBalances": { - "0x539": { - "0x0cc5261ab8ce458dc977078a3623e2badd27afd3": "0x14cffbeaf5a7d3000", - "0x3ed0ee22e0685ebbf07b2360a8331693c413cc59": "0x0", - "0xd38d853771fb546bd8b18b2f3638491bc0b0e906": "0x0" - } - } - }, - "MetaMetricsController": { - "participateInMetaMetrics": false, - "metaMetricsId": null - }, - "PermissionsController": { - "permissionsRequests": [], - "permissionsDescriptions": {}, - "domains": {} - }, - "TransactionController": { - "transactions": { - "1374812123920442": { - "id": 1374812123920442, - "time": 1618940444708, - "status": "confirmed", - "metamaskNetworkId": "1337", - "chainId": "0x539", - "loadingDefaults": false, - "txParams": { - "from": "0x0cc5261ab8ce458dc977078a3623e2badd27afd3", - "to": "0x2f318c334780961fb129d2a6c30d0763d9a5c970", - "nonce": "0x0", - "value": "0xde0b6b3a7640000", - "gas": "0x5208", - "gasPrice": "0x363fe1da00" - }, - "origin": "metamask", - "type": "simpleSend", - "history": [], - "nonceDetails": { - "params": { - "highestLocallyConfirmed": 0, - "highestSuggested": 0, - "nextNetworkNonce": 0 - }, - "local": { - "name": "local", - "nonce": 0, - "details": { - "startPoint": 0, - "highest": 0 - } - }, - "network": { - "name": "network", - "nonce": 0, - "details": { - "blockNumber": "0x5", - "baseCount": 0 - } - } - }, - "r": "0x035de1d588f67547bd9c7bb9b34a8330c10085155e42af0017986911ca922e61", - "s": "0x36c3c12a323121afe6d63bc8c5929766d385e2e7b7fc892ecd0f10a7ec4ab59e", - "v": "0x0a95", - "rawTx": "0xf86e8085363fe1da00825208942f318c334780961fb129d2a6c30d0763d9a5c970880de0b6b3a764000080820a95a0035de1d588f67547bd9c7bb9b34a8330c10085155e42af0017986911ca922e61a036c3c12a323121afe6d63bc8c5929766d385e2e7b7fc892ecd0f10a7ec4ab59e", - "hash": "0xaba403a1dff459d7549b57369cfdd323c70fc79a307ed8f9cae811ddd6883a74", - "submittedTime": 1618940445208, - "txReceipt": { - "transactionHash": "0xaba403a1dff459d7549b57369cfdd323c70fc79a307ed8f9cae811ddd6883a74", - "transactionIndex": { - "negative": 0, - "words": [0, null], - "length": 1, - "red": null - }, - "blockHash": "0x734618e63369e7ea10872e68cec4d400d77c55ed525cbc295802d00d7b4bd1d2", - "blockNumber": { - "negative": 0, - "words": [6, null], - "length": 1, - "red": null - }, - "from": "0x0cc5261ab8ce458dc977078a3623e2badd27afd3", - "to": "0x2f318c334780961fb129d2a6c30d0763d9a5c970", - "gasUsed": "5208", - "cumulativeGasUsed": { - "negative": 0, - "words": [21000, null], - "length": 1, - "red": null - }, - "contractAddress": null, - "logs": [], - "status": "0x1", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" - } - } - } - }, - "KeyringController": { - "vault": "{\"data\":\"Ot+BTtJPag0xubdiv1nO9bsSvTHivHCd6CD7Lxgb1McYw3VqMjgp5rPMZmblJ1lscuMxyiqp99G52uXO9S0em6F9htpa+t/wn6qubRKTTNG9fxNzQrKXRDNhdgfYckVk5VAZ4fgl2iMZcRDvS8H/+gucVKJ33Sl6mXyPofdexXhWDCU6uR2YecnfaIum9cL2u/GqOMPE3jxzy0Wip0x2Jyp3QOKhvu8A3GIjzagLOaQ7a1APdl8=\",\"iv\":\"lbsyPeGYWU6U1+jvmW9UHg==\",\"salt\":\"Zmbhpskwxe4rYfXtELBvlcvW4HISPBATRmMqzsnZPMg=\"}" - }, - "AlertController": { - "alertEnabledness": { - "unconnectedAccount": true, - "web3ShimUsage": true - }, - "unconnectedAccountAlertShownOrigins": {}, - "web3ShimUsageOrigins": {} - }, - "OnboardingController": { - "seedPhraseBackedUp": true, - "onboardingTabs": {} - }, - "AddressBookController": { - "addressBook": { - "0x539": { - "0x2f318C334780961FB129D2a6c30D0763d9a5C970": { - "address": "0x2f318C334780961FB129D2a6c30D0763d9a5C970", - "chainId": "0x539", - "isEns": false, - "memo": "", - "name": "" - } - } - } - }, - "AppStateController": { - "connectedStatusPopoverHasBeenShown": true, - "swapsWelcomeMessageHasBeenShown": false, - "defaultHomeActiveTabName": "Activity", - "showPortfolioTooltip": false - } - }, - "meta": { - "version": 57 - } -} diff --git a/test/e2e/fixtures/imported-account/state.json b/test/e2e/fixtures/imported-account/state.json deleted file mode 100644 index ebe94144b..000000000 --- a/test/e2e/fixtures/imported-account/state.json +++ /dev/null @@ -1,157 +0,0 @@ -{ - "data": { - "AppStateController": { - "mkrMigrationReminderTimestamp": null, - "showPortfolioTooltip": false - }, - "CachedBalancesController": { - "cachedBalances": { - "4": {} - } - }, - "CurrencyController": { - "conversionDate": 1575697244.188, - "conversionRate": 149.61, - "currentCurrency": "usd", - "nativeCurrency": "ETH" - }, - "IncomingTransactionsController": { - "incomingTransactions": {}, - "incomingTxLastFetchedBlocksByNetwork": { - "goerli": null, - "mainnet": null, - "sepolia": null - } - }, - "KeyringController": { - "vault": "{\"data\":\"s6TpYjlUNsn7ifhEFTkuDGBUM1GyOlPrim7JSjtfIxgTt8/6MiXgiR/CtFfR4dWW2xhq85/NGIBYEeWrZThGdKGarBzeIqBfLFhw9n509jprzJ0zc2Rf+9HVFGLw+xxC4xPxgCS0IIWeAJQ+XtGcHmn0UZXriXm8Ja4kdlow6SWinB7sr/WM3R0+frYs4WgllkwggDf2/Tv6VHygvLnhtzp6hIJFyTjh+l/KnyJTyZW1TkZhDaNDzX3SCOHT\",\"iv\":\"FbeHDAW5afeWNORfNJBR0Q==\",\"salt\":\"TxZ+WbCW6891C9LK/hbMAoUsSEW1E8pyGLVBU6x5KR8=\"}" - }, - "NetworkController": { - "network": "1337", - "provider": { - "nickname": "Localhost 8545", - "rpcUrl": "http://localhost:8545", - "chainId": "0x539", - "ticker": "ETH", - "type": "rpc" - } - }, - "NotificationController": { - "notifications": { - "1": { - "isShown": true - }, - "3": { - "isShown": true - }, - "5": { - "isShown": true - }, - "6": { - "isShown": true - }, - "8": { - "isShown": true - }, - "10": { - "isShown": true - }, - "11": { - "isShown": true - }, - "12": { - "isShown": true - }, - "14": { - "isShown": true - }, - "15": { - "isShown": true - } - } - }, - "OnboardingController": { - "onboardingTabs": {}, - "seedPhraseBackedUp": false - }, - "PermissionsMetadata": { - "domainMetadata": { - "metamask.github.io": { - "icon": null, - "name": "M E T A M A S K M E S H T E S T" - } - }, - "permissionsHistory": {}, - "permissionsLog": [ - { - "id": 746677923, - "method": "eth_accounts", - "methodType": "restricted", - "origin": "metamask.github.io", - "request": { - "id": 746677923, - "jsonrpc": "2.0", - "method": "eth_accounts", - "origin": "metamask.github.io", - "params": [] - }, - "requestTime": 1575697241368, - "response": { - "id": 746677923, - "jsonrpc": "2.0", - "result": [] - }, - "responseTime": 1575697241370, - "success": true - } - ] - }, - "PreferencesController": { - "accountTokens": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": { - "goerli": [], - "sepolia": [] - } - }, - "assetImages": {}, - "completedOnboarding": true, - "dismissSeedBackUpReminder": true, - "currentLocale": "en", - "featureFlags": { - "showIncomingTransactions": true, - "transactionTime": false - }, - "firstTimeFlowType": "create", - "forgottenPassword": false, - "frequentRpcListDetail": [], - "identities": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": { - "address": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "name": "Account 1" - } - }, - "knownMethodData": {}, - "lostIdentities": {}, - "metaMetricsId": null, - "participateInMetaMetrics": false, - "preferences": { - "useNativeCurrencyAsPrimaryCurrency": true - }, - "selectedAddress": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "suggestedTokens": {}, - "tokens": [], - "useBlockie": false, - "useNonceField": false, - "usePhishDetect": true, - "useTokenDetection": true - }, - "config": {}, - "firstTimeInfo": { - "date": 1575697234195, - "version": "7.7.0" - } - }, - "meta": { - "version": 40 - } -} diff --git a/test/e2e/fixtures/localization/state.json b/test/e2e/fixtures/localization/state.json deleted file mode 100644 index d4c04bb0e..000000000 --- a/test/e2e/fixtures/localization/state.json +++ /dev/null @@ -1,156 +0,0 @@ -{ - "data": { - "AppStateController": { - "mkrMigrationReminderTimestamp": null, - "showPortfolioTooltip": false - }, - "CachedBalancesController": { - "cachedBalances": { - "4": {} - } - }, - "CurrencyController": { - "conversionDate": 1594323667.203, - "conversionRate": 14205.88, - "currentCurrency": "php", - "nativeCurrency": "ETH" - }, - "IncomingTransactionsController": { - "incomingTransactions": {}, - "incomingTxLastFetchedBlocksByNetwork": { - "goerli": null, - "mainnet": null, - "sepolia": null - } - }, - "KeyringController": { - "vault": "{\"data\":\"s6TpYjlUNsn7ifhEFTkuDGBUM1GyOlPrim7JSjtfIxgTt8/6MiXgiR/CtFfR4dWW2xhq85/NGIBYEeWrZThGdKGarBzeIqBfLFhw9n509jprzJ0zc2Rf+9HVFGLw+xxC4xPxgCS0IIWeAJQ+XtGcHmn0UZXriXm8Ja4kdlow6SWinB7sr/WM3R0+frYs4WgllkwggDf2/Tv6VHygvLnhtzp6hIJFyTjh+l/KnyJTyZW1TkZhDaNDzX3SCOHT\",\"iv\":\"FbeHDAW5afeWNORfNJBR0Q==\",\"salt\":\"TxZ+WbCW6891C9LK/hbMAoUsSEW1E8pyGLVBU6x5KR8=\"}" - }, - "NetworkController": { - "network": "1337", - "provider": { - "nickname": "Localhost 8545", - "rpcUrl": "http://localhost:8545", - "chainId": "0x539", - "ticker": "ETH", - "type": "rpc" - } - }, - "NotificationController": { - "notifications": { - "1": { - "isShown": true - }, - "3": { - "isShown": true - }, - "5": { - "isShown": true - }, - "6": { - "isShown": true - }, - "8": { - "isShown": true - }, - "10": { - "isShown": true - }, - "11": { - "isShown": true - }, - "12": { - "isShown": true - }, - "14": { - "isShown": true - }, - "15": { - "isShown": true - } - } - }, - "OnboardingController": { - "onboardingTabs": {}, - "seedPhraseBackedUp": false - }, - "PermissionsMetadata": { - "domainMetadata": { - "metamask.github.io": { - "icon": null, - "name": "M E T A M A S K M E S H T E S T" - } - }, - "permissionsHistory": {}, - "permissionsLog": [ - { - "id": 746677923, - "method": "eth_accounts", - "methodType": "restricted", - "origin": "metamask.github.io", - "request": { - "id": 746677923, - "jsonrpc": "2.0", - "method": "eth_accounts", - "origin": "metamask.github.io", - "params": [] - }, - "requestTime": 1575697241368, - "response": { - "id": 746677923, - "jsonrpc": "2.0", - "result": [] - }, - "responseTime": 1575697241370, - "success": true - } - ] - }, - "PreferencesController": { - "accountTokens": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": { - "goerli": [], - "sepolia": [] - } - }, - "assetImages": {}, - "completedOnboarding": true, - "currentLocale": "en", - "featureFlags": { - "showIncomingTransactions": true, - "transactionTime": false - }, - "firstTimeFlowType": "create", - "forgottenPassword": false, - "frequentRpcListDetail": [], - "identities": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": { - "address": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "name": "Account 1" - } - }, - "knownMethodData": {}, - "lostIdentities": {}, - "metaMetricsId": null, - "participateInMetaMetrics": false, - "preferences": { - "showFiatInTestnets": true, - "useNativeCurrencyAsPrimaryCurrency": true - }, - "selectedAddress": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "suggestedTokens": {}, - "tokens": [], - "useBlockie": false, - "useNonceField": false, - "usePhishDetect": true - }, - "config": {}, - "firstTimeInfo": { - "date": 1575697234195, - "version": "7.7.0" - } - }, - "meta": { - "version": 40 - } -} diff --git a/test/e2e/fixtures/metrics-enabled/state.json b/test/e2e/fixtures/metrics-enabled/state.json deleted file mode 100644 index bf8dae606..000000000 --- a/test/e2e/fixtures/metrics-enabled/state.json +++ /dev/null @@ -1,200 +0,0 @@ -{ - "data": { - "AppStateController": { - "connectedStatusPopoverHasBeenShown": false, - "showPortfolioTooltip": false - }, - "CachedBalancesController": { - "cachedBalances": { - "4": {}, - "1337": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": "0x15af1d78b58c40000" - } - } - }, - "CurrencyController": { - "conversionDate": 1594348502.519, - "conversionRate": 240.09, - "currentCurrency": "usd", - "nativeCurrency": "ETH" - }, - "IncomingTransactionsController": { - "incomingTransactions": {}, - "incomingTxLastFetchedBlocksByNetwork": { - "goerli": null, - "mainnet": null, - "sepolia": null, - "localhost": 98 - } - }, - "KeyringController": { - "vault": "{\"data\":\"s6TpYjlUNsn7ifhEFTkuDGBUM1GyOlPrim7JSjtfIxgTt8/6MiXgiR/CtFfR4dWW2xhq85/NGIBYEeWrZThGdKGarBzeIqBfLFhw9n509jprzJ0zc2Rf+9HVFGLw+xxC4xPxgCS0IIWeAJQ+XtGcHmn0UZXriXm8Ja4kdlow6SWinB7sr/WM3R0+frYs4WgllkwggDf2/Tv6VHygvLnhtzp6hIJFyTjh+l/KnyJTyZW1TkZhDaNDzX3SCOHT\",\"iv\":\"FbeHDAW5afeWNORfNJBR0Q==\",\"salt\":\"TxZ+WbCW6891C9LK/hbMAoUsSEW1E8pyGLVBU6x5KR8=\"}" - }, - "NetworkController": { - "provider": { - "nickname": "Localhost 8545", - "rpcUrl": "http://localhost:8545", - "chainId": "0x539", - "ticker": "ETH", - "type": "rpc" - }, - "network": "1337" - }, - "NotificationController": { - "notifications": { - "1": { - "isShown": true - }, - "3": { - "isShown": true - }, - "5": { - "isShown": true - }, - "6": { - "isShown": true - }, - "8": { - "isShown": true - }, - "10": { - "isShown": true - }, - "11": { - "isShown": true - }, - "12": { - "isShown": true - }, - "14": { - "isShown": true - }, - "15": { - "isShown": true - } - } - }, - "OnboardingController": { - "onboardingTabs": {}, - "seedPhraseBackedUp": false - }, - "PermissionsMetadata": { - "permissionsLog": [ - { - "id": 1764280960, - "method": "eth_requestAccounts", - "methodType": "restricted", - "origin": "http://127.0.0.1:8080", - "request": { - "method": "eth_requestAccounts", - "jsonrpc": "2.0", - "id": 1764280960, - "origin": "http://127.0.0.1:8080", - "tabId": 2 - }, - "requestTime": 1594348329232, - "response": { - "id": 1764280960, - "jsonrpc": "2.0", - "result": ["0x5cfe73b6021e818b776b421b1c4db2474086a7e1"] - }, - "responseTime": 1594348332276, - "success": true - } - ], - "permissionsHistory": { - "http://127.0.0.1:8080": { - "eth_accounts": { - "accounts": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": 1594348332276 - }, - "lastApproved": 1594348332276 - } - } - }, - "domainMetadata": { - "http://127.0.0.1:8080": { - "name": "E2E Test Dapp", - "icon": "http://127.0.0.1:8080/metamask-fox.svg", - "lastUpdated": 1594348323811, - "host": "127.0.0.1:8080" - } - } - }, - "PreferencesController": { - "frequentRpcListDetail": [], - "accountTokens": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": { - "goerli": [], - "sepolia": [] - } - }, - "assetImages": {}, - "tokens": [], - "suggestedTokens": {}, - "useBlockie": false, - "useNonceField": false, - "usePhishDetect": true, - "featureFlags": { - "showIncomingTransactions": true, - "transactionTime": false - }, - "knownMethodData": {}, - "participateInMetaMetrics": true, - "firstTimeFlowType": "create", - "currentLocale": "en", - "identities": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": { - "address": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "name": "Account 1" - } - }, - "lostIdentities": {}, - "forgottenPassword": false, - "preferences": { - "useNativeCurrencyAsPrimaryCurrency": true - }, - "completedOnboarding": true, - "metaMetricsId": "fake-metrics-id", - "ipfsGateway": "dweb.link", - "selectedAddress": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1" - }, - "config": {}, - "firstTimeInfo": { - "date": 1575697234195, - "version": "7.7.0" - }, - "PermissionsController": { - "permissionsRequests": [], - "permissionsDescriptions": {}, - "domains": { - "http://127.0.0.1:8080": { - "permissions": [ - { - "@context": ["https://github.com/MetaMask/rpc-cap"], - "parentCapability": "eth_accounts", - "id": "f55a1c15-ea48-4088-968e-63be474d42fa", - "date": 1594348332268, - "invoker": "http://127.0.0.1:8080", - "caveats": [ - { - "type": "limitResponseLength", - "value": 1, - "name": "primaryAccountOnly" - }, - { - "type": "filterResponse", - "value": ["0x5cfe73b6021e818b776b421b1c4db2474086a7e1"], - "name": "exposedAccounts" - } - ] - } - ] - } - } - } - }, - "meta": { - "version": 47 - } -} diff --git a/test/e2e/fixtures/navigate-transactions/state.json b/test/e2e/fixtures/navigate-transactions/state.json deleted file mode 100644 index ab741e601..000000000 --- a/test/e2e/fixtures/navigate-transactions/state.json +++ /dev/null @@ -1,442 +0,0 @@ -{ - "data": { - "AppStateController": { - "mkrMigrationReminderTimestamp": null, - "showPortfolioTooltip": false - }, - "CachedBalancesController": { - "cachedBalances": { - "4": {} - } - }, - "CurrencyController": { - "conversionDate": 1575697244.188, - "conversionRate": 149.61, - "currentCurrency": "usd", - "nativeCurrency": "ETH" - }, - "IncomingTransactionsController": { - "incomingTransactions": {}, - "incomingTxLastFetchedBlocksByNetwork": { - "goerli": null, - "mainnet": null, - "sepolia": null - } - }, - "KeyringController": { - "vault": "{\"data\":\"s6TpYjlUNsn7ifhEFTkuDGBUM1GyOlPrim7JSjtfIxgTt8/6MiXgiR/CtFfR4dWW2xhq85/NGIBYEeWrZThGdKGarBzeIqBfLFhw9n509jprzJ0zc2Rf+9HVFGLw+xxC4xPxgCS0IIWeAJQ+XtGcHmn0UZXriXm8Ja4kdlow6SWinB7sr/WM3R0+frYs4WgllkwggDf2/Tv6VHygvLnhtzp6hIJFyTjh+l/KnyJTyZW1TkZhDaNDzX3SCOHT\",\"iv\":\"FbeHDAW5afeWNORfNJBR0Q==\",\"salt\":\"TxZ+WbCW6891C9LK/hbMAoUsSEW1E8pyGLVBU6x5KR8=\"}" - }, - "NetworkController": { - "network": "1337", - "provider": { - "nickname": "Localhost 8545", - "rpcUrl": "http://localhost:8545", - "chainId": "0x539", - "ticker": "ETH", - "type": "rpc" - } - }, - "NotificationController": { - "notifications": { - "1": { - "isShown": true - }, - "3": { - "isShown": true - }, - "5": { - "isShown": true - }, - "6": { - "isShown": true - }, - "8": { - "isShown": true - }, - "10": { - "isShown": true - }, - "11": { - "isShown": true - }, - "12": { - "isShown": true - }, - "14": { - "isShown": true - }, - "15": { - "isShown": true - } - } - }, - "OnboardingController": { - "onboardingTabs": {}, - "seedPhraseBackedUp": false - }, - "PermissionsMetadata": { - "domainMetadata": { - "metamask.github.io": { - "icon": null, - "name": "M E T A M A S K M E S H T E S T" - } - }, - "permissionsHistory": {}, - "permissionsLog": [ - { - "id": 746677923, - "method": "eth_accounts", - "methodType": "restricted", - "origin": "metamask.github.io", - "request": { - "id": 746677923, - "jsonrpc": "2.0", - "method": "eth_accounts", - "origin": "metamask.github.io", - "params": [] - }, - "requestTime": 1575697241368, - "response": { - "id": 746677923, - "jsonrpc": "2.0", - "result": [] - }, - "responseTime": 1575697241370, - "success": true - } - ] - }, - "PreferencesController": { - "accountTokens": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": { - "goerli": [], - "sepolia": [] - } - }, - "assetImages": {}, - "completedOnboarding": true, - "dismissSeedBackUpReminder": true, - "currentLocale": "en", - "featureFlags": { - "showIncomingTransactions": true, - "transactionTime": false - }, - "firstTimeFlowType": "create", - "forgottenPassword": false, - "frequentRpcListDetail": [], - "identities": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": { - "address": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "name": "Account 1" - } - }, - "knownMethodData": {}, - "lostIdentities": {}, - "metaMetricsId": null, - "participateInMetaMetrics": false, - "preferences": { - "useNativeCurrencyAsPrimaryCurrency": true - }, - "selectedAddress": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "suggestedTokens": {}, - "tokens": [], - "useBlockie": false, - "useNonceField": false, - "usePhishDetect": true, - "useTokenDetection": true - }, - "MetaMetricsController": { - "fragments": { - "transaction-added-7911313280012623": { - "category": "Transactions", - "initialEvent": "Transaction Added", - "successEvent": "Transaction Approved", - "failureEvent": "Transaction Rejected", - "properties": {}, - "persist": true, - "uniqueIdentifier": "transaction-added-7911313280012623" - }, - "transaction-added-7911313280012624": { - "category": "Transactions", - "initialEvent": "Transaction Added", - "successEvent": "Transaction Approved", - "failureEvent": "Transaction Rejected", - "properties": {}, - "persist": true, - "uniqueIdentifier": "transaction-added-7911313280012624" - }, - "transaction-added-7911313280012625": { - "category": "Transactions", - "initialEvent": "Transaction Added", - "successEvent": "Transaction Approved", - "failureEvent": "Transaction Rejected", - "properties": {}, - "persist": true, - "uniqueIdentifier": "transaction-added-7911313280012625" - }, - "transaction-added-7911313280012626": { - "category": "Transactions", - "initialEvent": "Transaction Added", - "successEvent": "Transaction Approved", - "failureEvent": "Transaction Rejected", - "properties": {}, - "persist": true, - "uniqueIdentifier": "transaction-added-7911313280012626" - } - } - }, - "TransactionController": { - "transactions": { - "7911313280012623": { - "chainId": "0x539", - "dappSuggestedGasFees": { - "gas": "0x5208", - "gasPrice": "0x4a817c800" - }, - "history": [ - { - "chainId": "0x539", - "dappSuggestedGasFees": { - "gas": "0x5208", - "gasPrice": "0x4a817c800" - }, - "id": 7911313280012623, - "loadingDefaults": true, - "metamaskNetworkId": "1337", - "origin": "https://metamask.github.io", - "status": "unapproved", - "time": 1631545991949, - "txParams": { - "from": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "gas": "0x5208", - "gasPrice": "0x4a817c800", - "to": "0x2f318c334780961fb129d2a6c30d0763d9a5c970", - "value": "0x29a2241af62c0000" - }, - "type": "sentEther" - }, - [ - { - "note": "Added new unapproved transaction.", - "op": "replace", - "path": "/loadingDefaults", - "timestamp": 1631545992244, - "value": false - } - ] - ], - "id": 7911313280012623, - "loadingDefaults": false, - "metamaskNetworkId": "1337", - "origin": "https://metamask.github.io", - "status": "unapproved", - "time": 1631545991949, - "txParams": { - "from": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "gas": "0x5208", - "gasPrice": "0x4a817c800", - "to": "0x2f318c334780961fb129d2a6c30d0763d9a5c970", - "value": "0x29a2241af62c0000" - }, - "type": "sentEther" - }, - "7911313280012624": { - "chainId": "0x539", - "dappSuggestedGasFees": { - "gas": "0x5208", - "gasPrice": "0x4a817c800" - }, - "history": [ - { - "chainId": "0x539", - "dappSuggestedGasFees": { - "gas": "0x5208", - "gasPrice": "0x4a817c800" - }, - "id": 7911313280012624, - "loadingDefaults": true, - "metamaskNetworkId": "1337", - "origin": "https://metamask.github.io", - "status": "unapproved", - "time": 1631545994578, - "txParams": { - "from": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "gas": "0x5208", - "gasPrice": "0x4a817c800", - "to": "0x2f318c334780961fb129d2a6c30d0763d9a5c970", - "value": "0x29a2241af62c0000" - }, - "type": "sentEther" - }, - [ - { - "note": "Added new unapproved transaction.", - "op": "replace", - "path": "/loadingDefaults", - "timestamp": 1631545994695, - "value": false - } - ] - ], - "id": 7911313280012624, - "loadingDefaults": false, - "metamaskNetworkId": "1337", - "origin": "https://metamask.github.io", - "status": "unapproved", - "time": 1631545994578, - "txParams": { - "from": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "gas": "0x5208", - "gasPrice": "0x4a817c800", - "to": "0x2f318c334780961fb129d2a6c30d0763d9a5c970", - "value": "0x29a2241af62c0000" - }, - "type": "sentEther" - }, - "7911313280012625": { - "chainId": "0x539", - "dappSuggestedGasFees": { - "gas": "0x5208", - "gasPrice": "0x4a817c800" - }, - "history": [ - { - "chainId": "0x539", - "dappSuggestedGasFees": { - "gas": "0x5208", - "gasPrice": "0x4a817c800" - }, - "id": 7911313280012625, - "loadingDefaults": true, - "metamaskNetworkId": "1337", - "origin": "https://metamask.github.io", - "status": "unapproved", - "time": 1631545996673, - "txParams": { - "from": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "gas": "0x5208", - "gasPrice": "0x4a817c800", - "to": "0x2f318c334780961fb129d2a6c30d0763d9a5c970", - "value": "0x29a2241af62c0000" - }, - "type": "sentEther" - }, - [ - { - "note": "Added new unapproved transaction.", - "op": "replace", - "path": "/loadingDefaults", - "timestamp": 1631545996678, - "value": false - } - ] - ], - "id": 7911313280012625, - "loadingDefaults": false, - "metamaskNetworkId": "1337", - "origin": "https://metamask.github.io", - "status": "unapproved", - "time": 1631545996673, - "txParams": { - "from": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "gas": "0x5208", - "gasPrice": "0x4a817c800", - "to": "0x2f318c334780961fb129d2a6c30d0763d9a5c970", - "value": "0x29a2241af62c0000" - }, - "type": "sentEther" - }, - "7911313280012626": { - "chainId": "0x539", - "dappSuggestedGasFees": { - "gas": "0x5208", - "gasPrice": "0x4a817c800" - }, - "history": [ - { - "chainId": "0x539", - "dappSuggestedGasFees": { - "gas": "0x5208", - "gasPrice": "0x4a817c800" - }, - "id": 7911313280012626, - "loadingDefaults": true, - "metamaskNetworkId": "1337", - "origin": "https://metamask.github.io", - "status": "unapproved", - "time": 1631545998675, - "txParams": { - "from": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "gas": "0x5208", - "gasPrice": "0x4a817c800", - "to": "0x2f318c334780961fb129d2a6c30d0763d9a5c970", - "value": "0x29a2241af62c0000" - }, - "type": "sentEther" - }, - [ - { - "note": "Added new unapproved transaction.", - "op": "replace", - "path": "/loadingDefaults", - "timestamp": 1631545998677, - "value": false - } - ] - ], - "id": 7911313280012626, - "loadingDefaults": false, - "metamaskNetworkId": "1337", - "origin": "https://metamask.github.io", - "status": "unapproved", - "time": 1631545998675, - "txParams": { - "from": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "gas": "0x5208", - "gasPrice": "0x4a817c800", - "to": "0x2f318c334780961fb129d2a6c30d0763d9a5c970", - "value": "0x29a2241af62c0000" - }, - "type": "sentEther" - } - } - }, - "PermissionsController": { - "permissionsRequests": [], - "permissionsDescriptions": {}, - "domains": { - "http://127.0.0.1:8080": { - "permissions": [ - { - "@context": ["https://github.com/MetaMask/rpc-cap"], - "parentCapability": "eth_accounts", - "id": "f55a1c15-ea48-4088-968e-63be474d42fa", - "date": 1594348332268, - "invoker": "http://127.0.0.1:8080", - "caveats": [ - { - "type": "limitResponseLength", - "value": 1, - "name": "primaryAccountOnly" - }, - { - "type": "filterResponse", - "value": ["0x5cfe73b6021e818b776b421b1c4db2474086a7e1"], - "name": "exposedAccounts" - } - ] - } - ] - } - } - }, - "config": {}, - "firstTimeInfo": { - "date": 1575697234195, - "version": "7.7.0" - } - }, - "meta": { - "version": 40 - } -} diff --git a/test/e2e/fixtures/onboarding/state.json b/test/e2e/fixtures/onboarding/state.json deleted file mode 100644 index 42b51a422..000000000 --- a/test/e2e/fixtures/onboarding/state.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "data": { - "config": {}, - "PreferencesController": { - "frequentRpcListDetail": [ - { - "rpcUrl": "http://localhost:8545", - "chainId": "0x539", - "ticker": "ETH", - "nickname": "Localhost 8545", - "rpcPrefs": {} - } - ] - }, - "firstTimeInfo": { - "version": "9.3.0", - "date": 1617927806790 - }, - "NetworkController": { - "provider": { - "ticker": "ETH", - "type": "rpc", - "rpcUrl": "http://localhost:8545", - "chainId": "0x539", - "nickname": "Localhost 8545" - }, - "network": "1337" - }, - "NotificationController": { - "notifications": { - "10": { - "isShown": true - }, - "11": { - "isShown": true - }, - "12": { - "isShown": true - }, - "14": { - "isShown": true - }, - "15": { - "isShown": true - } - } - }, - "CurrencyController": { - "conversionDate": 1617927806.941, - "conversionRate": 2084.64, - "currentCurrency": "usd", - "nativeCurrency": "ETH", - "usdConversionRate": 2084.64 - } - }, - "meta": { - "version": 57 - } -} diff --git a/test/e2e/fixtures/send-edit-v2/state.json b/test/e2e/fixtures/send-edit-v2/state.json deleted file mode 100644 index 76d21936f..000000000 --- a/test/e2e/fixtures/send-edit-v2/state.json +++ /dev/null @@ -1,229 +0,0 @@ -{ - "data": { - "AppStateController": { - "mkrMigrationReminderTimestamp": null, - "swapsWelcomeMessageHasBeenShown": true, - "showPortfolioTooltip": false - }, - "CachedBalancesController": { - "cachedBalances": { - "4": {} - } - }, - "CurrencyController": { - "conversionDate": 1575697244.188, - "conversionRate": 149.61, - "currentCurrency": "usd", - "nativeCurrency": "ETH" - }, - "IncomingTransactionsController": { - "incomingTransactions": {}, - "incomingTxLastFetchedBlocksByNetwork": { - "goerli": null, - "mainnet": null, - "sepolia": null - } - }, - "KeyringController": { - "vault": "{\"data\":\"s6TpYjlUNsn7ifhEFTkuDGBUM1GyOlPrim7JSjtfIxgTt8/6MiXgiR/CtFfR4dWW2xhq85/NGIBYEeWrZThGdKGarBzeIqBfLFhw9n509jprzJ0zc2Rf+9HVFGLw+xxC4xPxgCS0IIWeAJQ+XtGcHmn0UZXriXm8Ja4kdlow6SWinB7sr/WM3R0+frYs4WgllkwggDf2/Tv6VHygvLnhtzp6hIJFyTjh+l/KnyJTyZW1TkZhDaNDzX3SCOHT\",\"iv\":\"FbeHDAW5afeWNORfNJBR0Q==\",\"salt\":\"TxZ+WbCW6891C9LK/hbMAoUsSEW1E8pyGLVBU6x5KR8=\"}" - }, - "NetworkController": { - "network": "1337", - "provider": { - "nickname": "Localhost 8545", - "rpcUrl": "http://localhost:8545", - "chainId": "0x539", - "ticker": "ETH", - "type": "rpc" - } - }, - "NotificationController": { - "notifications": { - "1": { - "isShown": true - }, - "3": { - "isShown": true - }, - "5": { - "isShown": true - }, - "6": { - "isShown": true - }, - "8": { - "isShown": true - }, - "10": { - "isShown": true - }, - "11": { - "isShown": true - }, - "12": { - "isShown": true - }, - "14": { - "isShown": true - }, - "15": { - "isShown": true - } - } - }, - "OnboardingController": { - "onboardingTabs": {}, - "seedPhraseBackedUp": false - }, - "PermissionsMetadata": { - "domainMetadata": { - "metamask.github.io": { - "icon": null, - "name": "M E T A M A S K M E S H T E S T" - } - }, - "permissionsHistory": {}, - "permissionsLog": [ - { - "id": 746677923, - "method": "eth_accounts", - "methodType": "restricted", - "origin": "metamask.github.io", - "request": { - "id": 746677923, - "jsonrpc": "2.0", - "method": "eth_accounts", - "origin": "metamask.github.io", - "params": [] - }, - "requestTime": 1575697241368, - "response": { - "id": 746677923, - "jsonrpc": "2.0", - "result": [] - }, - "responseTime": 1575697241370, - "success": true - } - ] - }, - "PreferencesController": { - "accountTokens": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": { - "goerli": [], - "sepolia": [] - } - }, - "assetImages": {}, - "completedOnboarding": true, - "eip1559V2Enabled": true, - "currentLocale": "en", - "featureFlags": { - "showIncomingTransactions": true, - "transactionTime": false - }, - "firstTimeFlowType": "create", - "forgottenPassword": false, - "frequentRpcListDetail": [], - "identities": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": { - "address": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "name": "Account 1" - } - }, - "knownMethodData": {}, - "lostIdentities": {}, - "metaMetricsId": null, - "participateInMetaMetrics": false, - "preferences": { - "useNativeCurrencyAsPrimaryCurrency": true - }, - "selectedAddress": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "suggestedTokens": {}, - "tokens": [], - "useBlockie": false, - "useNonceField": false, - "usePhishDetect": true - }, - "TransactionController": { - "transactions": { - "4046084157914634": { - "chainId": "0x539", - "primaryTransaction": { - "chainId": "0x539", - "id": 4046084157914634, - "loadingDefaults": true, - "metamaskNetworkId": "1337", - "origin": "metamask", - "status": "unapproved", - "time": 1617228030067, - "txParams": { - "from": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "gas": "0x61a8", - "maxFeePerGas": "0x59682f0c", - "maxPriorityFeePerGas": "0x59682f00", - "type": "0x2", - "to": "0x2f318C334780961FB129D2a6c30D0763d9a5C970", - "value": "0xde0b6b3a7640000" - }, - "type": "sentEther" - }, - "history": [ - { - "chainId": "0x539", - "id": 4046084157914634, - "loadingDefaults": true, - "metamaskNetworkId": "1337", - "origin": "metamask", - "status": "unapproved", - "time": 1617228030067, - "txParams": { - "from": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "gas": "0x61a8", - "maxFeePerGas": "0x59682f0c", - "maxPriorityFeePerGas": "0x59682f00", - "type": "0x2", - "to": "0x2f318C334780961FB129D2a6c30D0763d9a5C970", - "value": "0xde0b6b3a7640000" - }, - "type": "simpleSend" - }, - [ - { - "note": "Added new unapproved transaction.", - "op": "replace", - "path": "/loadingDefaults", - "timestamp": 1617228030069, - "value": false - } - ] - ], - "id": 4046084157914634, - "loadingDefaults": false, - "metamaskNetworkId": "1337", - "origin": "metamask", - "status": "unapproved", - "time": 1617228030067, - "txParams": { - "from": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "gas": "0x61a8", - "maxFeePerGas": "0x59682f0c", - "maxPriorityFeePerGas": "0x59682f00", - "type": "0x2", - "to": "0x2f318C334780961FB129D2a6c30D0763d9a5C970", - "value": "0xde0b6b3a7640000" - }, - "type": "simpleSend" - } - } - }, - "config": {}, - "firstTimeInfo": { - "date": 1575697234195, - "version": "7.7.0" - } - }, - "meta": { - "version": 40 - } -} diff --git a/test/e2e/fixtures/send-edit/state.json b/test/e2e/fixtures/send-edit/state.json deleted file mode 100644 index 0e17eb4a9..000000000 --- a/test/e2e/fixtures/send-edit/state.json +++ /dev/null @@ -1,235 +0,0 @@ -{ - "data": { - "AppStateController": { - "mkrMigrationReminderTimestamp": null, - "swapsWelcomeMessageHasBeenShown": true, - "showPortfolioTooltip": false - }, - "CachedBalancesController": { - "cachedBalances": { - "4": {} - } - }, - "CurrencyController": { - "conversionDate": 1575697244.188, - "conversionRate": 149.61, - "currentCurrency": "usd", - "nativeCurrency": "ETH" - }, - "IncomingTransactionsController": { - "incomingTransactions": {}, - "incomingTxLastFetchedBlocksByNetwork": { - "goerli": null, - "mainnet": null, - "sepolia": null - } - }, - "KeyringController": { - "vault": "{\"data\":\"s6TpYjlUNsn7ifhEFTkuDGBUM1GyOlPrim7JSjtfIxgTt8/6MiXgiR/CtFfR4dWW2xhq85/NGIBYEeWrZThGdKGarBzeIqBfLFhw9n509jprzJ0zc2Rf+9HVFGLw+xxC4xPxgCS0IIWeAJQ+XtGcHmn0UZXriXm8Ja4kdlow6SWinB7sr/WM3R0+frYs4WgllkwggDf2/Tv6VHygvLnhtzp6hIJFyTjh+l/KnyJTyZW1TkZhDaNDzX3SCOHT\",\"iv\":\"FbeHDAW5afeWNORfNJBR0Q==\",\"salt\":\"TxZ+WbCW6891C9LK/hbMAoUsSEW1E8pyGLVBU6x5KR8=\"}" - }, - "NetworkController": { - "network": "1337", - "provider": { - "nickname": "Localhost 8545", - "rpcUrl": "http://localhost:8545", - "chainId": "0x539", - "ticker": "ETH", - "type": "rpc" - } - }, - "NotificationController": { - "notifications": { - "1": { - "isShown": true - }, - "3": { - "isShown": true - }, - "5": { - "isShown": true - }, - "6": { - "isShown": true - }, - "8": { - "isShown": true - }, - "10": { - "isShown": true - }, - "11": { - "isShown": true - }, - "12": { - "isShown": true - }, - "14": { - "isShown": true - }, - "15": { - "isShown": true - } - } - }, - "OnboardingController": { - "onboardingTabs": {}, - "seedPhraseBackedUp": false - }, - "PermissionsMetadata": { - "domainMetadata": { - "metamask.github.io": { - "icon": null, - "name": "M E T A M A S K M E S H T E S T" - } - }, - "permissionsHistory": {}, - "permissionsLog": [ - { - "id": 746677923, - "method": "eth_accounts", - "methodType": "restricted", - "origin": "metamask.github.io", - "request": { - "id": 746677923, - "jsonrpc": "2.0", - "method": "eth_accounts", - "origin": "metamask.github.io", - "params": [] - }, - "requestTime": 1575697241368, - "response": { - "id": 746677923, - "jsonrpc": "2.0", - "result": [] - }, - "responseTime": 1575697241370, - "success": true - } - ] - }, - "PreferencesController": { - "accountTokens": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": { - "goerli": [], - "sepolia": [] - } - }, - "assetImages": {}, - "completedOnboarding": true, - "currentLocale": "en", - "featureFlags": { - "showIncomingTransactions": true, - "transactionTime": false - }, - "firstTimeFlowType": "create", - "forgottenPassword": false, - "frequentRpcListDetail": [], - "identities": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": { - "address": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "name": "Account 1" - } - }, - "knownMethodData": {}, - "lostIdentities": {}, - "metaMetricsId": null, - "participateInMetaMetrics": false, - "preferences": { - "useNativeCurrencyAsPrimaryCurrency": true - }, - "selectedAddress": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "suggestedTokens": {}, - "tokens": [], - "useBlockie": false, - "useNonceField": false, - "usePhishDetect": true - }, - "MetaMetricsController": { - "fragments": { - "transaction-added-4046084157914634": { - "category": "Transactions", - "initialEvent": "Transaction Added", - "successEvent": "Transaction Approved", - "failureEvent": "Transaction Rejected", - "properties": {}, - "persist": true, - "uniqueIdentifier": "transaction-added-4046084157914634" - } - } - }, - "TransactionController": { - "transactions": { - "4046084157914634": { - "chainId": "0x539", - "primaryTransaction": { - "chainId": "0x539", - "id": 4046084157914634, - "loadingDefaults": true, - "metamaskNetworkId": "1337", - "origin": "metamask", - "status": "unapproved", - "time": 1617228030067, - "txParams": { - "from": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "gas": "0x61a8", - "gasPrice": "0x2540be400", - "to": "0x2f318C334780961FB129D2a6c30D0763d9a5C970", - "value": "0xde0b6b3a7640000" - }, - "type": "sentEther" - }, - "history": [ - { - "chainId": "0x539", - "id": 4046084157914634, - "loadingDefaults": true, - "metamaskNetworkId": "1337", - "origin": "metamask", - "status": "unapproved", - "time": 1617228030067, - "txParams": { - "from": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "gas": "0x61a8", - "gasPrice": "0x2540be400", - "to": "0x2f318C334780961FB129D2a6c30D0763d9a5C970", - "value": "0xde0b6b3a7640000" - }, - "type": "simpleSend" - }, - [ - { - "note": "Added new unapproved transaction.", - "op": "replace", - "path": "/loadingDefaults", - "timestamp": 1617228030069, - "value": false - } - ] - ], - "id": 4046084157914634, - "loadingDefaults": false, - "metamaskNetworkId": "1337", - "origin": "metamask", - "status": "unapproved", - "time": 1617228030067, - "txParams": { - "from": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "gas": "0x61a8", - "gasPrice": "0x2540be400", - "to": "0x2f318C334780961FB129D2a6c30D0763d9a5C970", - "value": "0xde0b6b3a7640000" - }, - "type": "simpleSend" - } - } - }, - "config": {}, - "firstTimeInfo": { - "date": 1575697234195, - "version": "7.7.0" - } - }, - "meta": { - "version": 40 - } -} diff --git a/test/e2e/fixtures/special-settings/state.json b/test/e2e/fixtures/special-settings/state.json deleted file mode 100644 index 64e2d023e..000000000 --- a/test/e2e/fixtures/special-settings/state.json +++ /dev/null @@ -1,158 +0,0 @@ -{ - "data": { - "AppStateController": { - "mkrMigrationReminderTimestamp": null, - "showPortfolioTooltip": false - }, - "CachedBalancesController": { - "cachedBalances": { - "4": {} - } - }, - "CurrencyController": { - "conversionDate": 1575697244.188, - "conversionRate": 149.61, - "currentCurrency": "usd", - "nativeCurrency": "ETH" - }, - "IncomingTransactionsController": { - "incomingTransactions": {}, - "incomingTxLastFetchedBlocksByNetwork": { - "goerli": null, - "mainnet": null, - "sepolia": null - } - }, - "KeyringController": { - "vault": "{\"data\":\"s6TpYjlUNsn7ifhEFTkuDGBUM1GyOlPrim7JSjtfIxgTt8/6MiXgiR/CtFfR4dWW2xhq85/NGIBYEeWrZThGdKGarBzeIqBfLFhw9n509jprzJ0zc2Rf+9HVFGLw+xxC4xPxgCS0IIWeAJQ+XtGcHmn0UZXriXm8Ja4kdlow6SWinB7sr/WM3R0+frYs4WgllkwggDf2/Tv6VHygvLnhtzp6hIJFyTjh+l/KnyJTyZW1TkZhDaNDzX3SCOHT\",\"iv\":\"FbeHDAW5afeWNORfNJBR0Q==\",\"salt\":\"TxZ+WbCW6891C9LK/hbMAoUsSEW1E8pyGLVBU6x5KR8=\"}" - }, - "NetworkController": { - "network": "1337", - "provider": { - "nickname": "Localhost 8545", - "rpcUrl": "http://localhost:8545", - "chainId": "0x539", - "ticker": "ETH", - "type": "rpc" - } - }, - "NotificationController": { - "notifications": { - "1": { - "isShown": true - }, - "3": { - "isShown": true - }, - "5": { - "isShown": true - }, - "6": { - "isShown": true - }, - "8": { - "isShown": true - }, - "10": { - "isShown": true - }, - "11": { - "isShown": true - }, - "12": { - "isShown": true - }, - "14": { - "isShown": true - }, - "15": { - "isShown": true - } - } - }, - "OnboardingController": { - "onboardingTabs": {}, - "seedPhraseBackedUp": false - }, - "PermissionsMetadata": { - "domainMetadata": { - "metamask.github.io": { - "icon": null, - "name": "M E T A M A S K M E S H T E S T" - } - }, - "permissionsHistory": {}, - "permissionsLog": [ - { - "id": 746677923, - "method": "eth_accounts", - "methodType": "restricted", - "origin": "metamask.github.io", - "request": { - "id": 746677923, - "jsonrpc": "2.0", - "method": "eth_accounts", - "origin": "metamask.github.io", - "params": [] - }, - "requestTime": 1575697241368, - "response": { - "id": 746677923, - "jsonrpc": "2.0", - "result": [] - }, - "responseTime": 1575697241370, - "success": true - } - ] - }, - "PreferencesController": { - "accountTokens": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": { - "goerli": [], - "sepolia": [] - } - }, - "assetImages": {}, - "completedOnboarding": true, - "dismissSeedBackUpReminder": true, - "currentLocale": "en", - "featureFlags": { - "showIncomingTransactions": true, - "transactionTime": false, - "sendHexData": true - }, - "firstTimeFlowType": "create", - "forgottenPassword": false, - "frequentRpcListDetail": [], - "identities": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": { - "address": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "name": "Account 1" - } - }, - "knownMethodData": {}, - "lostIdentities": {}, - "metaMetricsId": null, - "participateInMetaMetrics": false, - "preferences": { - "useNativeCurrencyAsPrimaryCurrency": true - }, - "selectedAddress": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "suggestedTokens": {}, - "tokens": [], - "useBlockie": false, - "useNonceField": false, - "usePhishDetect": true, - "useTokenDetection": false - }, - "config": {}, - "firstTimeInfo": { - "date": 1575697234195, - "version": "7.7.0" - } - }, - "meta": { - "version": 40 - } -} diff --git a/test/e2e/fixtures/threebox-enabled/state.json b/test/e2e/fixtures/threebox-enabled/state.json deleted file mode 100644 index 7b9027fcc..000000000 --- a/test/e2e/fixtures/threebox-enabled/state.json +++ /dev/null @@ -1,155 +0,0 @@ -{ - "data": { - "AppStateController": { - "swapsWelcomeMessageHasBeenShown": true, - "connectedStatusPopoverHasBeenShown": false, - "showPortfolioTooltip": false - }, - "CachedBalancesController": { - "cachedBalances": { - "0x539": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": "0x15af1d78b58c40000" - } - } - }, - "CurrencyController": { - "conversionDate": 1617897791.928, - "conversionRate": 2072.49, - "currentCurrency": "usd", - "nativeCurrency": "ETH", - "usdConversionRate": 2072.49 - }, - "IncomingTransactionsController": { - "incomingTransactions": {}, - "incomingTxLastFetchedBlockByChainId": { - "0xaa36a7": null, - "0x1": null, - "0x5": 5570536 - } - }, - "KeyringController": { - "vault": "{\"data\":\"s6TpYjlUNsn7ifhEFTkuDGBUM1GyOlPrim7JSjtfIxgTt8/6MiXgiR/CtFfR4dWW2xhq85/NGIBYEeWrZThGdKGarBzeIqBfLFhw9n509jprzJ0zc2Rf+9HVFGLw+xxC4xPxgCS0IIWeAJQ+XtGcHmn0UZXriXm8Ja4kdlow6SWinB7sr/WM3R0+frYs4WgllkwggDf2/Tv6VHygvLnhtzp6hIJFyTjh+l/KnyJTyZW1TkZhDaNDzX3SCOHT\",\"iv\":\"FbeHDAW5afeWNORfNJBR0Q==\",\"salt\":\"TxZ+WbCW6891C9LK/hbMAoUsSEW1E8pyGLVBU6x5KR8=\"}" - }, - "NetworkController": { - "provider": { - "nickname": "Localhost 8545", - "rpcUrl": "http://localhost:8545", - "chainId": "0x539", - "ticker": "ETH", - "type": "rpc" - }, - "previousProviderStore": { - "nickname": "Localhost 8545", - "rpcUrl": "http://localhost:8545", - "chainId": "0x539", - "ticker": "ETH", - "type": "rpc" - }, - "network": "1337" - }, - "NotificationController": { - "notifications": { - "1": { - "isShown": true - }, - "3": { - "isShown": true - }, - "5": { - "isShown": true - }, - "6": { - "isShown": true - }, - "8": { - "isShown": true - }, - "10": { - "isShown": true - }, - "11": { - "isShown": true - }, - "12": { - "isShown": true - }, - "14": { - "isShown": true - }, - "15": { - "isShown": true - } - } - }, - "OnboardingController": { - "onboardingTabs": {}, - "seedPhraseBackedUp": true - }, - "PreferencesController": { - "frequentRpcListDetail": [ - { - "rpcUrl": "http://localhost:8545", - "chainId": "0x539", - "ticker": "ETH", - "nickname": "Localhost 8545", - "rpcPrefs": {} - } - ], - "accountTokens": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": { - "0x5": [], - "0xaa36a7": [] - } - }, - "accountHiddenTokens": {}, - "assetImages": {}, - "tokens": [], - "hiddenTokens": [], - "suggestedTokens": {}, - "useBlockie": true, - "useNonceField": false, - "usePhishDetect": true, - "featureFlags": { - "showIncomingTransactions": true, - "transactionTime": false - }, - "knownMethodData": {}, - "firstTimeFlowType": "create", - "currentLocale": "en", - "identities": { - "0x5cfe73b6021e818b776b421b1c4db2474086a7e1": { - "address": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1", - "name": "Account 1" - } - }, - "lostIdentities": {}, - "forgottenPassword": false, - "preferences": { - "useNativeCurrencyAsPrimaryCurrency": true - }, - "completedOnboarding": true, - "ipfsGateway": "dweb.link", - "selectedAddress": "0x5cfe73b6021e818b776b421b1c4db2474086a7e1" - }, - "config": {}, - "firstTimeInfo": { - "date": 1575697234195, - "version": "7.7.0" - }, - "MetaMetricsController": { - "metaMetricsId": null, - "participateInMetaMetrics": false - }, - "ThreeBoxController": { - "threeBoxSyncingAllowed": true, - "showRestorePrompt": true, - "threeBoxLastUpdated": 0, - "threeBoxAddress": "0x64480aa2768ef12f3f19c5a01206ceb0f82d06b9", - "threeBoxSynced": true, - "threeBoxDisabled": false - } - }, - "meta": { - "version": 57 - } -} diff --git a/test/e2e/helpers.js b/test/e2e/helpers.js index 6dadb1e23..b3f74418a 100644 --- a/test/e2e/helpers.js +++ b/test/e2e/helpers.js @@ -73,7 +73,7 @@ async function withFixtures(options, testSuite) { }); } await fixtureServer.start(); - await fixtureServer.loadState(path.join(__dirname, 'fixtures', fixtures)); + fixtureServer.loadJsonState(fixtures); await phishingPageServer.start(); if (dapp) { if (dappOptions?.numberOfDapps) { @@ -198,26 +198,6 @@ const getWindowHandles = async (driver, handlesCount) => { return { extension, dapp, popup }; }; -const connectDappWithExtensionPopup = async (driver) => { - await driver.openNewPage(`http://127.0.0.1:${dappBasePort}/`); - await driver.delay(regularDelayMs); - await driver.clickElement({ text: 'Connect', tag: 'button' }); - await driver.delay(regularDelayMs); - - const windowHandles = await getWindowHandles(driver, 3); - - // open extension popup and confirm connect - await driver.switchToWindow(windowHandles.popup); - await driver.delay(largeDelayMs); - await driver.clickElement({ text: 'Next', tag: 'button' }); - await driver.clickElement({ text: 'Connect', tag: 'button' }); - - // send from dapp - await driver.waitUntilXWindowHandles(2); - await driver.switchToWindow(windowHandles.dapp); - await driver.delay(regularDelayMs); -}; - const completeImportSRPOnboardingFlow = async ( driver, seedPhrase, @@ -333,7 +313,6 @@ module.exports = { largeDelayMs, veryLargeDelayMs, withFixtures, - connectDappWithExtensionPopup, completeImportSRPOnboardingFlow, completeImportSRPOnboardingFlowWordByWord, createDownloadFolder, diff --git a/test/e2e/fixtures/import-utc-json/test-json-import-account-file.json b/test/e2e/import-utc-json/test-json-import-account-file.json similarity index 100% rename from test/e2e/fixtures/import-utc-json/test-json-import-account-file.json rename to test/e2e/import-utc-json/test-json-import-account-file.json diff --git a/test/e2e/lavamoat-stats.js b/test/e2e/lavamoat-stats.js index 4abf00a68..2dcf83ac2 100755 --- a/test/e2e/lavamoat-stats.js +++ b/test/e2e/lavamoat-stats.js @@ -7,41 +7,45 @@ const yargs = require('yargs/yargs'); const { hideBin } = require('yargs/helpers'); const { exitWithError } = require('../../development/lib/exit-with-error'); const { withFixtures, tinyDelayMs } = require('./helpers'); +const FixtureBuilder = require('./fixture-builder'); async function measurePage() { let metrics; try { - await withFixtures({ fixtures: 'imported-account' }, async ({ driver }) => { - await driver.delay(tinyDelayMs); - await driver.navigate(); - await driver.findElement('#password'); - await driver.delay(1000); - const logs = await driver.checkBrowserForLavamoatLogs(); + await withFixtures( + { fixtures: new FixtureBuilder().build() }, + async ({ driver }) => { + await driver.delay(tinyDelayMs); + await driver.navigate(); + await driver.findElement('#password'); + await driver.delay(1000); + const logs = await driver.checkBrowserForLavamoatLogs(); - let logString = ''; - let inObject = false; + let logString = ''; + let inObject = false; - const parsedLogs = []; + const parsedLogs = []; - logs.forEach((log) => { - if (log.indexOf('"version": 1') >= 0) { - logString += log; - parsedLogs.push(`{${logString}}`); - logString = ''; - inObject = false; - } else if (inObject) { - logString += log; - } else if ( - log.search(/"name": ".*app\/scripts\/background.js",/u) >= 0 || - log.search(/"name": ".*app\/scripts\/ui.js",/u) >= 0 - ) { - logString += log; - inObject = true; - } - }); + logs.forEach((log) => { + if (log.indexOf('"version": 1') >= 0) { + logString += log; + parsedLogs.push(`{${logString}}`); + logString = ''; + inObject = false; + } else if (inObject) { + logString += log; + } else if ( + log.search(/"name": ".*app\/scripts\/background.js",/u) >= 0 || + log.search(/"name": ".*app\/scripts\/ui.js",/u) >= 0 + ) { + logString += log; + inObject = true; + } + }); - metrics = parsedLogs.map((pl) => JSON.parse(pl)); - }); + metrics = parsedLogs.map((pl) => JSON.parse(pl)); + }, + ); } catch (error) { // do nothing } diff --git a/test/e2e/mv3-perf-stats/init-load-stats.js b/test/e2e/mv3-perf-stats/init-load-stats.js index de5194031..f9975557d 100755 --- a/test/e2e/mv3-perf-stats/init-load-stats.js +++ b/test/e2e/mv3-perf-stats/init-load-stats.js @@ -12,6 +12,7 @@ const { getFirstParentDirectoryThatExists, } = require('../../helpers/file'); const { withFixtures, tinyDelayMs } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); /** * The e2e test case is used to capture load and initialisation time statistics for extension in MV3 environment. @@ -20,42 +21,45 @@ const { withFixtures, tinyDelayMs } = require('../helpers'); async function profilePageLoad() { const parsedLogs = {}; try { - await withFixtures({ fixtures: 'imported-account' }, async ({ driver }) => { - await driver.delay(tinyDelayMs); - await driver.navigate(); - await driver.delay(1000); - const logs = await driver.checkBrowserForLavamoatLogs(); + await withFixtures( + { fixtures: new FixtureBuilder().build() }, + async ({ driver }) => { + await driver.delay(tinyDelayMs); + await driver.navigate(); + await driver.delay(1000); + const logs = await driver.checkBrowserForLavamoatLogs(); - let logString = ''; - let logType = ''; + let logString = ''; + let logType = ''; - logs.forEach((log) => { - if (log.indexOf('"version": 1') >= 0) { - // log end here - logString += log; - parsedLogs[logType] = JSON.parse(`{${logString}}`); - logString = ''; - logType = ''; - } else if (logType) { - // log string continues - logString += log; - } else if ( - log.search(/"name": ".*app\/scripts\/background.js",/u) >= 0 - ) { - // background log starts - logString += log; - logType = 'background'; - } else if (log.search(/"name": ".*app\/scripts\/ui.js",/u) >= 0) { - // ui log starts - logString += log; - logType = 'ui'; - } else if (log.search(/"name": "Total"/u) >= 0) { - // load time log starts - logString += log; - logType = 'loadTime'; - } - }); - }); + logs.forEach((log) => { + if (log.indexOf('"version": 1') >= 0) { + // log end here + logString += log; + parsedLogs[logType] = JSON.parse(`{${logString}}`); + logString = ''; + logType = ''; + } else if (logType) { + // log string continues + logString += log; + } else if ( + log.search(/"name": ".*app\/scripts\/background.js",/u) >= 0 + ) { + // background log starts + logString += log; + logType = 'background'; + } else if (log.search(/"name": ".*app\/scripts\/ui.js",/u) >= 0) { + // ui log starts + logString += log; + logType = 'ui'; + } else if (log.search(/"name": "Total"/u) >= 0) { + // load time log starts + logString += log; + logType = 'loadTime'; + } + }); + }, + ); } catch (error) { console.log('Error in trying to parse logs.'); } diff --git a/test/e2e/mv3-stats.js b/test/e2e/mv3-stats.js index 8e8180e02..2dd24791e 100755 --- a/test/e2e/mv3-stats.js +++ b/test/e2e/mv3-stats.js @@ -12,6 +12,7 @@ const { getFirstParentDirectoryThatExists, } = require('../helpers/file'); const { withFixtures, tinyDelayMs } = require('./helpers'); +const FixtureBuilder = require('./fixture-builder'); /** * The e2e test case is used to capture load and initialisation time statistics for extension in MV3 environment. @@ -20,42 +21,45 @@ const { withFixtures, tinyDelayMs } = require('./helpers'); async function profilePageLoad() { const parsedLogs = {}; try { - await withFixtures({ fixtures: 'imported-account' }, async ({ driver }) => { - await driver.delay(tinyDelayMs); - await driver.navigate(); - await driver.delay(1000); - const logs = await driver.checkBrowserForLavamoatLogs(); + await withFixtures( + { fixtures: new FixtureBuilder().build() }, + async ({ driver }) => { + await driver.delay(tinyDelayMs); + await driver.navigate(); + await driver.delay(1000); + const logs = await driver.checkBrowserForLavamoatLogs(); - let logString = ''; - let logType = ''; + let logString = ''; + let logType = ''; - logs.forEach((log) => { - if (log.indexOf('"version": 1') >= 0) { - // log end here - logString += log; - parsedLogs[logType] = JSON.parse(`{${logString}}`); - logString = ''; - logType = ''; - } else if (logType) { - // log string continues - logString += log; - } else if ( - log.search(/"name": ".*app\/scripts\/background.js",/u) >= 0 - ) { - // background log starts - logString += log; - logType = 'background'; - } else if (log.search(/"name": ".*app\/scripts\/ui.js",/u) >= 0) { - // ui log starts - logString += log; - logType = 'ui'; - } else if (log.search(/"name": "Total"/u) >= 0) { - // load time log starts - logString += log; - logType = 'loadTime'; - } - }); - }); + logs.forEach((log) => { + if (log.indexOf('"version": 1') >= 0) { + // log end here + logString += log; + parsedLogs[logType] = JSON.parse(`{${logString}}`); + logString = ''; + logType = ''; + } else if (logType) { + // log string continues + logString += log; + } else if ( + log.search(/"name": ".*app\/scripts\/background.js",/u) >= 0 + ) { + // background log starts + logString += log; + logType = 'background'; + } else if (log.search(/"name": ".*app\/scripts\/ui.js",/u) >= 0) { + // ui log starts + logString += log; + logType = 'ui'; + } else if (log.search(/"name": "Total"/u) >= 0) { + // load time log starts + logString += log; + logType = 'loadTime'; + } + }); + }, + ); } catch (error) { console.log('Error in trying to parse logs.'); } diff --git a/test/e2e/snaps/test-snap-bip-32.spec.js b/test/e2e/snaps/test-snap-bip-32.spec.js index 89fab0c12..b179461e7 100644 --- a/test/e2e/snaps/test-snap-bip-32.spec.js +++ b/test/e2e/snaps/test-snap-bip-32.spec.js @@ -1,5 +1,6 @@ const { strict: assert } = require('assert'); const { withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); const { TEST_SNAPS_WEBSITE_URL } = require('./enums'); describe('Test Snap bip-32', function () { @@ -14,7 +15,9 @@ describe('Test Snap bip-32', function () { }; await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToSnapDapp() + .build(), ganacheOptions, title: this.test.title, }, @@ -36,26 +39,9 @@ describe('Test Snap bip-32', function () { await driver.fill('#snapId6', 'npm:@metamask/test-snap-bip32'); await driver.clickElement('#connectBip32'); - // switch to metamask extension and click connect - await driver.waitUntilXWindowHandles(2, 5000, 10000); - let windowHandles = await driver.getAllWindowHandles(); - await driver.switchToWindowWithTitle( - 'MetaMask Notification', - windowHandles, - ); - await driver.clickElement( - { - text: 'Connect', - tag: 'button', - }, - 10000, - ); - - await driver.delay(2000); - // approve install of snap await driver.waitUntilXWindowHandles(2, 5000, 10000); - windowHandles = await driver.getAllWindowHandles(); + let windowHandles = await driver.getAllWindowHandles(); await driver.switchToWindowWithTitle( 'MetaMask Notification', windowHandles, diff --git a/test/e2e/snaps/test-snap-bip-44.spec.js b/test/e2e/snaps/test-snap-bip-44.spec.js index 743fee4a9..ce617a350 100644 --- a/test/e2e/snaps/test-snap-bip-44.spec.js +++ b/test/e2e/snaps/test-snap-bip-44.spec.js @@ -1,5 +1,6 @@ const { strict: assert } = require('assert'); const { withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); const { TEST_SNAPS_WEBSITE_URL } = require('./enums'); describe('Test Snap bip-44', function () { @@ -15,7 +16,9 @@ describe('Test Snap bip-44', function () { }; await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToSnapDapp() + .build(), ganacheOptions, title: this.test.title, }, @@ -38,26 +41,9 @@ describe('Test Snap bip-44', function () { // connect the snap await driver.clickElement('#connectBip44'); - // switch to metamask extension and click connect - await driver.waitUntilXWindowHandles(2, 5000, 10000); - let windowHandles = await driver.getAllWindowHandles(); - await driver.switchToWindowWithTitle( - 'MetaMask Notification', - windowHandles, - ); - await driver.clickElement( - { - text: 'Connect', - tag: 'button', - }, - 10000, - ); - - await driver.delay(2000); - // approve install of snap await driver.waitUntilXWindowHandles(2, 5000, 10000); - windowHandles = await driver.getAllWindowHandles(); + let windowHandles = await driver.getAllWindowHandles(); await driver.switchToWindowWithTitle( 'MetaMask Notification', windowHandles, diff --git a/test/e2e/snaps/test-snap-confirm.spec.js b/test/e2e/snaps/test-snap-confirm.spec.js index 1722dd93f..9d85977df 100644 --- a/test/e2e/snaps/test-snap-confirm.spec.js +++ b/test/e2e/snaps/test-snap-confirm.spec.js @@ -1,5 +1,6 @@ const { strict: assert } = require('assert'); const { withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); const { TEST_SNAPS_WEBSITE_URL } = require('./enums'); describe('Test Snap Confirm', function () { @@ -15,7 +16,9 @@ describe('Test Snap Confirm', function () { }; await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToSnapDapp() + .build(), ganacheOptions, title: this.test.title, }, @@ -31,26 +34,9 @@ describe('Test Snap Confirm', function () { await driver.fill('#snapId1', 'npm:@metamask/test-snap-confirm'); await driver.clickElement('#connectHello'); - // switch to metamask extension and click connect - await driver.waitUntilXWindowHandles(2, 5000, 10000); - let windowHandles = await driver.getAllWindowHandles(); - await driver.switchToWindowWithTitle( - 'MetaMask Notification', - windowHandles, - ); - await driver.clickElement( - { - text: 'Connect', - tag: 'button', - }, - 10000, - ); - - await driver.delay(2000); - // approve install of snap await driver.waitUntilXWindowHandles(2, 5000, 10000); - windowHandles = await driver.getAllWindowHandles(); + let windowHandles = await driver.getAllWindowHandles(); await driver.switchToWindowWithTitle( 'MetaMask Notification', windowHandles, diff --git a/test/e2e/snaps/test-snap-error.spec.js b/test/e2e/snaps/test-snap-error.spec.js index 406daba7d..337b932df 100644 --- a/test/e2e/snaps/test-snap-error.spec.js +++ b/test/e2e/snaps/test-snap-error.spec.js @@ -1,6 +1,7 @@ const { strict: assert } = require('assert'); const { withFixtures } = require('../helpers'); const { PAGES } = require('../webdriver/driver'); +const FixtureBuilder = require('../fixture-builder'); const { TEST_SNAPS_WEBSITE_URL } = require('./enums'); describe('Test Snap Error', function () { @@ -16,7 +17,9 @@ describe('Test Snap Error', function () { }; await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToSnapDapp() + .build(), ganacheOptions, title: this.test.title, }, @@ -37,25 +40,8 @@ describe('Test Snap Error', function () { await driver.clickElement('#connectError'); - // switch to metamask extension and click connect - await driver.waitUntilXWindowHandles(2, 5000, 10000); - let windowHandles = await driver.getAllWindowHandles(); - await driver.switchToWindowWithTitle( - 'MetaMask Notification', - windowHandles, - ); - await driver.clickElement( - { - text: 'Connect', - tag: 'button', - }, - 10000, - ); - - await driver.delay(2000); - // approve install of snap - windowHandles = await driver.getAllWindowHandles(); + let windowHandles = await driver.getAllWindowHandles(); await driver.switchToWindowWithTitle( 'MetaMask Notification', windowHandles, diff --git a/test/e2e/snaps/test-snap-get-snaps.spec.js b/test/e2e/snaps/test-snap-get-snaps.spec.js index 911773f11..8de5cadbb 100644 --- a/test/e2e/snaps/test-snap-get-snaps.spec.js +++ b/test/e2e/snaps/test-snap-get-snaps.spec.js @@ -1,5 +1,6 @@ const { strict: assert } = require('assert'); const { withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); const { TEST_SNAPS_WEBSITE_URL } = require('./enums'); describe('Test Snap Confirm', function () { @@ -15,7 +16,9 @@ describe('Test Snap Confirm', function () { }; await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToSnapDapp() + .build(), ganacheOptions, title: this.test.title, }, @@ -31,26 +34,9 @@ describe('Test Snap Confirm', function () { await driver.fill('#snapId1', 'npm:@metamask/test-snap-confirm'); await driver.clickElement('#connectHello'); - // switch to metamask extension and click connect - await driver.waitUntilXWindowHandles(2, 5000, 10000); - let windowHandles = await driver.getAllWindowHandles(); - await driver.switchToWindowWithTitle( - 'MetaMask Notification', - windowHandles, - ); - await driver.clickElement( - { - text: 'Connect', - tag: 'button', - }, - 10000, - ); - - await driver.delay(2000); - // approve install of snap await driver.waitUntilXWindowHandles(2, 5000, 10000); - windowHandles = await driver.getAllWindowHandles(); + let windowHandles = await driver.getAllWindowHandles(); await driver.switchToWindowWithTitle( 'MetaMask Notification', windowHandles, @@ -71,24 +57,8 @@ describe('Test Snap Confirm', function () { await driver.fill('#snapId2', 'npm:@metamask/test-snap-error'); await driver.clickElement('#connectError'); - // switch to metamask extension and click connect - await driver.waitUntilXWindowHandles(2, 5000, 10000); - windowHandles = await driver.getAllWindowHandles(); - await driver.switchToWindowWithTitle( - 'MetaMask Notification', - windowHandles, - ); - await driver.clickElement( - { - text: 'Connect', - tag: 'button', - }, - 10000, - ); - - await driver.delay(2000); - // approve install of snap + await driver.waitUntilXWindowHandles(2, 5000, 10000); windowHandles = await driver.getAllWindowHandles(); await driver.switchToWindowWithTitle( 'MetaMask Notification', diff --git a/test/e2e/snaps/test-snap-managestate.spec.js b/test/e2e/snaps/test-snap-managestate.spec.js index 06fddda59..58fc36862 100644 --- a/test/e2e/snaps/test-snap-managestate.spec.js +++ b/test/e2e/snaps/test-snap-managestate.spec.js @@ -1,5 +1,6 @@ const { strict: assert } = require('assert'); const { withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); const { TEST_SNAPS_WEBSITE_URL } = require('./enums'); describe('Test Snap manageState', function () { @@ -16,7 +17,9 @@ describe('Test Snap manageState', function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToSnapDapp() + .build(), ganacheOptions, title: this.test.title, }, @@ -40,25 +43,9 @@ describe('Test Snap manageState', function () { // connect the snap await driver.clickElement('#connectManageState'); - // switch to metamask extension and click connect - await driver.waitUntilXWindowHandles(2, 5000, 10000); - let windowHandles = await driver.getAllWindowHandles(); - await driver.switchToWindowWithTitle( - 'MetaMask Notification', - windowHandles, - ); - await driver.clickElement( - { - text: 'Connect', - tag: 'button', - }, - 10000, - ); - await driver.delay(2000); - // approve install of snap await driver.waitUntilXWindowHandles(2, 5000, 10000); - windowHandles = await driver.getAllWindowHandles(); + let windowHandles = await driver.getAllWindowHandles(); await driver.switchToWindowWithTitle( 'MetaMask Notification', windowHandles, diff --git a/test/e2e/snaps/test-snap-notification.spec.js b/test/e2e/snaps/test-snap-notification.spec.js index 25f7cbe34..ff2002881 100644 --- a/test/e2e/snaps/test-snap-notification.spec.js +++ b/test/e2e/snaps/test-snap-notification.spec.js @@ -1,6 +1,7 @@ const { strict: assert } = require('assert'); const { withFixtures } = require('../helpers'); const { PAGES } = require('../webdriver/driver'); +const FixtureBuilder = require('../fixture-builder'); const { TEST_SNAPS_WEBSITE_URL } = require('./enums'); describe('Test Snap Notification', function () { @@ -16,7 +17,9 @@ describe('Test Snap Notification', function () { }; await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToSnapDapp() + .build(), ganacheOptions, title: this.test.title, }, @@ -40,25 +43,9 @@ describe('Test Snap Notification', function () { // connect the snap await driver.clickElement('#connectNotification'); - // switch to metamask extension and click connect - await driver.waitUntilXWindowHandles(2, 5000, 10000); - let windowHandles = await driver.getAllWindowHandles(); - await driver.switchToWindowWithTitle( - 'MetaMask Notification', - windowHandles, - ); - await driver.clickElement( - { - text: 'Connect', - tag: 'button', - }, - 10000, - ); - await driver.delay(2000); - // approve install of snap await driver.waitUntilXWindowHandles(2, 5000, 10000); - windowHandles = await driver.getAllWindowHandles(); + let windowHandles = await driver.getAllWindowHandles(); await driver.switchToWindowWithTitle( 'MetaMask Notification', windowHandles, diff --git a/test/e2e/snaps/test-snap-update.spec.js b/test/e2e/snaps/test-snap-update.spec.js index 497da3d25..862e95045 100644 --- a/test/e2e/snaps/test-snap-update.spec.js +++ b/test/e2e/snaps/test-snap-update.spec.js @@ -1,5 +1,6 @@ const { strict: assert } = require('assert'); const { withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); const { TEST_SNAPS_WEBSITE_URL } = require('./enums'); describe('Test Snap update', function () { @@ -15,7 +16,9 @@ describe('Test Snap update', function () { }; await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToSnapDapp() + .build(), ganacheOptions, title: this.test.title, }, @@ -36,30 +39,13 @@ describe('Test Snap update', function () { await driver.fill('#snapId7', 'npm:@metamask/test-snap-confirm'); await driver.clickElement('#connectUpdateOld'); - // switch to metamask extension and click connect - await driver.waitUntilXWindowHandles(3, 5000, 10000); + // approve install of snap let windowHandles = await driver.getAllWindowHandles(); const extensionPage = windowHandles[0]; await driver.switchToWindowWithTitle( 'MetaMask Notification', windowHandles, ); - await driver.clickElement( - { - text: 'Connect', - tag: 'button', - }, - 10000, - ); - - await driver.delay(1000); - - // approve install of snap - windowHandles = await driver.getAllWindowHandles(); - await driver.switchToWindowWithTitle( - 'MetaMask Notification', - windowHandles, - ); await driver.clickElement({ text: 'Approve & install', tag: 'button', diff --git a/test/e2e/tests/account-details.spec.js b/test/e2e/tests/account-details.spec.js index cfdbdf238..8b8c990f0 100644 --- a/test/e2e/tests/account-details.spec.js +++ b/test/e2e/tests/account-details.spec.js @@ -1,5 +1,6 @@ const { strict: assert } = require('assert'); const { convertToHexValue, withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); describe('Show account details', function () { const ganacheOptions = { @@ -14,7 +15,7 @@ describe('Show account details', function () { it('should show the QR code for the account', async function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, }, diff --git a/test/e2e/tests/add-account.spec.js b/test/e2e/tests/add-account.spec.js index ca9415ac3..5e1c15bd0 100644 --- a/test/e2e/tests/add-account.spec.js +++ b/test/e2e/tests/add-account.spec.js @@ -6,6 +6,7 @@ const { completeImportSRPOnboardingFlow, } = require('../helpers'); const enLocaleMessages = require('../../../app/_locales/en/messages.json'); +const FixtureBuilder = require('../fixture-builder'); describe('Add account', function () { const testSeedPhrase = @@ -24,7 +25,7 @@ describe('Add account', function () { it('should display correct new account name after create', async function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, }, @@ -50,7 +51,7 @@ describe('Add account', function () { it('should add the same account addresses when a secret recovery phrase is imported, the account is locked, and the same secret recovery phrase is imported again', async function () { await withFixtures( { - fixtures: 'onboarding', + fixtures: new FixtureBuilder({ onboarding: true }).build(), ganacheOptions, title: this.test.title, failOnConsoleError: false, @@ -205,7 +206,7 @@ describe('Add account', function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, }, diff --git a/test/e2e/tests/add-hide-token.spec.js b/test/e2e/tests/add-hide-token.spec.js index 8722bcfb0..688823081 100644 --- a/test/e2e/tests/add-hide-token.spec.js +++ b/test/e2e/tests/add-hide-token.spec.js @@ -1,5 +1,6 @@ const { strict: assert } = require('assert'); const { convertToHexValue, withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); describe('Hide token', function () { const ganacheOptions = { @@ -14,7 +15,32 @@ describe('Hide token', function () { it('hides the token when clicked', async function () { await withFixtures( { - fixtures: 'custom-token', + fixtures: new FixtureBuilder() + .withTokensController({ + allTokens: { + '0x539': { + '0x5cfe73b6021e818b776b421b1c4db2474086a7e1': [ + { + address: '0x86002be4cdd922de1ccb831582bf99284b99ac12', + decimals: 4, + image: null, + isERC721: false, + symbol: 'TST', + }, + ], + }, + }, + tokens: [ + { + address: '0x86002be4cdd922de1ccb831582bf99284b99ac12', + decimals: 4, + image: null, + isERC721: false, + symbol: 'TST', + }, + ], + }) + .build(), ganacheOptions, title: this.test.title, }, @@ -69,12 +95,11 @@ describe('Add existing token using search', function () { it('renders the balance for the chosen token', async function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder() + .withPreferencesController({ useTokenDetection: true }) + .build(), ganacheOptions, title: this.test.title, - driverOptions: { - timeOut: 20000, - }, }, async ({ driver }) => { await driver.navigate(); diff --git a/test/e2e/tests/address-book.spec.js b/test/e2e/tests/address-book.spec.js index b0121bcab..336c8e420 100644 --- a/test/e2e/tests/address-book.spec.js +++ b/test/e2e/tests/address-book.spec.js @@ -1,5 +1,6 @@ const { strict: assert } = require('assert'); const { convertToHexValue, withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); describe('Address Book', function () { const ganacheOptions = { @@ -14,7 +15,7 @@ describe('Address Book', function () { it('Adds an entry to the address book and sends eth to that address', async function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, }, @@ -77,7 +78,21 @@ describe('Address Book', function () { it('Sends to an address book entry', async function () { await withFixtures( { - fixtures: 'address-entry', + fixtures: new FixtureBuilder() + .withAddressBookController({ + addressBook: { + '0x539': { + '0x2f318C334780961FB129D2a6c30D0763d9a5C970': { + address: '0x2f318C334780961FB129D2a6c30D0763d9a5C970', + chainId: '0x539', + isEns: false, + memo: '', + name: 'Test Name 1', + }, + }, + }, + }) + .build(), ganacheOptions, title: this.test.title, }, diff --git a/test/e2e/tests/advanced-settings.spec.js b/test/e2e/tests/advanced-settings.spec.js index b0d1eea35..88a4a7f27 100644 --- a/test/e2e/tests/advanced-settings.spec.js +++ b/test/e2e/tests/advanced-settings.spec.js @@ -1,5 +1,6 @@ const { strict: assert } = require('assert'); const { convertToHexValue, withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); describe('Advanced Settings', function () { const ganacheOptions = { @@ -16,7 +17,7 @@ describe('Advanced Settings', function () { await withFixtures( { dapp: true, - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, }, @@ -53,7 +54,7 @@ describe('Advanced Settings', function () { await withFixtures( { dapp: true, - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, }, diff --git a/test/e2e/tests/auto-lock.spec.js b/test/e2e/tests/auto-lock.spec.js index 7401540ac..c49680f0d 100644 --- a/test/e2e/tests/auto-lock.spec.js +++ b/test/e2e/tests/auto-lock.spec.js @@ -1,5 +1,6 @@ const { strict: assert } = require('assert'); const { convertToHexValue, withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); describe('Auto-Lock Timer', function () { const ganacheOptions = { @@ -15,7 +16,7 @@ describe('Auto-Lock Timer', function () { it('should automatically lock the wallet once the idle time has elapsed', async function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, }, diff --git a/test/e2e/tests/backup.spec.js b/test/e2e/tests/backup.spec.js index 99b3a43ea..90fa400ce 100644 --- a/test/e2e/tests/backup.spec.js +++ b/test/e2e/tests/backup.spec.js @@ -5,6 +5,7 @@ const { withFixtures, createDownloadFolder, } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); const downloadsFolder = `${process.cwd()}/test-artifacts/downloads`; @@ -48,7 +49,7 @@ describe('Backup', function () { it('should create backup for the account', async function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, failOnConsoleError: false, diff --git a/test/e2e/tests/chain-interactions.spec.js b/test/e2e/tests/chain-interactions.spec.js index c95d3d211..42feb3913 100644 --- a/test/e2e/tests/chain-interactions.spec.js +++ b/test/e2e/tests/chain-interactions.spec.js @@ -1,5 +1,6 @@ const { strict: assert } = require('assert'); const { convertToHexValue, withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); describe('Chain Interactions', function () { const port = 8546; @@ -18,7 +19,7 @@ describe('Chain Interactions', function () { await withFixtures( { dapp: true, - fixtures: 'connected-state', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, }, @@ -70,7 +71,7 @@ describe('Chain Interactions', function () { await withFixtures( { dapp: true, - fixtures: 'connected-state', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, }, @@ -99,7 +100,9 @@ describe('Chain Interactions', function () { await driver.switchToWindow(extension); // verify current network - const networkDisplay = await driver.findElement('.network-display'); + const networkDisplay = await driver.findElement( + '[data-testid="network-display"]', + ); assert.equal(await networkDisplay.getText(), `Localhost ${port}`); }, ); diff --git a/test/e2e/tests/collectibles.spec.js b/test/e2e/tests/collectibles.spec.js index 692c8ac08..55424d36a 100644 --- a/test/e2e/tests/collectibles.spec.js +++ b/test/e2e/tests/collectibles.spec.js @@ -1,6 +1,7 @@ const { strict: assert } = require('assert'); const { convertToHexValue, withFixtures } = require('../helpers'); const { SMART_CONTRACTS } = require('../seeder/smart-contracts'); +const FixtureBuilder = require('../fixture-builder'); describe('Collectibles', function () { const smartContract = SMART_CONTRACTS.COLLECTIBLES; @@ -17,7 +18,9 @@ describe('Collectibles', function () { await withFixtures( { dapp: true, - fixtures: 'connected-state', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToTestDapp() + .build(), ganacheOptions, smartContract, title: this.test.title, @@ -69,7 +72,9 @@ describe('Collectibles', function () { await withFixtures( { dapp: true, - fixtures: 'connected-state', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToTestDapp() + .build(), ganacheOptions, smartContract, title: this.test.title, @@ -134,7 +139,9 @@ describe('Collectibles', function () { await withFixtures( { dapp: true, - fixtures: 'connected-state', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToTestDapp() + .build(), ganacheOptions, smartContract, title: this.test.title, @@ -203,7 +210,9 @@ describe('Collectibles', function () { await withFixtures( { dapp: true, - fixtures: 'connected-state', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToTestDapp() + .build(), ganacheOptions, smartContract, title: this.test.title, diff --git a/test/e2e/tests/contract-interactions.spec.js b/test/e2e/tests/contract-interactions.spec.js index d50ac6cb9..71c5962cb 100644 --- a/test/e2e/tests/contract-interactions.spec.js +++ b/test/e2e/tests/contract-interactions.spec.js @@ -1,6 +1,7 @@ const { strict: assert } = require('assert'); const { convertToHexValue, withFixtures } = require('../helpers'); const { SMART_CONTRACTS } = require('../seeder/smart-contracts'); +const FixtureBuilder = require('../fixture-builder'); describe('Deploy contract and call contract methods', function () { const ganacheOptions = { @@ -17,7 +18,9 @@ describe('Deploy contract and call contract methods', function () { await withFixtures( { dapp: true, - fixtures: 'connected-state', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToTestDapp() + .build(), ganacheOptions, smartContract, title: this.test.title, diff --git a/test/e2e/tests/custom-rpc-history.spec.js b/test/e2e/tests/custom-rpc-history.spec.js index 908fc2ad5..1ab2aa1ef 100644 --- a/test/e2e/tests/custom-rpc-history.spec.js +++ b/test/e2e/tests/custom-rpc-history.spec.js @@ -1,5 +1,6 @@ const { strict: assert } = require('assert'); const { convertToHexValue, withFixtures, largeDelayMs } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); describe('Stores custom RPC history', function () { const ganacheOptions = { @@ -17,7 +18,7 @@ describe('Stores custom RPC history', function () { const symbol = 'TEST'; await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions: { ...ganacheOptions, concurrent: { port, chainId } }, title: this.test.title, }, @@ -74,7 +75,7 @@ describe('Stores custom RPC history', function () { it('warns user when they enter url for an already configured network', async function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, }, @@ -117,7 +118,7 @@ describe('Stores custom RPC history', function () { it('warns user when they enter chainId for an already configured network', async function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, failOnConsoleError: false, @@ -129,7 +130,7 @@ describe('Stores custom RPC history', function () { // duplicate network const newRpcUrl = 'http://localhost:8544'; - const duplicateChainId = '0x539'; + const duplicateChainId = '1'; await driver.delay(largeDelayMs); @@ -153,7 +154,7 @@ describe('Stores custom RPC history', function () { await chainIdInput.clear(); await chainIdInput.sendKeys(duplicateChainId); await driver.findElement({ - text: 'This Chain ID is currently used by the Localhost 8545 network.', + text: 'This Chain ID is currently used by the mainnet network.', tag: 'h6', }); @@ -171,7 +172,7 @@ describe('Stores custom RPC history', function () { it('selects another provider', async function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, }, @@ -192,7 +193,26 @@ describe('Stores custom RPC history', function () { it('finds all recent RPCs in history', async function () { await withFixtures( { - fixtures: 'custom-rpc', + fixtures: new FixtureBuilder() + .withPreferencesController({ + frequentRpcListDetail: [ + { + rpcUrl: 'http://127.0.0.1:8545/1', + chainId: '0x539', + ticker: 'ETH', + nickname: 'http://127.0.0.1:8545/1', + rpcPrefs: {}, + }, + { + rpcUrl: 'http://127.0.0.1:8545/2', + chainId: '0x539', + ticker: 'ETH', + nickname: 'http://127.0.0.1:8545/2', + rpcPrefs: {}, + }, + ], + }) + .build(), ganacheOptions, title: this.test.title, }, @@ -221,7 +241,26 @@ describe('Stores custom RPC history', function () { it('deletes a custom RPC', async function () { await withFixtures( { - fixtures: 'custom-rpc', + fixtures: new FixtureBuilder() + .withPreferencesController({ + frequentRpcListDetail: [ + { + rpcUrl: 'http://127.0.0.1:8545/1', + chainId: '0x539', + ticker: 'ETH', + nickname: 'http://127.0.0.1:8545/1', + rpcPrefs: {}, + }, + { + rpcUrl: 'http://127.0.0.1:8545/2', + chainId: '0x539', + ticker: 'ETH', + nickname: 'http://127.0.0.1:8545/2', + rpcPrefs: {}, + }, + ], + }) + .build(), ganacheOptions, title: this.test.title, failOnConsoleError: false, diff --git a/test/e2e/tests/custom-token-add-approve.spec.js b/test/e2e/tests/custom-token-add-approve.spec.js index 7b68e093e..67e045325 100644 --- a/test/e2e/tests/custom-token-add-approve.spec.js +++ b/test/e2e/tests/custom-token-add-approve.spec.js @@ -6,6 +6,7 @@ const { withFixtures, getWindowHandles, } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); describe.skip('Create token, approve token and approve token without gas', function () { describe('Add a custom token from a dapp', function () { @@ -23,7 +24,9 @@ describe.skip('Create token, approve token and approve token without gas', funct await withFixtures( { dapp: true, - fixtures: 'connected-state', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToTestDapp() + .build(), ganacheOptions, title: this.test.title, }, @@ -114,7 +117,9 @@ describe.skip('Create token, approve token and approve token without gas', funct await withFixtures( { dapp: true, - fixtures: 'connected-state', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToTestDapp() + .build(), ganacheOptions, title: this.test.title, }, @@ -182,7 +187,9 @@ describe.skip('Create token, approve token and approve token without gas', funct await withFixtures( { dapp: true, - fixtures: 'connected-state', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToTestDapp() + .build(), ganacheOptions, title: this.test.title, }, @@ -292,7 +299,9 @@ describe.skip('Create token, approve token and approve token without gas', funct await withFixtures( { dapp: true, - fixtures: 'connected-state', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToTestDapp() + .build(), ganacheOptions, title: this.test.title, }, diff --git a/test/e2e/tests/dapp-interactions.spec.js b/test/e2e/tests/dapp-interactions.spec.js index ae8b72482..de62b9449 100644 --- a/test/e2e/tests/dapp-interactions.spec.js +++ b/test/e2e/tests/dapp-interactions.spec.js @@ -1,9 +1,6 @@ const { strict: assert } = require('assert'); -const { - convertToHexValue, - withFixtures, - connectDappWithExtensionPopup, -} = require('../helpers'); +const { convertToHexValue, withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); describe('Dapp interactions', function () { let windowHandles; @@ -22,7 +19,7 @@ describe('Dapp interactions', function () { await withFixtures( { dapp: true, - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions: { ...ganacheOptions, concurrent: { port: 8546, chainId: 1338 }, @@ -34,8 +31,7 @@ describe('Dapp interactions', function () { await driver.fill('#password', 'correct horse battery staple'); await driver.press('#password', driver.Key.ENTER); - // Connect to Dapp0 - await connectDappWithExtensionPopup(driver, 0); + await driver.openNewPage('http://127.0.0.1:8080/'); windowHandles = await driver.getAllWindowHandles(); extension = windowHandles[0]; @@ -68,7 +64,9 @@ describe('Dapp interactions', function () { await withFixtures( { dapp: true, - fixtures: 'imported-account', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToTestDapp() + .build(), ganacheOptions, dappOptions: { numberOfDapps: 2 }, title: this.test.title, @@ -78,8 +76,7 @@ describe('Dapp interactions', function () { await driver.fill('#password', 'correct horse battery staple'); await driver.press('#password', driver.Key.ENTER); - // Connect to Dapp0 - await connectDappWithExtensionPopup(driver, 0); + await driver.openNewPage('http://127.0.0.1:8080/'); windowHandles = await driver.getAllWindowHandles(); extension = windowHandles[0]; diff --git a/test/e2e/tests/edit-gas-fee.spec.js b/test/e2e/tests/edit-gas-fee.spec.js index ced967300..db1da859b 100644 --- a/test/e2e/tests/edit-gas-fee.spec.js +++ b/test/e2e/tests/edit-gas-fee.spec.js @@ -1,10 +1,10 @@ const { strict: assert } = require('assert'); const { convertToHexValue, - connectDappWithExtensionPopup, getWindowHandles, withFixtures, } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); describe('Editing Confirm Transaction', function () { it('allows selecting high, medium, low gas estimates on edit gas fee popover', async function () { @@ -20,7 +20,12 @@ describe('Editing Confirm Transaction', function () { }; await withFixtures( { - fixtures: 'eip-1559-v2', + fixtures: new FixtureBuilder() + .withPreferencesController({ + eip1559V2Enabled: true, + }) + .withTransactionControllerTypeTwoTransaction() + .build(), ganacheOptions, title: this.test.title, }, @@ -34,7 +39,7 @@ describe('Editing Confirm Transaction', function () { '.currency-display-component__text', ); const transactionAmount = transactionAmounts[0]; - assert.equal(await transactionAmount.getText(), '2.2'); + assert.equal(await transactionAmount.getText(), '1'); // update estimates to high await driver.clickElement('[data-testid="edit-gas-fee-button"]'); @@ -80,7 +85,7 @@ describe('Editing Confirm Transaction', function () { '.transaction-list-item__primary-currency', ); assert.equal(txValues.length, 1); - assert.ok(/-2.2\s*ETH/u.test(await txValues[0].getText())); + assert.ok(/-1\s*ETH/u.test(await txValues[0].getText())); }, ); }); @@ -98,7 +103,12 @@ describe('Editing Confirm Transaction', function () { }; await withFixtures( { - fixtures: 'eip-1559-v2', + fixtures: new FixtureBuilder() + .withPreferencesController({ + eip1559V2Enabled: true, + }) + .withTransactionControllerTypeTwoTransaction() + .build(), ganacheOptions, title: this.test.title, }, @@ -112,7 +122,7 @@ describe('Editing Confirm Transaction', function () { '.currency-display-component__text', ); const transactionAmount = transactionAmounts[0]; - assert.equal(await transactionAmount.getText(), '2.2'); + assert.equal(await transactionAmount.getText(), '1'); // update estimates to high await driver.clickElement('[data-testid="edit-gas-fee-button"]'); @@ -145,7 +155,7 @@ describe('Editing Confirm Transaction', function () { }); await driver.waitForSelector({ css: '.transaction-detail-item:nth-of-type(2) h6:nth-of-type(2)', - text: '2.20085 ETH', + text: '1.00085 ETH', }); // confirms the transaction @@ -163,7 +173,7 @@ describe('Editing Confirm Transaction', function () { '.transaction-list-item__primary-currency', ); assert.equal(txValues.length, 1); - assert.ok(/-2.2\s*ETH/u.test(await txValues[0].getText())); + assert.ok(/-1\s*ETH/u.test(await txValues[0].getText())); }, ); }); @@ -181,7 +191,12 @@ describe('Editing Confirm Transaction', function () { }; await withFixtures( { - fixtures: 'eip-1559-v2-dapp', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToTestDapp() + .withPreferencesController({ + eip1559V2Enabled: true, + }) + .build(), ganacheOptions, title: this.test.title, dapp: true, @@ -194,7 +209,7 @@ describe('Editing Confirm Transaction', function () { await driver.press('#password', driver.Key.ENTER); // open dapp and connect - await connectDappWithExtensionPopup(driver); + await driver.openNewPage('http://127.0.0.1:8080/'); await driver.clickElement({ text: 'Send EIP 1559 Transaction', tag: 'button', diff --git a/test/e2e/tests/encrypt-decrypt.spec.js b/test/e2e/tests/encrypt-decrypt.spec.js index 6c4877139..e34908117 100644 --- a/test/e2e/tests/encrypt-decrypt.spec.js +++ b/test/e2e/tests/encrypt-decrypt.spec.js @@ -1,5 +1,6 @@ const { strict: assert } = require('assert'); const { convertToHexValue, withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); describe('Encrypt Decrypt', function () { const ganacheOptions = { @@ -17,7 +18,9 @@ describe('Encrypt Decrypt', function () { await withFixtures( { dapp: true, - fixtures: 'connected-state', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToTestDapp() + .build(), ganacheOptions, title: this.test.title, }, diff --git a/test/e2e/tests/errors.spec.js b/test/e2e/tests/errors.spec.js index 880844386..7538850cd 100644 --- a/test/e2e/tests/errors.spec.js +++ b/test/e2e/tests/errors.spec.js @@ -1,5 +1,6 @@ const { strict: assert } = require('assert'); const { convertToHexValue, withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); describe('Sentry errors', function () { async function mockSegment(mockServer) { @@ -26,7 +27,12 @@ describe('Sentry errors', function () { it('should send error events', async function () { await withFixtures( { - fixtures: 'metrics-enabled', + fixtures: new FixtureBuilder() + .withMetaMetricsController({ + metaMetricsId: 'fake-metrics-id', + participateInMetaMetrics: true, + }) + .build(), ganacheOptions, title: this.test.title, failOnConsoleError: false, diff --git a/test/e2e/tests/eth-sign.spec.js b/test/e2e/tests/eth-sign.spec.js index cf685726a..5bd90cea6 100644 --- a/test/e2e/tests/eth-sign.spec.js +++ b/test/e2e/tests/eth-sign.spec.js @@ -1,5 +1,6 @@ const { strict: assert } = require('assert'); const { convertToHexValue, withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); describe('Eth sign', function () { it('can initiate and confirm a eth sign', async function () { @@ -19,7 +20,9 @@ describe('Eth sign', function () { await withFixtures( { dapp: true, - fixtures: 'connected-state', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToTestDapp() + .build(), ganacheOptions, title: this.test.title, }, diff --git a/test/e2e/tests/failing-contract.spec.js b/test/e2e/tests/failing-contract.spec.js index bdeb6373b..6b15c6a05 100644 --- a/test/e2e/tests/failing-contract.spec.js +++ b/test/e2e/tests/failing-contract.spec.js @@ -1,6 +1,7 @@ const { strict: assert } = require('assert'); const { convertToHexValue, withFixtures } = require('../helpers'); const { SMART_CONTRACTS } = require('../seeder/smart-contracts'); +const FixtureBuilder = require('../fixture-builder'); describe('Failing contract interaction ', function () { const smartContract = SMART_CONTRACTS.FAILING; @@ -18,7 +19,9 @@ describe('Failing contract interaction ', function () { await withFixtures( { dapp: true, - fixtures: 'connected-state', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToTestDapp() + .build(), ganacheOptions, smartContract, title: this.test.title, diff --git a/test/e2e/tests/from-import-ui.spec.js b/test/e2e/tests/from-import-ui.spec.js index 74298956c..9c87f6c66 100644 --- a/test/e2e/tests/from-import-ui.spec.js +++ b/test/e2e/tests/from-import-ui.spec.js @@ -8,6 +8,7 @@ const { completeImportSRPOnboardingFlow, completeImportSRPOnboardingFlowWordByWord, } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); describe('MetaMask Import UI', function () { it('Importing wallet using Secret Recovery Phrase', async function () { @@ -27,7 +28,7 @@ describe('MetaMask Import UI', function () { await withFixtures( { - fixtures: 'onboarding', + fixtures: new FixtureBuilder({ onboarding: true }).build(), ganacheOptions, title: this.test.title, failOnConsoleError: false, @@ -145,7 +146,7 @@ describe('MetaMask Import UI', function () { await withFixtures( { - fixtures: 'onboarding', + fixtures: new FixtureBuilder({ onboarding: true }).build(), ganacheOptions, title: this.test.title, failOnConsoleError: false, @@ -192,7 +193,10 @@ describe('MetaMask Import UI', function () { await withFixtures( { - fixtures: 'import-ui', + fixtures: new FixtureBuilder() + .withKeyringControllerImportedAccountVault() + .withPreferencesControllerImportedAccountIdentities() + .build(), ganacheOptions, title: this.test.title, }, @@ -295,7 +299,10 @@ describe('MetaMask Import UI', function () { await withFixtures( { - fixtures: 'import-ui', + fixtures: new FixtureBuilder() + .withKeyringControllerImportedAccountVault() + .withPreferencesControllerImportedAccountIdentities() + .build(), ganacheOptions, title: this.test.title, }, @@ -315,7 +322,6 @@ describe('MetaMask Import UI', function () { const importJsonFile = path.join( __dirname, '..', - 'fixtures', 'import-utc-json', 'test-json-import-account-file.json', ); @@ -368,7 +374,10 @@ describe('MetaMask Import UI', function () { await withFixtures( { - fixtures: 'import-ui', + fixtures: new FixtureBuilder() + .withKeyringControllerImportedAccountVault() + .withPreferencesControllerImportedAccountIdentities() + .build(), ganacheOptions, title: this.test.title, }, @@ -407,7 +416,7 @@ describe('MetaMask Import UI', function () { await withFixtures( { - fixtures: 'import-ui', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, }, diff --git a/test/e2e/tests/gas-api-fallback.spec.js b/test/e2e/tests/gas-api-fallback.spec.js index 8fca241a0..9ccc023e5 100644 --- a/test/e2e/tests/gas-api-fallback.spec.js +++ b/test/e2e/tests/gas-api-fallback.spec.js @@ -1,5 +1,6 @@ const { strict: assert } = require('assert'); const { convertToHexValue, withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); describe('Gas API fallback', function () { async function mockGasApiDown(mockServer) { @@ -29,7 +30,7 @@ describe('Gas API fallback', function () { it('error message is displayed but gas recommendation is not displayed', async function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), testSpecificMock: mockGasApiDown, ganacheOptions, title: this.test.title, diff --git a/test/e2e/tests/incremental-security.spec.js b/test/e2e/tests/incremental-security.spec.js index 3e300eede..f54f9563a 100644 --- a/test/e2e/tests/incremental-security.spec.js +++ b/test/e2e/tests/incremental-security.spec.js @@ -1,6 +1,7 @@ const { strict: assert } = require('assert'); const { convertToHexValue, withFixtures, tinyDelayMs } = require('../helpers'); const enLocaleMessages = require('../../../app/_locales/en/messages.json'); +const FixtureBuilder = require('../fixture-builder'); describe('Incremental Security', function () { const ganacheOptions = { @@ -21,7 +22,7 @@ describe('Incremental Security', function () { await withFixtures( { dapp: true, - fixtures: 'onboarding', + fixtures: new FixtureBuilder({ onboarding: true }).build(), ganacheOptions, title: this.test.title, failOnConsoleError: false, diff --git a/test/e2e/tests/localization.spec.js b/test/e2e/tests/localization.spec.js index a4859de68..0e41d1d71 100644 --- a/test/e2e/tests/localization.spec.js +++ b/test/e2e/tests/localization.spec.js @@ -1,5 +1,6 @@ const { strict: assert } = require('assert'); const { convertToHexValue, withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); describe('Localization', function () { it('can correctly display Philippine peso symbol and code', async function () { @@ -13,7 +14,20 @@ describe('Localization', function () { ], }; await withFixtures( - { fixtures: 'localization', ganacheOptions, title: this.test.title }, + { + fixtures: new FixtureBuilder() + .withCurrencyController({ + currentCurrency: 'php', + }) + .withPreferencesController({ + preferences: { + showFiatInTestnets: true, + }, + }) + .build(), + ganacheOptions, + title: this.test.title, + }, async ({ driver }) => { await driver.navigate(); await driver.fill('#password', 'correct horse battery staple'); diff --git a/test/e2e/tests/lock-account.spec.js b/test/e2e/tests/lock-account.spec.js index 345a6ec78..1fd2910a6 100644 --- a/test/e2e/tests/lock-account.spec.js +++ b/test/e2e/tests/lock-account.spec.js @@ -1,5 +1,6 @@ const { strict: assert } = require('assert'); const { convertToHexValue, withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); describe('Lock and unlock', function () { const ganacheOptions = { @@ -14,7 +15,7 @@ describe('Lock and unlock', function () { it('successfully unlocks after lock', async function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, }, diff --git a/test/e2e/tests/lockdown.spec.js b/test/e2e/tests/lockdown.spec.js index cb38725aa..f49baa331 100644 --- a/test/e2e/tests/lockdown.spec.js +++ b/test/e2e/tests/lockdown.spec.js @@ -6,6 +6,7 @@ const { } = require('../../helpers/protect-intrinsics-helpers'); const { convertToHexValue, withFixtures } = require('../helpers'); const { PAGES } = require('../webdriver/driver'); +const FixtureBuilder = require('../fixture-builder'); const isFirefox = process.env.SELENIUM_BROWSER === Browser.FIREFOX; @@ -65,7 +66,7 @@ describe('lockdown', function () { await withFixtures( { // The fixtures used here is arbitrary. Any fixture would do. - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, }, diff --git a/test/e2e/tests/metamask-responsive-ui.spec.js b/test/e2e/tests/metamask-responsive-ui.spec.js index d0f6906db..0fba51b13 100644 --- a/test/e2e/tests/metamask-responsive-ui.spec.js +++ b/test/e2e/tests/metamask-responsive-ui.spec.js @@ -1,6 +1,7 @@ const { strict: assert } = require('assert'); const { convertToHexValue, withFixtures, tinyDelayMs } = require('../helpers'); const enLocaleMessages = require('../../../app/_locales/en/messages.json'); +const FixtureBuilder = require('../fixture-builder'); describe('MetaMask Responsive UI', function () { it('Creating a new wallet', async function () { @@ -8,7 +9,7 @@ describe('MetaMask Responsive UI', function () { await withFixtures( { - fixtures: 'onboarding', + fixtures: new FixtureBuilder({ onboarding: true }).build(), driverOptions, title: this.test.title, failOnConsoleError: false, @@ -154,7 +155,7 @@ describe('MetaMask Responsive UI', function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), driverOptions, title: this.test.title, failOnConsoleError: false, @@ -200,7 +201,7 @@ describe('MetaMask Responsive UI', function () { }; await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), driverOptions, ganacheOptions, title: this.test.title, diff --git a/test/e2e/tests/metrics.spec.js b/test/e2e/tests/metrics.spec.js index d00abd788..21ee6c0fd 100644 --- a/test/e2e/tests/metrics.spec.js +++ b/test/e2e/tests/metrics.spec.js @@ -1,5 +1,6 @@ const { strict: assert } = require('assert'); const { convertToHexValue, withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); describe('Segment metrics', function () { async function mockSegment(mockServer) { @@ -27,7 +28,12 @@ describe('Segment metrics', function () { it('should send first three Page metric events upon fullscreen page load', async function () { await withFixtures( { - fixtures: 'metrics-enabled', + fixtures: new FixtureBuilder() + .withMetaMetricsController({ + metaMetricsId: 'fake-metrics-id', + participateInMetaMetrics: true, + }) + .build(), ganacheOptions, title: this.test.title, failOnConsoleError: false, diff --git a/test/e2e/tests/navigate-transactions.spec.js b/test/e2e/tests/navigate-transactions.spec.js index 3e1eca68a..d2f964b8e 100644 --- a/test/e2e/tests/navigate-transactions.spec.js +++ b/test/e2e/tests/navigate-transactions.spec.js @@ -1,5 +1,6 @@ const { strict: assert } = require('assert'); const { convertToHexValue, withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); describe('Navigate transactions', function () { const ganacheOptions = { @@ -14,7 +15,9 @@ describe('Navigate transactions', function () { it('should navigate the unapproved transactions', async function () { await withFixtures( { - fixtures: 'navigate-transactions', + fixtures: new FixtureBuilder() + .withTransactionControllerMultipleTransactions() + .build(), ganacheOptions, title: this.test.title, }, @@ -102,7 +105,10 @@ describe('Navigate transactions', function () { await withFixtures( { dapp: true, - fixtures: 'navigate-transactions', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToTestDapp() + .withTransactionControllerMultipleTransactions() + .build(), ganacheOptions, title: this.test.title, }, @@ -149,7 +155,9 @@ describe('Navigate transactions', function () { it('should reject and remove an unapproved transaction', async function () { await withFixtures( { - fixtures: 'navigate-transactions', + fixtures: new FixtureBuilder() + .withTransactionControllerMultipleTransactions() + .build(), ganacheOptions, title: this.test.title, }, @@ -180,7 +188,9 @@ describe('Navigate transactions', function () { it('should confirm and remove an unapproved transaction', async function () { await withFixtures( { - fixtures: 'navigate-transactions', + fixtures: new FixtureBuilder() + .withTransactionControllerMultipleTransactions() + .build(), ganacheOptions, title: this.test.title, }, @@ -211,7 +221,9 @@ describe('Navigate transactions', function () { it('should reject and remove all unapproved transactions', async function () { await withFixtures( { - fixtures: 'navigate-transactions', + fixtures: new FixtureBuilder() + .withTransactionControllerMultipleTransactions() + .build(), ganacheOptions, title: this.test.title, }, diff --git a/test/e2e/tests/permissions.spec.js b/test/e2e/tests/permissions.spec.js index 16f786718..3ebcbf117 100644 --- a/test/e2e/tests/permissions.spec.js +++ b/test/e2e/tests/permissions.spec.js @@ -1,5 +1,6 @@ const { strict: assert } = require('assert'); const { convertToHexValue, withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); describe('Permissions', function () { it('sets permissions and connect to Dapp', async function () { @@ -16,7 +17,7 @@ describe('Permissions', function () { await withFixtures( { dapp: true, - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, }, diff --git a/test/e2e/tests/personal-sign.spec.js b/test/e2e/tests/personal-sign.spec.js index 040cde609..65f669e4c 100644 --- a/test/e2e/tests/personal-sign.spec.js +++ b/test/e2e/tests/personal-sign.spec.js @@ -1,5 +1,6 @@ const { strict: assert } = require('assert'); const { convertToHexValue, withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); describe('Personal sign', function () { it('can initiate and confirm a personal sign', async function () { @@ -16,7 +17,9 @@ describe('Personal sign', function () { await withFixtures( { dapp: true, - fixtures: 'connected-state', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToTestDapp() + .build(), ganacheOptions, title: this.test.title, }, diff --git a/test/e2e/tests/phishing-detection.spec.js b/test/e2e/tests/phishing-detection.spec.js index f1bc16297..897ad66ac 100644 --- a/test/e2e/tests/phishing-detection.spec.js +++ b/test/e2e/tests/phishing-detection.spec.js @@ -1,5 +1,6 @@ const { strict: assert } = require('assert'); const { convertToHexValue, withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); const PHISHFORT_CDN_URL = 'https://static.metafi.codefi.network/api/v1/lists/phishfort_hotlist.json'; @@ -43,7 +44,7 @@ describe('Phishing Detection', function () { it('should display the MetaMask Phishing Detection page and take the user to the blocked page if they continue', async function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, testSpecificMock: mockPhishingDetection, @@ -67,7 +68,7 @@ describe('Phishing Detection', function () { it('should display the MetaMask Phishing Detection page in an iframe and take the user to the blocked page if they continue', async function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, testSpecificMock: mockPhishingDetection, @@ -103,7 +104,7 @@ describe('Phishing Detection', function () { it('should display the MetaMask Phishing Detection page in an iframe but should NOT take the user to the blocked page if it is not an accessible resource', async function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, testSpecificMock: mockPhishingDetection, @@ -142,7 +143,7 @@ describe('Phishing Detection', function () { it('should display the MetaMask Phishing Detection page with the correct new issue link if the issue was detected from the phishfort list', async function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, testSpecificMock: mockPhishfortPhishingDetection, diff --git a/test/e2e/tests/portfolio-site.spec.js b/test/e2e/tests/portfolio-site.spec.js index c6cb09879..06b47ce4b 100644 --- a/test/e2e/tests/portfolio-site.spec.js +++ b/test/e2e/tests/portfolio-site.spec.js @@ -1,5 +1,6 @@ const { strict: assert } = require('assert'); const { convertToHexValue, withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); describe('Portfolio site', function () { const ganacheOptions = { @@ -15,7 +16,7 @@ describe('Portfolio site', function () { await withFixtures( { dapp: true, - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, }, diff --git a/test/e2e/tests/provider-api.spec.js b/test/e2e/tests/provider-api.spec.js index b85b4fb32..449f894bd 100644 --- a/test/e2e/tests/provider-api.spec.js +++ b/test/e2e/tests/provider-api.spec.js @@ -1,6 +1,7 @@ const { strict: assert } = require('assert'); const { errorCodes } = require('eth-rpc-errors'); const { convertToHexValue, withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); describe('MetaMask', function () { const ganacheOptions = { @@ -17,7 +18,9 @@ describe('MetaMask', function () { await withFixtures( { dapp: true, - fixtures: 'connected-state', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToTestDapp() + .build(), ganacheOptions, title: this.test.title, }, @@ -70,7 +73,9 @@ describe('MetaMask', function () { { dapp: true, failOnConsoleError: false, - fixtures: 'connected-state', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToTestDapp() + .build(), ganacheOptions, title: this.test.title, }, diff --git a/test/e2e/tests/send-edit.spec.js b/test/e2e/tests/send-edit.spec.js index 8060392f2..bd3c7120d 100644 --- a/test/e2e/tests/send-edit.spec.js +++ b/test/e2e/tests/send-edit.spec.js @@ -1,5 +1,6 @@ const { strict: assert } = require('assert'); const { convertToHexValue, withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); describe('Editing Confirm Transaction', function () { it('goes back from confirm page to edit eth value, gas price and gas limit', async function () { @@ -14,7 +15,9 @@ describe('Editing Confirm Transaction', function () { }; await withFixtures( { - fixtures: 'send-edit', + fixtures: new FixtureBuilder() + .withTransactionControllerTypeOneTransaction() + .build(), ganacheOptions, title: this.test.title, failOnConsoleError: false, @@ -92,7 +95,12 @@ describe('Editing Confirm Transaction', function () { }; await withFixtures( { - fixtures: 'send-edit-v2', + fixtures: new FixtureBuilder() + .withPreferencesController({ + eip1559V2Enabled: true, + }) + .withTransactionControllerTypeTwoTransaction() + .build(), ganacheOptions, title: this.test.title, failOnConsoleError: false, diff --git a/test/e2e/tests/send-eth.spec.js b/test/e2e/tests/send-eth.spec.js index f14bb1bc5..0833a1f85 100644 --- a/test/e2e/tests/send-eth.spec.js +++ b/test/e2e/tests/send-eth.spec.js @@ -1,5 +1,6 @@ const { strict: assert } = require('assert'); const { convertToHexValue, withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); describe('Send ETH from inside MetaMask using default gas', function () { const ganacheOptions = { @@ -14,7 +15,7 @@ describe('Send ETH from inside MetaMask using default gas', function () { it('finds the transaction in the transactions list', async function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, }, @@ -105,7 +106,13 @@ describe('Send ETH non-contract address with data that matches ERC20 transfer da it('renders the correct recipient on the confirmation screen', async function () { await withFixtures( { - fixtures: 'special-settings', + fixtures: new FixtureBuilder() + .withPreferencesController({ + featureFlags: { + sendHexData: true, + }, + }) + .build(), ganacheOptions, title: this.test.title, }, @@ -154,7 +161,7 @@ describe('Send ETH from inside MetaMask using advanced gas modal', function () { it('finds the transaction in the transactions list', async function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, }, @@ -221,7 +228,9 @@ describe('Send ETH from dapp using advanced gas controls', function () { await withFixtures( { dapp: true, - fixtures: 'connected-state', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToTestDapp() + .build(), ganacheOptions, title: this.test.title, }, diff --git a/test/e2e/tests/send-hex-address.spec.js b/test/e2e/tests/send-hex-address.spec.js index 5c5bbf0a9..ade462eb3 100644 --- a/test/e2e/tests/send-hex-address.spec.js +++ b/test/e2e/tests/send-hex-address.spec.js @@ -1,6 +1,7 @@ const { strict: assert } = require('assert'); const { convertToHexValue, withFixtures } = require('../helpers'); const { SMART_CONTRACTS } = require('../seeder/smart-contracts'); +const FixtureBuilder = require('../fixture-builder'); const hexPrefixedAddress = '0x2f318C334780961FB129D2a6c30D0763d9a5C970'; const nonHexPrefixedAddress = hexPrefixedAddress.substring(2); @@ -18,7 +19,7 @@ describe('Send ETH to a 40 character hexadecimal address', function () { it('should ensure the address is prefixed with 0x when pasted and should send ETH to a valid hexadecimal address', async function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, failOnConsoleError: false, @@ -69,7 +70,7 @@ describe('Send ETH to a 40 character hexadecimal address', function () { it('should ensure the address is prefixed with 0x when typed and should send ETH to a valid hexadecimal address', async function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, failOnConsoleError: false, @@ -134,7 +135,9 @@ describe('Send ERC20 to a 40 character hexadecimal address', function () { await withFixtures( { dapp: true, - fixtures: 'connected-state', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToTestDapp() + .build(), ganacheOptions, smartContract, title: this.test.title, @@ -223,7 +226,9 @@ describe('Send ERC20 to a 40 character hexadecimal address', function () { await withFixtures( { dapp: true, - fixtures: 'connected-state', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToTestDapp() + .build(), ganacheOptions, smartContract, title: this.test.title, diff --git a/test/e2e/tests/send-to-contract.spec.js b/test/e2e/tests/send-to-contract.spec.js index 1cdb47e43..e7dffa5e7 100644 --- a/test/e2e/tests/send-to-contract.spec.js +++ b/test/e2e/tests/send-to-contract.spec.js @@ -1,6 +1,7 @@ const { strict: assert } = require('assert'); const { convertToHexValue, withFixtures } = require('../helpers'); const { SMART_CONTRACTS } = require('../seeder/smart-contracts'); +const FixtureBuilder = require('../fixture-builder'); describe('Send ERC20 token to contract address', function () { const smartContract = SMART_CONTRACTS.HST; @@ -17,7 +18,9 @@ describe('Send ERC20 token to contract address', function () { await withFixtures( { dapp: true, - fixtures: 'connected-state', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToTestDapp() + .build(), ganacheOptions, smartContract, title: this.test.title, diff --git a/test/e2e/tests/settings-general.spec.js b/test/e2e/tests/settings-general.spec.js index e264f3771..bf4a1954d 100644 --- a/test/e2e/tests/settings-general.spec.js +++ b/test/e2e/tests/settings-general.spec.js @@ -1,5 +1,6 @@ const { strict: assert } = require('assert'); const { convertToHexValue, withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); describe('Settings', function () { const ganacheOptions = { @@ -15,7 +16,7 @@ describe('Settings', function () { it('checks jazzicon and blockies icons', async function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, }, diff --git a/test/e2e/tests/settings-search.spec.js b/test/e2e/tests/settings-search.spec.js index 69ac23ec0..b4c3ab278 100644 --- a/test/e2e/tests/settings-search.spec.js +++ b/test/e2e/tests/settings-search.spec.js @@ -1,5 +1,6 @@ const { strict: assert } = require('assert'); const { convertToHexValue, withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); describe('Settings Search', function () { const ganacheOptions = { @@ -25,7 +26,7 @@ describe('Settings Search', function () { it('should find element inside the General tab', async function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, }, @@ -51,7 +52,7 @@ describe('Settings Search', function () { it('should find element inside the Advanced tab', async function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, }, @@ -78,7 +79,7 @@ describe('Settings Search', function () { it('should find element inside the Contacts tab', async function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, }, @@ -105,7 +106,7 @@ describe('Settings Search', function () { it('should find element inside the Security tab', async function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, }, @@ -132,7 +133,7 @@ describe('Settings Search', function () { it('should find element inside the Alerts tab', async function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, }, @@ -159,7 +160,7 @@ describe('Settings Search', function () { it('should find element inside the Networks tab', async function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, }, @@ -186,7 +187,7 @@ describe('Settings Search', function () { it('should find element inside the Experimental tab', async function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, }, @@ -213,7 +214,7 @@ describe('Settings Search', function () { it('should find element inside the About tab', async function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, }, @@ -240,7 +241,7 @@ describe('Settings Search', function () { it('should display "Element not found" for a non-existing element', async function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, }, diff --git a/test/e2e/tests/signature-request.spec.js b/test/e2e/tests/signature-request.spec.js index 1de8409a1..38141527b 100644 --- a/test/e2e/tests/signature-request.spec.js +++ b/test/e2e/tests/signature-request.spec.js @@ -4,6 +4,7 @@ const { withFixtures, regularDelayMs, } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); describe('Sign Typed Data V4 Signature Request', function () { it('can initiate and confirm a Signature Request', async function () { @@ -20,7 +21,9 @@ describe('Sign Typed Data V4 Signature Request', function () { await withFixtures( { dapp: true, - fixtures: 'connected-state', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToTestDapp() + .build(), ganacheOptions, title: this.test.title, }, @@ -102,7 +105,9 @@ describe('Sign Typed Data V3 Signature Request', function () { await withFixtures( { dapp: true, - fixtures: 'connected-state', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToTestDapp() + .build(), ganacheOptions, title: this.test.title, }, @@ -180,7 +185,9 @@ describe('Sign Typed Data Signature Request', function () { await withFixtures( { dapp: true, - fixtures: 'connected-state', + fixtures: new FixtureBuilder() + .withPermissionControllerConnectedToTestDapp() + .build(), ganacheOptions, title: this.test.title, }, diff --git a/test/e2e/tests/simple-send.spec.js b/test/e2e/tests/simple-send.spec.js index 2d26a1871..c40add66d 100644 --- a/test/e2e/tests/simple-send.spec.js +++ b/test/e2e/tests/simple-send.spec.js @@ -1,4 +1,5 @@ const { convertToHexValue, withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); describe('Simple send', function () { it('can send a simple transaction from one account to another', async function () { @@ -12,7 +13,11 @@ describe('Simple send', function () { ], }; await withFixtures( - { fixtures: 'imported-account', ganacheOptions, title: this.test.title }, + { + fixtures: new FixtureBuilder().build(), + ganacheOptions, + title: this.test.title, + }, async ({ driver }) => { await driver.navigate(); await driver.fill('#password', 'correct horse battery staple'); diff --git a/test/e2e/tests/state-logs.spec.js b/test/e2e/tests/state-logs.spec.js index ae42abfc1..9b82b0a00 100644 --- a/test/e2e/tests/state-logs.spec.js +++ b/test/e2e/tests/state-logs.spec.js @@ -5,6 +5,7 @@ const { withFixtures, createDownloadFolder, } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); const downloadsFolder = `${process.cwd()}/test-artifacts/downloads`; @@ -31,7 +32,7 @@ describe('State logs', function () { it('should download state logs for the account', async function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, failOnConsoleError: false, diff --git a/test/e2e/tests/swap-eth.spec.js b/test/e2e/tests/swap-eth.spec.js index 771a5e050..b165e4c44 100644 --- a/test/e2e/tests/swap-eth.spec.js +++ b/test/e2e/tests/swap-eth.spec.js @@ -1,5 +1,6 @@ const { strict: assert } = require('assert'); const { withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); describe('Swap Eth for another Token', function () { const ganacheOptions = { @@ -14,7 +15,7 @@ describe('Swap Eth for another Token', function () { it('Completes a Swap between Eth and Matic', async function () { await withFixtures( { - fixtures: 'special-settings', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, failOnConsoleError: false, diff --git a/test/e2e/tests/threebox.spec.js b/test/e2e/tests/threebox.spec.js index 162108e80..af60b0be0 100644 --- a/test/e2e/tests/threebox.spec.js +++ b/test/e2e/tests/threebox.spec.js @@ -1,5 +1,6 @@ const { convertToHexValue, withFixtures, largeDelayMs } = require('../helpers'); const ThreeboxMockServer = require('../mock-3box/threebox-mock-server'); +const FixtureBuilder = require('../fixture-builder'); describe('Threebox', function () { const ganacheOptions = { @@ -23,7 +24,7 @@ describe('Threebox', function () { it('Set up data to be restored by 3box', async function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, }, @@ -67,7 +68,16 @@ describe('Threebox', function () { it('Restore from 3box', async function () { await withFixtures( { - fixtures: 'threebox-enabled', + fixtures: new FixtureBuilder() + .withThreeBoxController({ + threeBoxSyncingAllowed: true, + showRestorePrompt: true, + threeBoxLastUpdated: 0, + threeBoxAddress: '0x64480aa2768ef12f3f19c5a01206ceb0f82d06b9', + threeBoxSynced: true, + threeBoxDisabled: false, + }) + .build(), ganacheOptions, title: this.test.title, }, diff --git a/test/e2e/tests/token-details.spec.js b/test/e2e/tests/token-details.spec.js index fd93d7d0f..56372bc0a 100644 --- a/test/e2e/tests/token-details.spec.js +++ b/test/e2e/tests/token-details.spec.js @@ -1,5 +1,6 @@ const { strict: assert } = require('assert'); const { convertToHexValue, withFixtures } = require('../helpers'); +const FixtureBuilder = require('../fixture-builder'); describe('Token Details', function () { const ganacheOptions = { @@ -14,7 +15,7 @@ describe('Token Details', function () { it('should show token details for an imported token', async function () { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, title: this.test.title, }, diff --git a/test/e2e/user-actions-benchmark.js b/test/e2e/user-actions-benchmark.js index f91f6c318..821e1b92a 100644 --- a/test/e2e/user-actions-benchmark.js +++ b/test/e2e/user-actions-benchmark.js @@ -8,6 +8,7 @@ const { getFirstParentDirectoryThatExists, } = require('../helpers/file'); const { convertToHexValue, withFixtures } = require('./helpers'); +const FixtureBuilder = require('./fixture-builder'); const ganacheOptions = { accounts: [ @@ -24,7 +25,7 @@ async function loadNewAccount() { await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, }, async ({ driver }) => { @@ -52,7 +53,7 @@ async function confirmTx() { let loadingTimes; await withFixtures( { - fixtures: 'imported-account', + fixtures: new FixtureBuilder().build(), ganacheOptions, }, async ({ driver }) => {