diff --git a/CHANGELOG.md b/CHANGELOG.md index 092e55e4f89b..29ffea7f9a81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [11.8.0] +### Added +- Enhanced the Networks List with drag and drop functionality ([#21163] (https://github.com/MetaMask/metamask-extension/pull/21163)) +- Added a deprecation warning for the Aurora network to inform users about its upcoming removal ([#21933] (https://github.com/MetaMask/metamask-extension/pull/21933)) + +### Changed +- Corrected a typo and improved the alignment of 'Terms of use' ([#22227] (https://github.com/MetaMask/metamask-extension/pull/22227)) +- Changed the title of MetaMask pop-up window to 'MetaMask Dialog' ([#21680] (https://github.com/MetaMask/metamask-extension/pull/21680)) +- Refined the Max fee calculation in Smart Swaps to ensure it does not exceed twice the estimated gas fee ([#22127] (https://github.com/MetaMask/metamask-extension/pull/22127)) +- [MMI] Enabled the Cancel and Speed Up options for non-custodial accounts in MetaMask Institutional ([#22164] (https://github.com/MetaMask/metamask-extension/pull/22164)) +- [MMI] Updated Consensys URLs from .net to .io ([#22107] (https://github.com/MetaMask/metamask-extension/pull/22107)) +- [FLASK] Updated the background color of the Snap Avatar ([#22137] (https://github.com/MetaMask/metamask-extension/pull/22137)) +- [FLASK] Updated the color of the tooltip icon in the transaction confirmation section ([#22144] (https://github.com/MetaMask/metamask-extension/pull/22144)) +- [FLASK] Updated the weighting of permissions ([#22063] (https://github.com/MetaMask/metamask-extension/pull/22063)) + +### Fixed +- Improved the token autodetection feature to automatically trigger detection when the setting is enabled ([#21749] (https://github.com/MetaMask/metamask-extension/pull/21749)) +- Fixed an issue causing duplicate entries for confirmed incoming transactions ([#21840] (https://github.com/MetaMask/metamask-extension/pull/21840)) +- Fixed a rounding issue causing incorrect gas fee displays on the Optimism network ([#19960] (https://github.com/MetaMask/metamask-extension/pull/19960)) +- Fixed an issue causing incorrect EIP-6963 provider names in MetaMask production builds ([#22090] (https://github.com/MetaMask/metamask-extension/pull/22090)) +- Fixed a crash that occurred when the list of ordered networks was empty ([#22109] (https://github.com/MetaMask/metamask-extension/pull/22109)) +- Fixed an issue where the settings search function only supported English and numbers ([#21013] (https://github.com/MetaMask/metamask-extension/pull/21013)) + +## [11.7.5] +### Fixed +- Fix compatability of MetaMask Extension and Chrome versions v122 and higher [#22590](https://github.com/MetaMask/metamask-extension/pull/22590) + +## [11.7.4] + ## [11.7.3] ### Fixed - Ensure fiat token balances are displayed on the homescreen [#22295](https://github.com/MetaMask/metamask-extension/pull/22295) @@ -4266,7 +4295,10 @@ Update styles and spacing on the critical error page ([#20350](https://github.c ### Uncategorized - Added the ability to restore accounts from seed words. -[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v11.7.3...HEAD +[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v11.8.0...HEAD +[11.8.0]: https://github.com/MetaMask/metamask-extension/compare/v11.7.5...v11.8.0 +[11.7.5]: https://github.com/MetaMask/metamask-extension/compare/v11.7.4...v11.7.5 +[11.7.4]: https://github.com/MetaMask/metamask-extension/compare/v11.7.3...v11.7.4 [11.7.3]: https://github.com/MetaMask/metamask-extension/compare/v11.7.2...v11.7.3 [11.7.2]: https://github.com/MetaMask/metamask-extension/compare/v11.7.1...v11.7.2 [11.7.1]: https://github.com/MetaMask/metamask-extension/compare/v11.7.0...v11.7.1 diff --git a/app/scripts/controllers/app-state.js b/app/scripts/controllers/app-state.js index 8f4f8a834d86..5a05425e7e91 100644 --- a/app/scripts/controllers/app-state.js +++ b/app/scripts/controllers/app-state.js @@ -442,6 +442,21 @@ export default class AppStateController extends EventEmitter { }, }); } + + /** + * Set the setCustodianDeepLink with the fromAddress and custodyId + * + * @param {object} opts + * @param opts.fromAddress + * @param opts.custodyId + * @returns {void} + */ + setCustodianDeepLink({ fromAddress, custodyId }) { + this.store.updateState({ + custodianDeepLink: { fromAddress, custodyId }, + }); + } + ///: END:ONLY_INCLUDE_IF addSignatureSecurityAlertResponse(securityAlertResponse) { diff --git a/app/scripts/controllers/app-state.test.js b/app/scripts/controllers/app-state.test.js index 5e88c47d68e8..82c42d46d314 100644 --- a/app/scripts/controllers/app-state.test.js +++ b/app/scripts/controllers/app-state.test.js @@ -314,4 +314,44 @@ describe('AppStateController', () => { updateStateSpy.mockRestore(); }); }); + + describe('institutional', () => { + it('set the interactive replacement token with a url and the old refresh token', () => { + appStateController = createAppStateController(); + const updateStateSpy = jest.spyOn( + appStateController.store, + 'updateState', + ); + + const mockParams = { url: 'https://example.com', oldRefreshToken: 'old' }; + + appStateController.showInteractiveReplacementTokenBanner(mockParams); + + expect(updateStateSpy).toHaveBeenCalledTimes(1); + expect(updateStateSpy).toHaveBeenCalledWith({ + interactiveReplacementToken: mockParams, + }); + + updateStateSpy.mockRestore(); + }); + + it('set the setCustodianDeepLink with the fromAddress and custodyId', () => { + appStateController = createAppStateController(); + const updateStateSpy = jest.spyOn( + appStateController.store, + 'updateState', + ); + + const mockParams = { fromAddress: '0x', custodyId: 'custodyId' }; + + appStateController.setCustodianDeepLink(mockParams); + + expect(updateStateSpy).toHaveBeenCalledTimes(1); + expect(updateStateSpy).toHaveBeenCalledWith({ + custodianDeepLink: mockParams, + }); + + updateStateSpy.mockRestore(); + }); + }); }); diff --git a/app/scripts/controllers/mmi-controller.js b/app/scripts/controllers/mmi-controller.js index 6b579e88216e..304b21569fb6 100644 --- a/app/scripts/controllers/mmi-controller.js +++ b/app/scripts/controllers/mmi-controller.js @@ -619,6 +619,11 @@ export default class MMIController extends EventEmitter { signOperation, true, ); + + this.appStateController.setCustodianDeepLink({ + fromAddress: signature.from, + custodyId: signature.custodian_transactionId, + }); } this.signatureController.setMessageMetadata(messageId, signature); diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js index 5f8896e03dbc..d2f6320d5941 100644 --- a/app/scripts/metamask-controller.js +++ b/app/scripts/metamask-controller.js @@ -3130,6 +3130,8 @@ export default class MetamaskController extends EventEmitter { appStateController.showInteractiveReplacementTokenBanner.bind( appStateController, ), + setCustodianDeepLink: + appStateController.setCustodianDeepLink.bind(appStateController), ///: END:ONLY_INCLUDE_IF ///: BEGIN:ONLY_INCLUDE_IF(snaps) @@ -4907,7 +4909,7 @@ export default class MetamaskController extends EventEmitter { origin, ), getIsLocked: () => { - return !this.appStateController.isUnlocked; + return !this.appStateController.isUnlocked(); }, ///: END:ONLY_INCLUDE_IF ///: BEGIN:ONLY_INCLUDE_IF(keyring-snaps) diff --git a/package.json b/package.json index ef662f93972f..91f5ec484674 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "metamask-crx", - "version": "11.7.3", + "version": "11.8.0", "private": true, "repository": { "type": "git", diff --git a/test/e2e/accounts/common.ts b/test/e2e/accounts/common.ts index 44f70ca3f3de..7ed33d573020 100644 --- a/test/e2e/accounts/common.ts +++ b/test/e2e/accounts/common.ts @@ -34,7 +34,6 @@ export const accountSnapFixtures = (title: string | undefined) => { }) .build(), ganacheOptions: multipleGanacheOptions, - failOnConsoleError: false, title, }; }; diff --git a/test/e2e/accounts/create-snap-account.spec.ts b/test/e2e/accounts/create-snap-account.spec.ts index e47f5870acf2..e53e89937139 100644 --- a/test/e2e/accounts/create-snap-account.spec.ts +++ b/test/e2e/accounts/create-snap-account.spec.ts @@ -16,7 +16,6 @@ describe('Create Snap Account', function (this: Suite) { { fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, - failOnConsoleError: false, title: this.test?.fullTitle(), }, async ({ driver }: { driver: Driver }) => { @@ -95,7 +94,6 @@ describe('Create Snap Account', function (this: Suite) { { fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, - failOnConsoleError: false, title: this.test?.fullTitle(), }, async ({ driver }: { driver: Driver }) => { @@ -188,7 +186,6 @@ describe('Create Snap Account', function (this: Suite) { { fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, - failOnConsoleError: false, title: this.test?.fullTitle(), }, async ({ driver }: { driver: Driver }) => { diff --git a/test/e2e/accounts/remove-account-snap.spec.ts b/test/e2e/accounts/remove-account-snap.spec.ts index dc22d117783d..51039f69d573 100644 --- a/test/e2e/accounts/remove-account-snap.spec.ts +++ b/test/e2e/accounts/remove-account-snap.spec.ts @@ -10,7 +10,6 @@ describe('Remove Account Snap', function (this: Suite) { { fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, - failOnConsoleError: false, title: this.test?.fullTitle(), }, async ({ driver }: { driver: Driver }) => { diff --git a/test/e2e/accounts/smart-swap-disabled.spec.ts b/test/e2e/accounts/smart-swap-disabled.spec.ts new file mode 100644 index 000000000000..a9f3493ec76d --- /dev/null +++ b/test/e2e/accounts/smart-swap-disabled.spec.ts @@ -0,0 +1,26 @@ +import { title } from 'process'; +import { Suite } from 'mocha'; +import { withFixtures } from '../helpers'; +import { Driver } from '../webdriver/driver'; +import { + accountSnapFixtures, + installSnapSimpleKeyring, + makeNewAccountAndSwitch, +} from './common'; + +describe('Smart Swaps', function (this: Suite) { + it('should be disabled for snap accounts', async function () { + await withFixtures( + accountSnapFixtures(title), + async ({ driver }: { driver: Driver }) => { + await installSnapSimpleKeyring(driver, false); + await makeNewAccountAndSwitch(driver); + await driver.clickElement('[data-testid="token-overview-button-swap"]'); + await driver.clickElement('[title="Transaction settings"]'); + await driver.assertElementNotPresent( + '[data-testid="transaction-settings-smart-swaps-toggle"]', + ); + }, + ); + }); +}); diff --git a/test/e2e/accounts/snap-account-settings.spec.ts b/test/e2e/accounts/snap-account-settings.spec.ts index d84e1b71349c..2d5811528b10 100644 --- a/test/e2e/accounts/snap-account-settings.spec.ts +++ b/test/e2e/accounts/snap-account-settings.spec.ts @@ -9,7 +9,6 @@ describe('Add snap account experimental settings', function (this: Suite) { { fixtures: new FixtureBuilder().build(), title: this.test?.fullTitle(), - failOnConsoleError: false, }, async ({ driver }: { driver: Driver }) => { await driver.navigate(); diff --git a/test/e2e/accounts/snap-account-signatures-and-disconnects.spec.ts b/test/e2e/accounts/snap-account-signatures-and-disconnects.spec.ts index ecf8826b007d..d00540360317 100644 --- a/test/e2e/accounts/snap-account-signatures-and-disconnects.spec.ts +++ b/test/e2e/accounts/snap-account-signatures-and-disconnects.spec.ts @@ -17,7 +17,6 @@ describe('Snap Account Signatures and Disconnects', function (this: Suite) { dapp: true, fixtures: new FixtureBuilder().build(), ganacheOptions: multipleGanacheOptions, - failOnConsoleError: false, title: this.test?.fullTitle(), }, async ({ driver }: { driver: Driver }) => { diff --git a/test/e2e/helpers.js b/test/e2e/helpers.js index 13b583c8aec8..5f2e133b3fc9 100644 --- a/test/e2e/helpers.js +++ b/test/e2e/helpers.js @@ -37,7 +37,7 @@ async function withFixtures(options, testSuite) { driverOptions, dappOptions, title, - failOnConsoleError = true, + ignoredConsoleErrors = [], dappPath = undefined, dappPaths, testSpecificMock = function () { @@ -125,8 +125,8 @@ async function withFixtures(options, testSuite) { webDriver = driver.driver; if (process.env.SELENIUM_BROWSER === 'chrome') { - await driver.checkBrowserForExceptions(failOnConsoleError); - await driver.checkBrowserForConsoleErrors(failOnConsoleError); + await driver.checkBrowserForExceptions(ignoredConsoleErrors); + await driver.checkBrowserForConsoleErrors(ignoredConsoleErrors); } let driverProxy; @@ -160,7 +160,7 @@ async function withFixtures(options, testSuite) { }); const errorsAndExceptions = driver.summarizeErrorsAndExceptions(); - if (errorsAndExceptions && failOnConsoleError) { + if (errorsAndExceptions) { throw new Error(errorsAndExceptions); } diff --git a/test/e2e/mv3-perf-stats/init-load-stats.js b/test/e2e/mv3-perf-stats/init-load-stats.js index 0b4078d532aa..f9975557d3af 100755 --- a/test/e2e/mv3-perf-stats/init-load-stats.js +++ b/test/e2e/mv3-perf-stats/init-load-stats.js @@ -22,7 +22,7 @@ async function profilePageLoad() { const parsedLogs = {}; try { await withFixtures( - { fixtures: new FixtureBuilder().build(), failOnConsoleError: false }, + { fixtures: new FixtureBuilder().build() }, async ({ driver }) => { await driver.delay(tinyDelayMs); await driver.navigate(); diff --git a/test/e2e/snaps/test-snap-bip-32.spec.js b/test/e2e/snaps/test-snap-bip-32.spec.js index 9578dc64469d..81125f9fbaef 100644 --- a/test/e2e/snaps/test-snap-bip-32.spec.js +++ b/test/e2e/snaps/test-snap-bip-32.spec.js @@ -14,7 +14,6 @@ describe('Test Snap bip-32', function () { { fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, - failOnConsoleError: false, title: this.test.fullTitle(), }, async ({ driver }) => { diff --git a/test/e2e/snaps/test-snap-bip-44.spec.js b/test/e2e/snaps/test-snap-bip-44.spec.js index 8e6d2e14f36b..a7150db09611 100644 --- a/test/e2e/snaps/test-snap-bip-44.spec.js +++ b/test/e2e/snaps/test-snap-bip-44.spec.js @@ -14,7 +14,6 @@ describe('Test Snap bip-44', function () { { fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, - failOnConsoleError: false, title: this.test.fullTitle(), }, async ({ driver }) => { diff --git a/test/e2e/snaps/test-snap-cronjob.spec.js b/test/e2e/snaps/test-snap-cronjob.spec.js index 6a40146f6169..b1a437ccae9c 100644 --- a/test/e2e/snaps/test-snap-cronjob.spec.js +++ b/test/e2e/snaps/test-snap-cronjob.spec.js @@ -13,7 +13,6 @@ describe('Test Snap Cronjob', function () { { fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, - failOnConsoleError: false, title: this.test.fullTitle(), }, async ({ driver }) => { diff --git a/test/e2e/snaps/test-snap-dialog.spec.js b/test/e2e/snaps/test-snap-dialog.spec.js index 4274e5810660..bf8a2fe47b5c 100644 --- a/test/e2e/snaps/test-snap-dialog.spec.js +++ b/test/e2e/snaps/test-snap-dialog.spec.js @@ -13,7 +13,6 @@ describe('Test Snap Dialog', function () { { fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, - failOnConsoleError: false, title: this.test.fullTitle(), }, async ({ driver }) => { diff --git a/test/e2e/snaps/test-snap-ethprovider.spec.js b/test/e2e/snaps/test-snap-ethprovider.spec.js index 59e772f4cbba..93fb6d2249d4 100644 --- a/test/e2e/snaps/test-snap-ethprovider.spec.js +++ b/test/e2e/snaps/test-snap-ethprovider.spec.js @@ -13,7 +13,6 @@ describe('Test Snap ethereum_provider', function () { { fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, - failOnConsoleError: false, title: this.test.fullTitle(), }, async ({ driver }) => { diff --git a/test/e2e/snaps/test-snap-get-file.spec.js b/test/e2e/snaps/test-snap-get-file.spec.js index 19cec53f3d64..9317ff0d5f82 100644 --- a/test/e2e/snaps/test-snap-get-file.spec.js +++ b/test/e2e/snaps/test-snap-get-file.spec.js @@ -13,7 +13,6 @@ describe('Test Snap Get File', function () { { fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, - failOnConsoleError: false, title: this.test.title, }, async ({ driver }) => { diff --git a/test/e2e/snaps/test-snap-get-locale.spec.js b/test/e2e/snaps/test-snap-get-locale.spec.js index 7bb49afed60f..0bcc9dea660f 100644 --- a/test/e2e/snaps/test-snap-get-locale.spec.js +++ b/test/e2e/snaps/test-snap-get-locale.spec.js @@ -13,7 +13,6 @@ describe('Test Snap Get Locale', function () { { fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, - failOnConsoleError: false, title: this.test.fullTitle(), }, async ({ driver }) => { diff --git a/test/e2e/snaps/test-snap-getentropy.spec.js b/test/e2e/snaps/test-snap-getentropy.spec.js index c37b03bce15c..07bcb551e271 100644 --- a/test/e2e/snaps/test-snap-getentropy.spec.js +++ b/test/e2e/snaps/test-snap-getentropy.spec.js @@ -13,7 +13,6 @@ describe('Test Snap getEntropy', function () { { fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, - failOnConsoleError: false, title: this.test.fullTitle(), }, async ({ driver }) => { diff --git a/test/e2e/snaps/test-snap-homepage.spec.js b/test/e2e/snaps/test-snap-homepage.spec.js index d7a4a0f103c6..a16022ea9052 100644 --- a/test/e2e/snaps/test-snap-homepage.spec.js +++ b/test/e2e/snaps/test-snap-homepage.spec.js @@ -13,7 +13,6 @@ describe('Test Snap Homepage', function () { { fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, - failOnConsoleError: false, title: this.test.fullTitle(), }, async ({ driver }) => { diff --git a/test/e2e/snaps/test-snap-installed.spec.js b/test/e2e/snaps/test-snap-installed.spec.js index 0ac866c88a9b..59fbda63fc71 100644 --- a/test/e2e/snaps/test-snap-installed.spec.js +++ b/test/e2e/snaps/test-snap-installed.spec.js @@ -46,7 +46,6 @@ describe('Test Snap Installed', function () { }) .build(), ganacheOptions: defaultGanacheOptions, - failOnConsoleError: false, title: this.test.fullTitle(), testSpecificMock: mockSegment, }, diff --git a/test/e2e/snaps/test-snap-lifecycle.spec.js b/test/e2e/snaps/test-snap-lifecycle.spec.js index 65b10a5ddfad..15e9ad301649 100644 --- a/test/e2e/snaps/test-snap-lifecycle.spec.js +++ b/test/e2e/snaps/test-snap-lifecycle.spec.js @@ -13,7 +13,6 @@ describe('Test Snap Lifecycle Hooks', function () { { fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, - failOnConsoleError: false, title: this.test.fullTitle(), }, async ({ driver }) => { diff --git a/test/e2e/snaps/test-snap-management.spec.js b/test/e2e/snaps/test-snap-management.spec.js index 8cc73d005c84..a4c7414eaf96 100644 --- a/test/e2e/snaps/test-snap-management.spec.js +++ b/test/e2e/snaps/test-snap-management.spec.js @@ -13,7 +13,6 @@ describe('Test Snap Management', function () { { fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, - failOnConsoleError: false, title: this.test.fullTitle(), }, async ({ driver }) => { diff --git a/test/e2e/snaps/test-snap-managestate.spec.js b/test/e2e/snaps/test-snap-managestate.spec.js index 804bd6b7e603..d6afe253d3bb 100644 --- a/test/e2e/snaps/test-snap-managestate.spec.js +++ b/test/e2e/snaps/test-snap-managestate.spec.js @@ -13,7 +13,6 @@ describe('Test Snap manageState', function () { { fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, - failOnConsoleError: false, title: this.test.fullTitle(), }, async ({ driver }) => { diff --git a/test/e2e/snaps/test-snap-namelookup.spec.js b/test/e2e/snaps/test-snap-namelookup.spec.js index fd1eee6e685c..07a4b3bb0b87 100644 --- a/test/e2e/snaps/test-snap-namelookup.spec.js +++ b/test/e2e/snaps/test-snap-namelookup.spec.js @@ -13,7 +13,6 @@ describe('Test Snap Name Lookup', function () { { fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, - failOnConsoleError: false, title: this.test.fullTitle(), }, async ({ driver }) => { diff --git a/test/e2e/snaps/test-snap-networkaccess.spec.js b/test/e2e/snaps/test-snap-networkaccess.spec.js index 0fdd30ee207a..83a40ca9595b 100644 --- a/test/e2e/snaps/test-snap-networkaccess.spec.js +++ b/test/e2e/snaps/test-snap-networkaccess.spec.js @@ -13,7 +13,6 @@ describe('Test Snap networkAccess', function () { { fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, - failOnConsoleError: false, title: this.test.fullTitle(), }, async ({ driver }) => { diff --git a/test/e2e/snaps/test-snap-notification.spec.js b/test/e2e/snaps/test-snap-notification.spec.js index 62f42d9dbf43..4255222ad974 100644 --- a/test/e2e/snaps/test-snap-notification.spec.js +++ b/test/e2e/snaps/test-snap-notification.spec.js @@ -13,7 +13,6 @@ describe('Test Snap Notification', function () { { fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, - failOnConsoleError: false, title: this.test.fullTitle(), }, async ({ driver }) => { diff --git a/test/e2e/snaps/test-snap-revoke-perm.spec.js b/test/e2e/snaps/test-snap-revoke-perm.spec.js index 6245f3dfea9a..608137ec9bd0 100644 --- a/test/e2e/snaps/test-snap-revoke-perm.spec.js +++ b/test/e2e/snaps/test-snap-revoke-perm.spec.js @@ -14,7 +14,6 @@ describe('Test Snap revoke permission', function () { { fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, - failOnConsoleError: false, title: this.test.fullTitle(), }, async ({ driver }) => { diff --git a/test/e2e/snaps/test-snap-rpc.spec.js b/test/e2e/snaps/test-snap-rpc.spec.js index 0c13be60722b..3f6102aca281 100644 --- a/test/e2e/snaps/test-snap-rpc.spec.js +++ b/test/e2e/snaps/test-snap-rpc.spec.js @@ -13,7 +13,6 @@ describe('Test Snap RPC', function () { { fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, - failOnConsoleError: false, title: this.test.fullTitle(), }, async ({ driver }) => { diff --git a/test/e2e/snaps/test-snap-txinsights-v2.spec.js b/test/e2e/snaps/test-snap-txinsights-v2.spec.js index 3cf1e6406956..132f5dea807e 100644 --- a/test/e2e/snaps/test-snap-txinsights-v2.spec.js +++ b/test/e2e/snaps/test-snap-txinsights-v2.spec.js @@ -13,7 +13,6 @@ describe('Test Snap TxInsights-v2', function () { { fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, - failOnConsoleError: false, title: this.test.fullTitle(), }, async ({ driver }) => { diff --git a/test/e2e/snaps/test-snap-txinsights.spec.js b/test/e2e/snaps/test-snap-txinsights.spec.js index ab2fb0b16fdc..57739cddbe48 100644 --- a/test/e2e/snaps/test-snap-txinsights.spec.js +++ b/test/e2e/snaps/test-snap-txinsights.spec.js @@ -13,7 +13,6 @@ describe('Test Snap TxInsights', function () { { fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, - failOnConsoleError: false, title: this.test.fullTitle(), }, async ({ driver }) => { diff --git a/test/e2e/snaps/test-snap-update-component.spec.js b/test/e2e/snaps/test-snap-update-component.spec.js index c3dfc5dc5203..81154c7afce1 100644 --- a/test/e2e/snaps/test-snap-update-component.spec.js +++ b/test/e2e/snaps/test-snap-update-component.spec.js @@ -21,7 +21,6 @@ describe('Test Snap update via snaps component', function () { { fixtures: new FixtureBuilder().build(), ganacheOptions, - failOnConsoleError: false, title: this.test.fullTitle(), }, async ({ driver }) => { diff --git a/test/e2e/snaps/test-snap-update.spec.js b/test/e2e/snaps/test-snap-update.spec.js index 366ee6d8e734..9b73110ded73 100644 --- a/test/e2e/snaps/test-snap-update.spec.js +++ b/test/e2e/snaps/test-snap-update.spec.js @@ -13,7 +13,6 @@ describe('Test Snap update', function () { { fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, - failOnConsoleError: false, title: this.test.fullTitle(), }, async ({ driver }) => { diff --git a/test/e2e/snaps/test-snap-wasm.spec.js b/test/e2e/snaps/test-snap-wasm.spec.js index 4b18e83eb968..3e21bc696aba 100644 --- a/test/e2e/snaps/test-snap-wasm.spec.js +++ b/test/e2e/snaps/test-snap-wasm.spec.js @@ -13,7 +13,6 @@ describe('Test Snap WASM', function () { { fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, - failOnConsoleError: false, title: this.test.fullTitle(), }, async ({ driver }) => { diff --git a/test/e2e/tests/account-menu/account-details.spec.js b/test/e2e/tests/account-menu/account-details.spec.js index bbb0be897bee..e5da7af7c0bd 100644 --- a/test/e2e/tests/account-menu/account-details.spec.js +++ b/test/e2e/tests/account-menu/account-details.spec.js @@ -177,7 +177,7 @@ describe('Show account details', function () { { fixtures: new FixtureBuilder().build(), title: this.test.fullTitle(), - failOnConsoleError: false, + ignoredConsoleErrors: ['Error in verifying password'], }, async ({ driver }) => { await unlockWallet(driver); diff --git a/test/e2e/tests/account-menu/add-account.spec.js b/test/e2e/tests/account-menu/add-account.spec.js index 3f1351f6d273..dd4c76a931bf 100644 --- a/test/e2e/tests/account-menu/add-account.spec.js +++ b/test/e2e/tests/account-menu/add-account.spec.js @@ -61,7 +61,6 @@ describe('Add account', function () { fixtures: new FixtureBuilder({ onboarding: true }).build(), ganacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver }) => { await driver.navigate(); diff --git a/test/e2e/tests/backup-restore.spec.js b/test/e2e/tests/backup-restore.spec.js index 67094dd16ed6..2f7fef0961ff 100644 --- a/test/e2e/tests/backup-restore.spec.js +++ b/test/e2e/tests/backup-restore.spec.js @@ -57,7 +57,6 @@ describe('Backup and Restore', function () { fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver }) => { await createDownloadFolder(downloadsFolder); diff --git a/test/e2e/tests/change-language.spec.js b/test/e2e/tests/change-language.spec.js index d25f52e10719..c2c6656a4bd9 100644 --- a/test/e2e/tests/change-language.spec.js +++ b/test/e2e/tests/change-language.spec.js @@ -49,7 +49,6 @@ describe('Settings - general tab, validate the change language functionality:', fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver }) => { @@ -73,7 +72,6 @@ describe('Settings - general tab, validate the change language functionality:', fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver }) => { @@ -117,7 +115,6 @@ describe('Settings - general tab, validate the change language functionality:', fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver }) => { @@ -154,7 +151,6 @@ describe('Settings - general tab, validate the change language functionality:', fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver }) => { @@ -210,7 +206,6 @@ describe('Settings - general tab, validate the change language functionality:', fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver }) => { @@ -244,7 +239,6 @@ describe('Settings - general tab, validate the change language functionality:', fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver }) => { @@ -282,7 +276,6 @@ describe('Settings - general tab, validate the change language functionality:', fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver }) => { @@ -311,7 +304,6 @@ describe('Settings - general tab, validate the change language functionality:', fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver }) => { await unlockWallet(driver); diff --git a/test/e2e/tests/custom-rpc-history.spec.js b/test/e2e/tests/custom-rpc-history.spec.js index ce8ed34185b5..3fa26e7b5d48 100644 --- a/test/e2e/tests/custom-rpc-history.spec.js +++ b/test/e2e/tests/custom-rpc-history.spec.js @@ -114,7 +114,6 @@ describe('Custom RPC history', function () { fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver }) => { await unlockWallet(driver); @@ -262,7 +261,6 @@ describe('Custom RPC history', function () { .build(), ganacheOptions: defaultGanacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver }) => { await unlockWallet(driver); diff --git a/test/e2e/tests/errors.spec.js b/test/e2e/tests/errors.spec.js index 4f1901c65c63..2ac8bce4dd71 100644 --- a/test/e2e/tests/errors.spec.js +++ b/test/e2e/tests/errors.spec.js @@ -226,7 +226,6 @@ describe('Sentry errors', function () { }, ganacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, testSpecificMock: mockSentryMigratorError, }, async ({ driver, mockedEndpoint }) => { @@ -254,7 +253,6 @@ describe('Sentry errors', function () { .build(), ganacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, testSpecificMock: mockSentryTestError, }, async ({ driver, mockedEndpoint }) => { @@ -293,7 +291,6 @@ describe('Sentry errors', function () { }, ganacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, testSpecificMock: mockSentryMigratorError, }, async ({ driver, mockedEndpoint }) => { @@ -333,7 +330,6 @@ describe('Sentry errors', function () { }, ganacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, testSpecificMock: mockSentryMigratorError, }, async ({ driver, mockedEndpoint }) => { @@ -391,7 +387,6 @@ describe('Sentry errors', function () { }, ganacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, testSpecificMock: mockSentryInvariantMigrationError, }, async ({ driver, mockedEndpoint }) => { @@ -437,7 +432,6 @@ describe('Sentry errors', function () { .build(), ganacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, testSpecificMock: mockSentryTestError, }, async ({ driver, mockedEndpoint }) => { @@ -480,7 +474,6 @@ describe('Sentry errors', function () { .build(), ganacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, testSpecificMock: mockSentryTestError, }, async ({ driver, mockedEndpoint }) => { @@ -542,7 +535,6 @@ describe('Sentry errors', function () { .build(), ganacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, testSpecificMock: mockSentryTestError, }, async ({ driver, mockedEndpoint }) => { @@ -575,7 +567,6 @@ describe('Sentry errors', function () { .build(), ganacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, testSpecificMock: mockSentryTestError, }, async ({ driver, mockedEndpoint }) => { @@ -608,7 +599,6 @@ describe('Sentry errors', function () { .build(), ganacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, testSpecificMock: mockSentryTestError, }, async ({ driver, mockedEndpoint }) => { @@ -652,7 +642,6 @@ describe('Sentry errors', function () { .build(), ganacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, testSpecificMock: mockSentryTestError, }, async ({ driver, mockedEndpoint }) => { @@ -707,7 +696,6 @@ describe('Sentry errors', function () { .build(), ganacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, testSpecificMock: mockSentryTestError, }, async ({ driver, mockedEndpoint }) => { @@ -748,7 +736,6 @@ describe('Sentry errors', function () { .build(), ganacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, testSpecificMock: mockSentryTestError, }, async ({ driver, mockedEndpoint }) => { diff --git a/test/e2e/tests/full-size-view-settings.spec.js b/test/e2e/tests/full-size-view-settings.spec.js index be2d0c71d273..6ac27d8fe0c7 100644 --- a/test/e2e/tests/full-size-view-settings.spec.js +++ b/test/e2e/tests/full-size-view-settings.spec.js @@ -26,7 +26,6 @@ describe('Full-size View Setting @no-mmi', function () { .withNetworkControllerOnMainnet() .withPermissionControllerConnectedToTestDapp() .build(), - failOnConsoleError: false, ganacheOptions: defaultGanacheOptions, title: this.test.fullTitle(), }, diff --git a/test/e2e/tests/import-flow.spec.js b/test/e2e/tests/import-flow.spec.js index bca7398e079c..68e97e7002c3 100644 --- a/test/e2e/tests/import-flow.spec.js +++ b/test/e2e/tests/import-flow.spec.js @@ -47,7 +47,6 @@ describe('Import flow @no-mmi', function () { fixtures: new FixtureBuilder({ onboarding: true }).build(), ganacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver }) => { await driver.navigate(); @@ -171,7 +170,6 @@ describe('Import flow @no-mmi', function () { fixtures: new FixtureBuilder({ onboarding: true }).build(), ganacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver }) => { await driver.navigate(); diff --git a/test/e2e/tests/incremental-security.spec.js b/test/e2e/tests/incremental-security.spec.js index bc0b83c6fc55..0bc9f33f5cdc 100644 --- a/test/e2e/tests/incremental-security.spec.js +++ b/test/e2e/tests/incremental-security.spec.js @@ -27,7 +27,6 @@ describe('Incremental Security', function () { fixtures: new FixtureBuilder({ onboarding: true }).build(), ganacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, dappPath: 'send-eth-with-private-key-test', }, async ({ driver }) => { diff --git a/test/e2e/tests/metamask-responsive-ui.spec.js b/test/e2e/tests/metamask-responsive-ui.spec.js index 2252072172a8..f7e511af791a 100644 --- a/test/e2e/tests/metamask-responsive-ui.spec.js +++ b/test/e2e/tests/metamask-responsive-ui.spec.js @@ -18,7 +18,6 @@ describe('MetaMask Responsive UI', function () { fixtures: new FixtureBuilder({ onboarding: true }).build(), driverOptions, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver }) => { await driver.navigate(); @@ -89,7 +88,6 @@ describe('MetaMask Responsive UI', function () { fixtures: new FixtureBuilder().build(), driverOptions, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver, ganacheServer }) => { await driver.navigate(); diff --git a/test/e2e/tests/nft/erc1155-interaction.spec.js b/test/e2e/tests/nft/erc1155-interaction.spec.js index 4c7c56b269a6..4677d51c234e 100644 --- a/test/e2e/tests/nft/erc1155-interaction.spec.js +++ b/test/e2e/tests/nft/erc1155-interaction.spec.js @@ -23,7 +23,6 @@ describe('ERC1155 NFTs testdapp interaction', function () { ganacheOptions: defaultGanacheOptions, smartContract, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver, _, contractRegistry }) => { const contract = contractRegistry.getContractAddress(smartContract); @@ -78,7 +77,6 @@ describe('ERC1155 NFTs testdapp interaction', function () { ganacheOptions: defaultGanacheOptions, smartContract, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver, _, contractRegistry }) => { const contract = contractRegistry.getContractAddress(smartContract); diff --git a/test/e2e/tests/nft/erc721-interaction.spec.js b/test/e2e/tests/nft/erc721-interaction.spec.js index 268acd6ef5a7..24270f3276a9 100644 --- a/test/e2e/tests/nft/erc721-interaction.spec.js +++ b/test/e2e/tests/nft/erc721-interaction.spec.js @@ -22,7 +22,6 @@ describe('ERC721 NFTs testdapp interaction', function () { ganacheOptions: defaultGanacheOptions, smartContract, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver, _, contractRegistry }) => { const contract = contractRegistry.getContractAddress(smartContract); @@ -149,7 +148,6 @@ describe('ERC721 NFTs testdapp interaction', function () { ganacheOptions: defaultGanacheOptions, smartContract, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver, _, contractRegistry }) => { const contract = contractRegistry.getContractAddress(smartContract); @@ -244,7 +242,6 @@ describe('ERC721 NFTs testdapp interaction', function () { ganacheOptions: defaultGanacheOptions, smartContract, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver, _, contractRegistry }) => { const contract = contractRegistry.getContractAddress(smartContract); @@ -294,7 +291,6 @@ describe('ERC721 NFTs testdapp interaction', function () { ganacheOptions: defaultGanacheOptions, smartContract, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver, _, contractRegistry }) => { const contract = contractRegistry.getContractAddress(smartContract); @@ -364,7 +360,6 @@ describe('ERC721 NFTs testdapp interaction', function () { ganacheOptions: defaultGanacheOptions, smartContract, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver, _, contractRegistry }) => { const contract = contractRegistry.getContractAddress(smartContract); @@ -433,7 +428,6 @@ describe('ERC721 NFTs testdapp interaction', function () { ganacheOptions: defaultGanacheOptions, smartContract, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver, _, contractRegistry }) => { const contract = contractRegistry.getContractAddress(smartContract); diff --git a/test/e2e/tests/onboarding.spec.js b/test/e2e/tests/onboarding.spec.js index 51a1be758c59..9b473b3d3e46 100644 --- a/test/e2e/tests/onboarding.spec.js +++ b/test/e2e/tests/onboarding.spec.js @@ -36,7 +36,6 @@ describe('MetaMask onboarding @no-mmi', function () { fixtures: new FixtureBuilder({ onboarding: true }).build(), ganacheOptions: defaultGanacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver }) => { await driver.navigate(); @@ -57,7 +56,6 @@ describe('MetaMask onboarding @no-mmi', function () { fixtures: new FixtureBuilder({ onboarding: true }).build(), ganacheOptions: defaultGanacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver }) => { await driver.navigate(); @@ -82,7 +80,6 @@ describe('MetaMask onboarding @no-mmi', function () { fixtures: new FixtureBuilder({ onboarding: true }).build(), ganacheOptions: defaultGanacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver }) => { await driver.navigate(); @@ -104,7 +101,6 @@ describe('MetaMask onboarding @no-mmi', function () { fixtures: new FixtureBuilder({ onboarding: true }).build(), ganacheOptions: defaultGanacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver }) => { await driver.navigate(); @@ -143,7 +139,6 @@ describe('MetaMask onboarding @no-mmi', function () { fixtures: new FixtureBuilder({ onboarding: true }).build(), ganacheOptions: defaultGanacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver }) => { await driver.navigate(); @@ -185,7 +180,6 @@ describe('MetaMask onboarding @no-mmi', function () { fixtures: new FixtureBuilder({ onboarding: true }).build(), ganacheOptions: defaultGanacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver }) => { await driver.navigate(); @@ -213,7 +207,6 @@ describe('MetaMask onboarding @no-mmi', function () { fixtures: new FixtureBuilder({ onboarding: true }).build(), ganacheOptions: defaultGanacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver }) => { await driver.navigate(); diff --git a/test/e2e/tests/phishing-controller/phishing-detection.spec.js b/test/e2e/tests/phishing-controller/phishing-detection.spec.js index afaa72bc051e..ba40628f01bb 100644 --- a/test/e2e/tests/phishing-controller/phishing-detection.spec.js +++ b/test/e2e/tests/phishing-controller/phishing-detection.spec.js @@ -46,7 +46,6 @@ describe('Phishing Detection', function () { }); }, dapp: true, - failOnConsoleError: false, }, async ({ driver }) => { await unlockWallet(driver); @@ -81,7 +80,6 @@ describe('Phishing Detection', function () { dappOptions: { numberOfDapps: 2, }, - failOnConsoleError: false, }, async ({ driver }) => { await unlockWallet(driver); @@ -120,7 +118,6 @@ describe('Phishing Detection', function () { dappOptions: { numberOfDapps: 2, }, - failOnConsoleError: false, }, async ({ driver }) => { await unlockWallet(driver); @@ -159,7 +156,6 @@ describe('Phishing Detection', function () { mockConfigLookupOnWarningPage(mockServer, { statusCode: 500 }); }, dapp: true, - failOnConsoleError: false, }, async ({ driver }) => { await unlockWallet(driver); @@ -196,7 +192,6 @@ describe('Phishing Detection', function () { }); }, dapp: true, - failOnConsoleError: false, }, async ({ driver }) => { await unlockWallet(driver); @@ -232,7 +227,6 @@ describe('Phishing Detection', function () { }); }, dapp: true, - failOnConsoleError: false, }, async ({ driver }) => { await unlockWallet(driver); @@ -270,7 +264,6 @@ describe('Phishing Detection', function () { dappOptions: { numberOfDapps: 2, }, - failOnConsoleError: false, }, async ({ driver }) => { await unlockWallet(driver); diff --git a/test/e2e/tests/ppom-blockaid-toggle-metrics.spec.js b/test/e2e/tests/ppom-blockaid-toggle-metrics.spec.js index 25e98c67767a..ec763422c112 100644 --- a/test/e2e/tests/ppom-blockaid-toggle-metrics.spec.js +++ b/test/e2e/tests/ppom-blockaid-toggle-metrics.spec.js @@ -77,7 +77,7 @@ describe('PPOM Blockaid Alert - Metrics @no-mmi', function () { '[data-testid="account-options-menu-button"]', ); await driver.clickElement({ text: 'Settings', tag: 'div' }); - await driver.clickElement({ text: 'Experimental', tag: 'div' }); + await driver.clickElement({ text: 'Security & privacy', tag: 'div' }); await driver.clickElement( '[data-testid="settings-toggle-security-alert-blockaid"] .toggle-button > div', ); @@ -89,7 +89,7 @@ describe('PPOM Blockaid Alert - Metrics @no-mmi', function () { '[data-testid="account-options-menu-button"]', ); await driver.clickElement({ text: 'Settings', tag: 'div' }); - await driver.clickElement({ text: 'Experimental', tag: 'div' }); + await driver.clickElement({ text: 'Security & privacy', tag: 'div' }); await driver.clickElement( '[data-testid="settings-toggle-security-alert-blockaid"] .toggle-button > div', ); diff --git a/test/e2e/tests/ppom-toggle-settings.spec.js b/test/e2e/tests/ppom-toggle-settings.spec.js index b6343a38a969..a355abed98a7 100644 --- a/test/e2e/tests/ppom-toggle-settings.spec.js +++ b/test/e2e/tests/ppom-toggle-settings.spec.js @@ -28,7 +28,7 @@ describe('PPOM Settings @no-mmi', function () { ); await driver.clickElement({ text: 'Settings', tag: 'div' }); - await driver.clickElement({ text: 'Experimental', tag: 'div' }); + await driver.clickElement({ text: 'Security & privacy', tag: 'div' }); await driver.clickElement( '[data-testid="settings-toggle-security-alert-blockaid"] .toggle-button > div', diff --git a/test/e2e/tests/provider-api.spec.js b/test/e2e/tests/provider-api.spec.js index 41183448cef9..b2cd456d5f41 100644 --- a/test/e2e/tests/provider-api.spec.js +++ b/test/e2e/tests/provider-api.spec.js @@ -54,7 +54,6 @@ describe('MetaMask', function () { await withFixtures( { dapp: true, - failOnConsoleError: false, fixtures: new FixtureBuilder() .withPermissionControllerConnectedToTestDapp() .build(), diff --git a/test/e2e/tests/security-provider.spec.js b/test/e2e/tests/security-provider.spec.js index 48bccd2baf32..52cf9bf40cd5 100644 --- a/test/e2e/tests/security-provider.spec.js +++ b/test/e2e/tests/security-provider.spec.js @@ -83,7 +83,6 @@ describe('Transaction security provider', function () { testSpecificMock: async (mockServer) => await mockSecurityProviderDetection(mockServer, 'malicious'), dapp: true, - failOnConsoleError: false, }, async ({ driver }) => { await unlockWallet(driver); @@ -121,7 +120,6 @@ describe('Transaction security provider', function () { testSpecificMock: async (mockServer) => await mockSecurityProviderDetection(mockServer, 'notSafe'), dapp: true, - failOnConsoleError: false, }, async ({ driver }) => { await unlockWallet(driver); @@ -159,7 +157,6 @@ describe('Transaction security provider', function () { testSpecificMock: async (mockServer) => await mockSecurityProviderDetection(mockServer, 'notMalicious'), dapp: true, - failOnConsoleError: false, }, async ({ driver }) => { await unlockWallet(driver); @@ -197,7 +194,6 @@ describe('Transaction security provider', function () { testSpecificMock: async (mockServer) => await mockSecurityProviderDetection(mockServer, 'requestNotVerified'), dapp: true, - failOnConsoleError: false, }, async ({ driver }) => { await unlockWallet(driver); diff --git a/test/e2e/tests/send-edit.spec.js b/test/e2e/tests/send-edit.spec.js index 4463abbe541c..1314a88e4050 100644 --- a/test/e2e/tests/send-edit.spec.js +++ b/test/e2e/tests/send-edit.spec.js @@ -16,7 +16,6 @@ describe('Editing Confirm Transaction', function () { .build(), ganacheOptions: defaultGanacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver }) => { await unlockWallet(driver); @@ -86,7 +85,6 @@ describe('Editing Confirm Transaction', function () { .build(), ganacheOptions: generateGanacheOptions({ hardfork: 'london' }), title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver }) => { await unlockWallet(driver); diff --git a/test/e2e/tests/send-hex-address.spec.js b/test/e2e/tests/send-hex-address.spec.js index bf6c2cb084d1..d81c396c44de 100644 --- a/test/e2e/tests/send-hex-address.spec.js +++ b/test/e2e/tests/send-hex-address.spec.js @@ -19,7 +19,6 @@ describe('Send ETH to a 40 character hexadecimal address', function () { .build(), ganacheOptions: defaultGanacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver, ganacheServer }) => { await logInWithBalanceValidation(driver, ganacheServer); @@ -66,7 +65,6 @@ describe('Send ETH to a 40 character hexadecimal address', function () { .build(), ganacheOptions: defaultGanacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver, ganacheServer }) => { await logInWithBalanceValidation(driver, ganacheServer); @@ -120,7 +118,6 @@ describe('Send ERC20 to a 40 character hexadecimal address', function () { ganacheOptions: defaultGanacheOptions, smartContract, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver, ganacheServer }) => { await logInWithBalanceValidation(driver, ganacheServer); @@ -185,7 +182,6 @@ describe('Send ERC20 to a 40 character hexadecimal address', function () { ganacheOptions: defaultGanacheOptions, smartContract, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver, ganacheServer }) => { await logInWithBalanceValidation(driver, ganacheServer); diff --git a/test/e2e/tests/send-to-contract.spec.js b/test/e2e/tests/send-to-contract.spec.js index 35285d6fff8b..72561a2d2876 100644 --- a/test/e2e/tests/send-to-contract.spec.js +++ b/test/e2e/tests/send-to-contract.spec.js @@ -18,7 +18,6 @@ describe('Send ERC20 token to contract address', function () { ganacheOptions: defaultGanacheOptions, smartContract, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver, contractRegistry }) => { const contractAddress = await contractRegistry.getContractAddress( diff --git a/test/e2e/tests/settings-security-reveal-srp.spec.js b/test/e2e/tests/settings-security-reveal-srp.spec.js index 6433b39c9321..59affd6f4bf7 100644 --- a/test/e2e/tests/settings-security-reveal-srp.spec.js +++ b/test/e2e/tests/settings-security-reveal-srp.spec.js @@ -20,7 +20,6 @@ describe('Reveal SRP through settings', function () { { fixtures: new FixtureBuilder().build(), title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver }) => { await passwordUnlockOpenSRPRevealQuiz(driver); diff --git a/test/e2e/tests/state-logs.spec.js b/test/e2e/tests/state-logs.spec.js index 7762850d9141..c5d6ed705390 100644 --- a/test/e2e/tests/state-logs.spec.js +++ b/test/e2e/tests/state-logs.spec.js @@ -32,7 +32,6 @@ describe('State logs', function () { fixtures: new FixtureBuilder().build(), ganacheOptions: defaultGanacheOptions, title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver }) => { await createDownloadFolder(downloadsFolder); diff --git a/test/e2e/tests/swaps/swap-eth.spec.js b/test/e2e/tests/swaps/swap-eth.spec.js index 2b0512924165..f0b32172cf28 100644 --- a/test/e2e/tests/swaps/swap-eth.spec.js +++ b/test/e2e/tests/swaps/swap-eth.spec.js @@ -15,7 +15,6 @@ describe('Swap Eth for another Token @no-mmi', function () { await withFixtures( { ...withFixturesOptions, - failOnConsoleError: false, title: this.test.fullTitle(), }, async ({ driver }) => { diff --git a/test/e2e/tests/switch-custom-network.spec.js b/test/e2e/tests/switch-custom-network.spec.js index 1d55c94ddc2d..c51eb6c7eb4a 100644 --- a/test/e2e/tests/switch-custom-network.spec.js +++ b/test/e2e/tests/switch-custom-network.spec.js @@ -24,7 +24,6 @@ describe('Switch ethereum chain', function () { }, }), title: this.test.fullTitle(), - failOnConsoleError: false, }, async ({ driver }) => { await unlockWallet(driver); diff --git a/test/e2e/vault-decryption-chrome.spec.js b/test/e2e/vault-decryption-chrome.spec.js index 47848475e8e3..aa1019149b54 100644 --- a/test/e2e/vault-decryption-chrome.spec.js +++ b/test/e2e/vault-decryption-chrome.spec.js @@ -76,40 +76,35 @@ async function getSRP(driver) { describe('Vault Decryptor Page', function () { it('is able to decrypt the vault using the vault-decryptor webapp', async function () { - await withFixtures( - { - failOnConsoleError: false, - }, - async ({ driver }) => { - await driver.navigate(); - // the first app launch opens a new tab, we need to switch the focus - // to the first one. - await driver.switchToWindowWithTitle('MetaMask'); - // create a new vault through onboarding flow - await completeCreateNewWalletOnboardingFlowWithOptOut( - driver, - WALLET_PASSWORD, - ); - // close popover if any (Announcements etc..) - await closePopoverIfPresent(driver); - // obtain SRP - const seedPhrase = await getSRP(driver); + await withFixtures({}, async ({ driver }) => { + await driver.navigate(); + // the first app launch opens a new tab, we need to switch the focus + // to the first one. + await driver.switchToWindowWithTitle('MetaMask'); + // create a new vault through onboarding flow + await completeCreateNewWalletOnboardingFlowWithOptOut( + driver, + WALLET_PASSWORD, + ); + // close popover if any (Announcements etc..) + await closePopoverIfPresent(driver); + // obtain SRP + const seedPhrase = await getSRP(driver); - // navigate to the Vault decryptor webapp - await driver.openNewPage(VAULT_DECRYPTOR_PAGE); - // fill the input field with storage recovered from filesystem - await driver.clickElement('[name="vault-source"]'); - const inputField = await driver.findElement('#fileinput'); - inputField.press(await getExtensionStorageFilePath(driver)); - // fill in the password - await driver.fill('#passwordinput', WALLET_PASSWORD); - // decrypt - await driver.clickElement('.decrypt'); - const decrypted = await driver.findElement('.content div div div'); - const recoveredVault = JSON.parse(await decrypted.getText()); + // navigate to the Vault decryptor webapp + await driver.openNewPage(VAULT_DECRYPTOR_PAGE); + // fill the input field with storage recovered from filesystem + await driver.clickElement('[name="vault-source"]'); + const inputField = await driver.findElement('#fileinput'); + inputField.press(await getExtensionStorageFilePath(driver)); + // fill in the password + await driver.fill('#passwordinput', WALLET_PASSWORD); + // decrypt + await driver.clickElement('.decrypt'); + const decrypted = await driver.findElement('.content div div div'); + const recoveredVault = JSON.parse(await decrypted.getText()); - assert.equal(recoveredVault[0].data.mnemonic, seedPhrase); - }, - ); + assert.equal(recoveredVault[0].data.mnemonic, seedPhrase); + }); }); }); diff --git a/test/e2e/webdriver/driver.js b/test/e2e/webdriver/driver.js index e98f068f6d5e..04903cb03ed7 100644 --- a/test/e2e/webdriver/driver.js +++ b/test/e2e/webdriver/driver.js @@ -632,25 +632,28 @@ class Driver { return browserLogs; } - async checkBrowserForExceptions(failOnConsoleError) { + async checkBrowserForExceptions(ignoredConsoleErrors) { const cdpConnection = await this.driver.createCDPConnection('page'); this.driver.onLogException(cdpConnection, (exception) => { const { description } = exception.exceptionDetails.exception; - this.exceptions.push(description); - logBrowserError(failOnConsoleError, description); + + const ignored = logBrowserError(ignoredConsoleErrors, description); + if (!ignored) { + this.exceptions.push(description); + } }); } - async checkBrowserForConsoleErrors(failOnConsoleError) { - const ignoredErrorMessages = [ + async checkBrowserForConsoleErrors(_ignoredConsoleErrors) { + const ignoredConsoleErrors = _ignoredConsoleErrors.concat([ // Third-party Favicon 404s show up as errors 'favicon.ico - Failed to load resource: the server responded with a status of 404', // Sentry rate limiting 'Failed to load resource: the server responded with a status of 429', // 4Byte 'Failed to load resource: the server responded with a status of 502 (Bad Gateway)', - ]; + ]); const cdpConnection = await this.driver.createCDPConnection('page'); @@ -664,25 +667,20 @@ class Driver { // If we received an SES_UNHANDLED_REJECTION from Chrome, eventDescriptions.length will be nonzero // Update: as of January 2024, this code path may never happen const [eventDescription] = eventDescriptions; - const ignore = ignoredErrorMessages.some((message) => - eventDescription?.description.includes(message), + const ignored = logBrowserError( + ignoredConsoleErrors, + eventDescription?.description, ); - if (!ignore) { - const isWarning = logBrowserError( - failOnConsoleError, - eventDescription?.description, - ); - - if (!isWarning) { - this.errors.push(eventDescription?.description); - } + + if (!ignored) { + this.errors.push(eventDescription?.description); } } else if (event.args.length !== 0) { const newError = this.#getErrorFromEvent(event); - const isWarning = logBrowserError(failOnConsoleError, newError); + const ignored = logBrowserError(ignoredConsoleErrors, newError); - if (!isWarning) { + if (!ignored) { this.errors.push(newError); } } @@ -708,24 +706,28 @@ class Driver { } } -function logBrowserError(failOnConsoleError, errorMessage) { - let isWarning = false; +function logBrowserError(ignoredConsoleErrors, errorMessage) { + let ignored = false; - console.error('\n----Received an error from Chrome----'); + console.error('\n-----Received an error from Chrome-----'); console.error(errorMessage); - console.error('---------End of Chrome error---------'); - console.error( - `-----failOnConsoleError is ${failOnConsoleError ? 'true-' : 'false'}-----`, - ); + console.error('----------End of Chrome error----------'); if (errorMessage.startsWith('Warning:')) { - console.error("----We will ignore this 'Warning'----"); - isWarning = true; + console.error("-----We will ignore this 'Warning'-----"); + ignored = true; + } else if (isInIgnoreList(errorMessage, ignoredConsoleErrors)) { + console.error('---This error is on the ignore list----'); + ignored = true; } console.error('\n'); - return isWarning; + return ignored; +} + +function isInIgnoreList(errorMessage, ignoreList) { + return ignoreList.some((ignore) => errorMessage.includes(ignore)); } function collectMetrics() { diff --git a/test/jest/mock-store.js b/test/jest/mock-store.js index 11dbffbd7aa8..af851bba6105 100644 --- a/test/jest/mock-store.js +++ b/test/jest/mock-store.js @@ -303,6 +303,23 @@ export const createSwapsMockStore = () => { methods: [...Object.values(EthMethod)], type: EthAccountType.Eoa, }, + '36eb02e0-7925-47f0-859f-076608f09b69': { + address: '0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe6', + id: '36eb02e0-7925-47f0-859f-076608f09b69', + metadata: { + name: 'Snap Account 1', + keyring: { + type: 'Snap Keyring', + }, + snap: { + id: 'snap-id', + name: 'snap name', + }, + }, + options: {}, + methods: [...Object.values(EthMethod)], + type: EthAccountType.Eoa, + }, }, selectedAccount: 'cf8dace4-9439-4bd4-b3a8-88c821c8fcb3', }, diff --git a/ui/components/app/signature-request-original/signature-request-original.container.js b/ui/components/app/signature-request-original/signature-request-original.container.js index 4c3981c3f90b..3ad73f5b5486 100644 --- a/ui/components/app/signature-request-original/signature-request-original.container.js +++ b/ui/components/app/signature-request-original/signature-request-original.container.js @@ -11,14 +11,10 @@ import { } from '../../../store/actions'; ///: BEGIN:ONLY_INCLUDE_IF(build-mmi) // eslint-disable-next-line import/order -import { showCustodianDeepLink } from '@metamask-institutional/extension'; import { mmiActionsFactory, setPersonalMessageInProgress, } from '../../../store/institutional/institution-background'; -import { getEnvironmentType } from '../../../../app/scripts/lib/util'; -import { showCustodyConfirmLink } from '../../../store/institutional/institution-actions'; -import { ENVIRONMENT_TYPE_NOTIFICATION } from '../../../../shared/constants/app'; ///: END:ONLY_INCLUDE_IF import { accountsWithSendEtherInfoSelector, @@ -42,10 +38,6 @@ function mapStateToProps(state, ownProps) { msgParams: { from }, } = ownProps.txData; - ///: BEGIN:ONLY_INCLUDE_IF(build-mmi) - const envType = getEnvironmentType(); - ///: END:ONLY_INCLUDE_IF - const hardwareWalletRequiresConnection = doesAddressRequireLedgerHidConnection(state, from); const isLedgerWallet = isAddressLedger(state, from); @@ -65,7 +57,6 @@ function mapStateToProps(state, ownProps) { messagesCount, ///: BEGIN:ONLY_INCLUDE_IF(build-mmi) accountType: getAccountType(state), - isNotification: envType === ENVIRONMENT_TYPE_NOTIFICATION, selectedAccount: getSelectedInternalAccount(state), ///: END:ONLY_INCLUDE_IF }; @@ -107,25 +98,6 @@ function mmiMapDispatchToProps(dispatch) { const mmiActions = mmiActionsFactory(); return { setMsgInProgress: (msgId) => dispatch(setPersonalMessageInProgress(msgId)), - showCustodianDeepLink: ({ - custodyId, - fromAddress, - closeNotification, - onDeepLinkFetched, - onDeepLinkShown, - }) => - showCustodianDeepLink({ - dispatch, - mmiActions, - txId: undefined, - fromAddress, - custodyId, - isSignature: true, - closeNotification, - onDeepLinkFetched, - onDeepLinkShown, - showCustodyConfirmLink, - }), showTransactionsFailedModal: ({ errorMessage, closeNotification, @@ -178,7 +150,6 @@ function mergeProps(stateProps, dispatchProps, ownProps) { messagesList, ///: BEGIN:ONLY_INCLUDE_IF(build-mmi) accountType, - isNotification, ///: END:ONLY_INCLUDE_IF ...otherStateProps } = stateProps; @@ -197,14 +168,6 @@ function mergeProps(stateProps, dispatchProps, ownProps) { try { await dispatchProps.resolvePendingApproval(_msgData.id); dispatchProps.completedTx(_msgData.id); - - dispatchProps.showCustodianDeepLink({ - custodyId: null, - fromAddress: fromAccount.address, - closeNotification: isNotification, - onDeepLinkFetched: () => undefined, - onDeepLinkShown: () => undefined, - }); await dispatchProps.setWaitForConfirmDeepLinkDialog(true); } catch (err) { await dispatchProps.setWaitForConfirmDeepLinkDialog(true); diff --git a/ui/components/app/signature-request/signature-request.js b/ui/components/app/signature-request/signature-request.js index 874f89485f2b..6c71635ee956 100644 --- a/ui/components/app/signature-request/signature-request.js +++ b/ui/components/app/signature-request/signature-request.js @@ -9,9 +9,6 @@ import { import PropTypes from 'prop-types'; import { memoize } from 'lodash'; import { ethErrors, serializeError } from 'eth-rpc-errors'; -///: BEGIN:ONLY_INCLUDE_IF(build-mmi) -import { showCustodianDeepLink } from '@metamask-institutional/extension'; -///: END:ONLY_INCLUDE_IF import { resolvePendingApproval, completedTx, @@ -47,12 +44,7 @@ import SecurityProviderBannerMessage from '../security-provider-banner-message'; import LedgerInstructionField from '../ledger-instruction-field'; import ContractDetailsModal from '../modals/contract-details-modal'; import { MetaMetricsContext } from '../../../contexts/metametrics'; -import { - MetaMetricsEventCategory, - ///: BEGIN:ONLY_INCLUDE_IF(build-mmi) - MetaMetricsEventName, - ///: END:ONLY_INCLUDE_IF -} from '../../../../shared/constants/metametrics'; +import { MetaMetricsEventCategory } from '../../../../shared/constants/metametrics'; import { SECURITY_PROVIDER_MESSAGE_SEVERITY } from '../../../../shared/constants/security-provider'; import { @@ -81,11 +73,6 @@ import { } from '../../component-library'; ///: BEGIN:ONLY_INCLUDE_IF(build-mmi) -// eslint-disable-next-line import/order -import { ENVIRONMENT_TYPE_NOTIFICATION } from '../../../../shared/constants/app'; -import { getEnvironmentType } from '../../../../app/scripts/lib/util'; -import { mmiActionsFactory } from '../../../store/institutional/institution-background'; -import { showCustodyConfirmLink } from '../../../store/institutional/institution-actions'; import { useMMICustodySignMessage } from '../../../hooks/useMMICustodySignMessage'; ///: END:ONLY_INCLUDE_IF ///: BEGIN:ONLY_INCLUDE_IF(blockaid) @@ -125,9 +112,7 @@ const SignatureRequest = ({ txData }) => { // Used to show a warning if the signing account is not the selected account // Largely relevant for contract wallet custodians const selectedAccount = useSelector(getSelectedAccount); - const mmiActions = mmiActionsFactory(); const accountType = useSelector(getAccountType); - const isNotification = getEnvironmentType() === ENVIRONMENT_TYPE_NOTIFICATION; const allAccounts = useSelector( accountsWithSendEtherInfoSelector, shallowEqual, @@ -202,37 +187,6 @@ const SignatureRequest = ({ txData }) => { primaryType, } = parseMessage(data); - ///: BEGIN:ONLY_INCLUDE_IF(build-mmi) - useEffect(() => { - if (txData.custodyId) { - showCustodianDeepLink({ - dispatch, - mmiActions, - txId: undefined, - custodyId: txData.custodyId, - fromAddress: address, - isSignature: true, - closeNotification: isNotification, - onDeepLinkFetched: () => undefined, - onDeepLinkShown: () => { - trackEvent({ - category: MetaMetricsEventCategory.MMI, - event: MetaMetricsEventName.SignatureDeeplinkDisplayed, - }); - }, - showCustodyConfirmLink, - }); - } - }, [ - dispatch, - mmiActions, - txData.custodyId, - address, - isNotification, - trackEvent, - ]); - ///: END:ONLY_INCLUDE_IF - return (
diff --git a/ui/components/app/signature-request/signature-request.test.js b/ui/components/app/signature-request/signature-request.test.js index 2a60a410b215..257efc4d7758 100644 --- a/ui/components/app/signature-request/signature-request.test.js +++ b/ui/components/app/signature-request/signature-request.test.js @@ -3,7 +3,6 @@ import { useSelector } from 'react-redux'; import { fireEvent } from '@testing-library/react'; import configureMockStore from 'redux-mock-store'; import { EthAccountType, EthMethod } from '@metamask/keyring-api'; -import { showCustodianDeepLink } from '@metamask-institutional/extension'; import mockState from '../../../../test/data/mock-state.json'; import { renderWithProvider } from '../../../../test/lib/render-helpers'; import { SECURITY_PROVIDER_MESSAGE_SEVERITY } from '../../../../shared/constants/security-provider'; @@ -586,38 +585,5 @@ describe('Signature Request Component', () => { fireEvent.click(rejectRequestsLink); expect(mockCustodySignFn).toHaveBeenCalledWith({ msgParams }); }); - - it('should call showCustodianDeepLink with correct parameters when txData.custodyId is truthy', () => { - const msgParams = { - from: '0xd8f6a2ffb0fc5952d16c9768b71cfd35b6399aa5', - data: JSON.stringify(messageData), - version: 'V4', - origin: 'test', - }; - - renderWithProvider( - , - store, - ); - - expect(showCustodianDeepLink).toHaveBeenCalledWith({ - dispatch: expect.any(Function), - mmiActions: expect.any(Object), - txId: undefined, - custodyId: 'custodyId', - fromAddress: '0xd8f6a2ffb0fc5952d16c9768b71cfd35b6399aa5', - isSignature: true, - closeNotification: false, - onDeepLinkFetched: expect.any(Function), - onDeepLinkShown: expect.any(Function), - showCustodyConfirmLink: expect.any(Function), - }); - }); }); }); diff --git a/ui/ducks/confirm-transaction/confirm-transaction.duck.js b/ui/ducks/confirm-transaction/confirm-transaction.duck.js index a8a9ba00734b..00b9521ad40e 100644 --- a/ui/ducks/confirm-transaction/confirm-transaction.duck.js +++ b/ui/ducks/confirm-transaction/confirm-transaction.duck.js @@ -34,6 +34,7 @@ const UPDATE_TRANSACTION_AMOUNTS = createActionType( const UPDATE_TRANSACTION_FEES = createActionType('UPDATE_TRANSACTION_FEES'); const UPDATE_TRANSACTION_TOTALS = createActionType('UPDATE_TRANSACTION_TOTALS'); const UPDATE_NONCE = createActionType('UPDATE_NONCE'); +const SET_MAX_VALUE_MODE = createActionType('SET_MAX_VALUE_MODE'); // Initial state const initState = { @@ -50,6 +51,7 @@ const initState = { hexTransactionFee: '', hexTransactionTotal: '', nonce: '', + maxValueMode: {}, }; // Reducer @@ -119,7 +121,18 @@ export default function reducer(state = initState, action = {}) { nonce: action.payload, }; case CLEAR_CONFIRM_TRANSACTION: - return initState; + return { + ...initState, + maxValueMode: state.maxValueMode, + }; + case SET_MAX_VALUE_MODE: + return { + ...state, + maxValueMode: { + ...state.maxValueMode, + [action.payload.transactionId]: action.payload.enabled, + }, + }; default: return state; } @@ -308,3 +321,13 @@ export function clearConfirmTransaction() { type: CLEAR_CONFIRM_TRANSACTION, }; } + +export function setMaxValueMode(transactionId, enabled) { + return { + type: SET_MAX_VALUE_MODE, + payload: { + transactionId, + enabled, + }, + }; +} diff --git a/ui/ducks/confirm-transaction/confirm-transaction.duck.test.js b/ui/ducks/confirm-transaction/confirm-transaction.duck.test.js index 5fd4f284b0eb..69f6d20e207c 100644 --- a/ui/ducks/confirm-transaction/confirm-transaction.duck.test.js +++ b/ui/ducks/confirm-transaction/confirm-transaction.duck.test.js @@ -21,6 +21,7 @@ const initialState = { hexTransactionFee: '', hexTransactionTotal: '', nonce: '', + maxValueMode: {}, }; const UPDATE_TX_DATA = 'metamask/confirm-transaction/UPDATE_TX_DATA'; @@ -34,6 +35,7 @@ const UPDATE_TRANSACTION_TOTALS = const UPDATE_NONCE = 'metamask/confirm-transaction/UPDATE_NONCE'; const CLEAR_CONFIRM_TRANSACTION = 'metamask/confirm-transaction/CLEAR_CONFIRM_TRANSACTION'; +const SET_MAX_VALUE_MODE = 'metamask/confirm-transaction/SET_MAX_VALUE_MODE'; describe('Confirm Transaction Duck', () => { describe('State changes', () => { @@ -54,6 +56,9 @@ describe('Confirm Transaction Duck', () => { hexTransactionFee: '0x1319718a5000', hexTransactionTotal: '', nonce: '0x0', + maxValueMode: { + '123abc': true, + }, }; it('should initialize state', () => { @@ -171,12 +176,39 @@ describe('Confirm Transaction Duck', () => { }); }); + it("shouldn't clear maxValueMode when receiving a CLEAR_CONFIRM_TRANSACTION action", () => { + expect( + ConfirmTransactionReducer(mockState, { + type: CLEAR_CONFIRM_TRANSACTION, + }), + ).toStrictEqual({ + ...initialState, + maxValueMode: mockState.maxValueMode, + }); + }); + + it('should set max value mode', () => { + const mockId = '123abc'; + expect( + ConfirmTransactionReducer(mockState, { + type: SET_MAX_VALUE_MODE, + payload: { + transactionId: mockId, + enabled: false, + }, + }).maxValueMode[mockId], + ).toBe(false); + }); + it('should clear confirmTransaction when receiving a FETCH_DATA_END action', () => { expect( ConfirmTransactionReducer(mockState, { type: CLEAR_CONFIRM_TRANSACTION, }), - ).toStrictEqual(initialState); + ).toStrictEqual({ + ...initialState, + maxValueMode: mockState.maxValueMode, + }); }); }); diff --git a/ui/ducks/send/send.js b/ui/ducks/send/send.js index 724d620f9d35..fd6557f95ac5 100644 --- a/ui/ducks/send/send.js +++ b/ui/ducks/send/send.js @@ -114,6 +114,7 @@ import { } from '../../../shared/lib/transactions-controller-utils'; import { Numeric } from '../../../shared/modules/Numeric'; import { EtherDenomination } from '../../../shared/constants/common'; +import { setMaxValueMode } from '../confirm-transaction/confirm-transaction.duck'; import { estimateGasLimitForSend, generateTransactionParams, @@ -2307,10 +2308,11 @@ export function resetSendState() { export function signTransaction() { return async (dispatch, getState) => { const state = getState(); - const { stage, eip1559support } = state[name]; + const { stage, eip1559support, amountMode } = state[name]; const txParams = generateTransactionParams(state[name]); const draftTransaction = state[name].draftTransactions[state[name].currentTransactionUUID]; + if (stage === SEND_STAGES.EDIT) { // When dealing with the edit flow there is already a transaction in // state that we must update, this branch is responsible for that logic. @@ -2381,12 +2383,20 @@ export function signTransaction() { ), ); - dispatch( + const { id: transactionId } = await dispatch( addTransactionAndRouteToConfirmationPage(txParams, { sendFlowHistory: draftTransaction.history, type: transactionType, }), ); + + await dispatch( + setMaxValueMode( + transactionId, + amountMode === AMOUNT_MODES.MAX && + draftTransaction.asset.type === AssetType.native, + ), + ); } }; } diff --git a/ui/ducks/send/send.test.js b/ui/ducks/send/send.test.js index 465f2da2477f..b5abc9ac1b62 100644 --- a/ui/ducks/send/send.test.js +++ b/ui/ducks/send/send.test.js @@ -2612,7 +2612,7 @@ describe('Send Slice', () => { const actionResult = store.getActions(); - expect(actionResult).toHaveLength(2); + expect(actionResult).toHaveLength(3); expect(actionResult[0]).toMatchObject({ type: 'send/addHistoryEntry', payload: diff --git a/ui/ducks/swaps/swaps.js b/ui/ducks/swaps/swaps.js index 74e645938ff2..4b0cc084241b 100644 --- a/ui/ducks/swaps/swaps.js +++ b/ui/ducks/swaps/swaps.js @@ -60,6 +60,7 @@ import { getSwapsDefaultToken, getCurrentChainId, isHardwareWallet, + accountSupportsSmartTx, getHardwareWalletType, checkNetworkAndAccountSupports1559, getSelectedNetworkClientId, @@ -322,7 +323,7 @@ export const getSmartTransactionsErrorMessageDismissed = (state) => state.appState.smartTransactionsErrorMessageDismissed; export const getSmartTransactionsEnabled = (state) => { - const hardwareWalletUsed = isHardwareWallet(state); + const supportedAccount = accountSupportsSmartTx(state); const chainId = getCurrentChainId(state); const isAllowedNetwork = ALLOWED_SMART_TRANSACTIONS_CHAIN_IDS.includes(chainId); @@ -333,7 +334,7 @@ export const getSmartTransactionsEnabled = (state) => { state.metamask.smartTransactionsState?.liveness; return Boolean( isAllowedNetwork && - !hardwareWalletUsed && + supportedAccount && smartTransactionsFeatureFlagEnabled && smartTransactionsLiveness, ); diff --git a/ui/ducks/swaps/swaps.test.js b/ui/ducks/swaps/swaps.test.js index efbfba057c1c..ab9dd7929c6b 100644 --- a/ui/ducks/swaps/swaps.test.js +++ b/ui/ducks/swaps/swaps.test.js @@ -450,6 +450,13 @@ describe('Ducks - Swaps', () => { state.metamask.swapsState.swapsFeatureFlags = {}; expect(swaps.getSmartTransactionsEnabled(state)).toBe(false); }); + + it('returns false if a snap account is used', () => { + const state = createSwapsMockStore(); + state.metamask.internalAccounts.selectedAccount = + '36eb02e0-7925-47f0-859f-076608f09b69'; + expect(swaps.getSmartTransactionsEnabled(state)).toBe(false); + }); }); describe('getCurrentSmartTransactionsEnabled', () => { diff --git a/ui/helpers/utils/permission.js b/ui/helpers/utils/permission.js index 5ebdf57b6dd3..8a4bb5fb1124 100644 --- a/ui/helpers/utils/permission.js +++ b/ui/helpers/utils/permission.js @@ -134,6 +134,7 @@ export const PERMISSION_DESCRIPTIONS = deepFreeze({ > {friendlyName} , + getSnapNameComponent(targetSubjectMetadata), ]), }; } diff --git a/ui/hooks/snaps/useTransactionInsightSnaps.js b/ui/hooks/snaps/useTransactionInsightSnaps.js index fa70d445bbfe..f214f79a96f4 100644 --- a/ui/hooks/snaps/useTransactionInsightSnaps.js +++ b/ui/hooks/snaps/useTransactionInsightSnaps.js @@ -90,7 +90,7 @@ export function useTransactionInsightSnaps({ ///: END:ONLY_INCLUDE_IF } } - if (transaction) { + if (transaction && Object.keys(transaction).length > 0) { fetchInsight(); } return () => { diff --git a/ui/hooks/useMMICustodySignMessage.js b/ui/hooks/useMMICustodySignMessage.js index ba3914966397..7cc29a50937d 100644 --- a/ui/hooks/useMMICustodySignMessage.js +++ b/ui/hooks/useMMICustodySignMessage.js @@ -1,55 +1,22 @@ -import { shallowEqual, useDispatch, useSelector } from 'react-redux'; -import { showCustodianDeepLink } from '@metamask-institutional/extension'; -import { showCustodyConfirmLink } from '../store/institutional/institution-actions'; +import { useDispatch, useSelector } from 'react-redux'; import { mmiActionsFactory } from '../store/institutional/institution-background'; -import { - accountsWithSendEtherInfoSelector, - getAccountType, -} from '../selectors'; +import { getAccountType } from '../selectors'; import { resolvePendingApproval, completedTx, showModal, } from '../store/actions'; -import { getAccountByAddress } from '../helpers/utils/util'; -import { getEnvironmentType } from '../../app/scripts/lib/util'; -import { ENVIRONMENT_TYPE_NOTIFICATION } from '../../shared/constants/app'; export function useMMICustodySignMessage() { const dispatch = useDispatch(); const mmiActions = mmiActionsFactory(); - const envType = getEnvironmentType(); const accountType = useSelector(getAccountType); - const isNotification = envType === ENVIRONMENT_TYPE_NOTIFICATION; - const allAccounts = useSelector( - accountsWithSendEtherInfoSelector, - shallowEqual, - ); const custodySignFn = async (_msgData) => { - const { - msgParams: { from }, - } = _msgData; - - const fromAccount = getAccountByAddress(allAccounts, from); - if (accountType === 'custody') { try { await dispatch(resolvePendingApproval(_msgData.id)); completedTx(_msgData.id); - - showCustodianDeepLink({ - dispatch, - mmiActions, - txId: undefined, - custodyId: null, - fromAddress: fromAccount.address, - isSignature: true, - closeNotification: isNotification, - onDeepLinkFetched: () => undefined, - onDeepLinkShown: () => undefined, - showCustodyConfirmLink, - }); await dispatch(mmiActions.setWaitForConfirmDeepLinkDialog(true)); } catch (err) { await dispatch(mmiActions.setWaitForConfirmDeepLinkDialog(true)); diff --git a/ui/hooks/useMMICustodySignMessage.test.js b/ui/hooks/useMMICustodySignMessage.test.js new file mode 100644 index 000000000000..4fe88ac5c008 --- /dev/null +++ b/ui/hooks/useMMICustodySignMessage.test.js @@ -0,0 +1,85 @@ +import { renderHook } from '@testing-library/react-hooks'; +import { useDispatch, useSelector } from 'react-redux'; +import { mmiActionsFactory } from '../store/institutional/institution-background'; +import { + resolvePendingApproval, + completedTx, + showModal, +} from '../store/actions'; +import { useMMICustodySignMessage } from './useMMICustodySignMessage'; + +jest.mock('react-redux', () => ({ + useDispatch: jest.fn(), + useSelector: jest.fn(), +})); + +jest.mock('../store/institutional/institution-background', () => ({ + mmiActionsFactory: jest.fn(), +})); + +jest.mock('../selectors', () => ({ + getAccountType: jest.fn(), +})); + +jest.mock('../store/actions', () => ({ + resolvePendingApproval: jest.fn(), + completedTx: jest.fn(), + showModal: jest.fn(), +})); + +describe('useMMICustodySignMessage', () => { + it('handles custody account type', async () => { + const dispatch = jest.fn(); + useDispatch.mockReturnValue(dispatch); + useSelector.mockReturnValue('custody'); + mmiActionsFactory.mockReturnValue({ + setWaitForConfirmDeepLinkDialog: jest.fn(), + }); + + const { result } = renderHook(() => useMMICustodySignMessage()); + await result.current.custodySignFn({ id: '123' }); + + expect(dispatch).toHaveBeenCalled(); + expect(resolvePendingApproval).toHaveBeenCalledWith('123'); + expect(completedTx).toHaveBeenCalledWith('123'); + }); + + it('handles non-custody account type', async () => { + const dispatch = jest.fn(); + useDispatch.mockReturnValue(dispatch); + useSelector.mockReturnValue('non-custody'); + mmiActionsFactory.mockReturnValue({ + setWaitForConfirmDeepLinkDialog: jest.fn(), + }); + + const { result } = renderHook(() => useMMICustodySignMessage()); + await result.current.custodySignFn({ id: '456' }); + + expect(dispatch).toHaveBeenCalled(); + expect(resolvePendingApproval).toHaveBeenCalledWith('456'); + expect(completedTx).toHaveBeenCalledWith('456'); + }); + + it('handles error in custody account type', async () => { + const dispatch = jest.fn(); + useDispatch.mockReturnValue(dispatch); + useSelector.mockReturnValue('custody'); + mmiActionsFactory.mockReturnValue({ + setWaitForConfirmDeepLinkDialog: jest.fn(), + }); + resolvePendingApproval.mockImplementation(() => { + throw new Error('Test error'); + }); + + const { result } = renderHook(() => useMMICustodySignMessage()); + await result.current.custodySignFn({ id: '789' }); + + expect(dispatch).toHaveBeenCalled(); + expect(showModal).toHaveBeenCalledWith({ + name: 'TRANSACTION_FAILED', + errorMessage: 'Test error', + closeNotification: true, + operationFailed: true, + }); + }); +}); diff --git a/ui/pages/confirm-transaction-base/confirm-transaction-base.component.js b/ui/pages/confirm-transaction-base/confirm-transaction-base.component.js index 3a300b37f2e6..74c04977c73a 100644 --- a/ui/pages/confirm-transaction-base/confirm-transaction-base.component.js +++ b/ui/pages/confirm-transaction-base/confirm-transaction-base.component.js @@ -155,6 +155,8 @@ export default class ConfirmTransactionBase extends Component { updateTransaction: PropTypes.func, isUsingPaymaster: PropTypes.bool, isSigningOrSubmitting: PropTypes.bool, + useMaxValue: PropTypes.bool, + maxValue: PropTypes.string, }; state = { @@ -182,6 +184,8 @@ export default class ConfirmTransactionBase extends Component { tryReverseResolveAddress, isEthGasPrice, setDefaultHomeActiveTabName, + hexMaximumTransactionFee, + useMaxValue, } = this.props; const { customNonceValue: prevCustomNonceValue, @@ -189,6 +193,7 @@ export default class ConfirmTransactionBase extends Component { toAddress: prevToAddress, transactionStatus: prevTxStatus, isEthGasPrice: prevIsEthGasPrice, + hexMaximumTransactionFee: prevHexMaximumTransactionFee, } = prevProps; const statusUpdated = transactionStatus !== prevTxStatus; const txDroppedOrConfirmed = @@ -234,6 +239,13 @@ export default class ConfirmTransactionBase extends Component { }); } } + + if ( + hexMaximumTransactionFee !== prevHexMaximumTransactionFee && + useMaxValue + ) { + this.updateValueToMax(); + } } getErrorKey() { @@ -323,6 +335,18 @@ export default class ConfirmTransactionBase extends Component { this.setState({ userAcknowledgedGasMissing: true }); } + updateValueToMax() { + const { maxValue: value, txData, updateTransaction } = this.props; + + updateTransaction({ + ...txData, + txParams: { + ...txData.txParams, + value, + }, + }); + } + renderDetails() { const { primaryTotalTextOverride, diff --git a/ui/pages/confirm-transaction-base/confirm-transaction-base.container.js b/ui/pages/confirm-transaction-base/confirm-transaction-base.container.js index 8f2400ffd519..b1b86a4bb87d 100644 --- a/ui/pages/confirm-transaction-base/confirm-transaction-base.container.js +++ b/ui/pages/confirm-transaction-base/confirm-transaction-base.container.js @@ -99,6 +99,7 @@ import { showCustodyConfirmLink } from '../../store/institutional/institution-ac ///: END:ONLY_INCLUDE_IF import { getTokenAddressParam } from '../../helpers/utils/token-util'; import { calcGasTotal } from '../../../shared/lib/transactions-controller-utils'; +import { subtractHexes } from '../../../shared/modules/conversion.utils'; import ConfirmTransactionBase from './confirm-transaction-base.component'; let customNonceValue = ''; @@ -190,19 +191,26 @@ const mapStateToProps = (state, ownProps) => { checkNetworkAndAccountSupports1559(state) && !isLegacyTransaction(txParams); const { - hexTransactionAmount, + hexTransactionAmount: initialHexTransactionAmount, hexMaximumTransactionFee, hexMinimumTransactionFee, gasEstimationObject, } = transactionFeeSelector(state, transaction); + const useMaxValue = state.confirmTransaction.maxValueMode?.[txId] ?? false; + const maxValue = subtractHexes(balance, hexMaximumTransactionFee); + + const hexTransactionAmount = useMaxValue + ? maxValue + : initialHexTransactionAmount; + const currentNetworkUnapprovedTxs = Object.keys(unapprovedTxs) .filter((key) => unapprovedTxs[key].chainId === chainId) .reduce((acc, key) => ({ ...acc, [key]: unapprovedTxs[key] }), {}); const unapprovedTxCount = valuesFor(currentNetworkUnapprovedTxs).length; const insufficientBalance = !isBalanceSufficient({ - amount, + hexTransactionAmount, gasTotal: calcGasTotal(gasLimit, gasPrice), balance, conversionRate, @@ -210,13 +218,21 @@ const mapStateToProps = (state, ownProps) => { const methodData = getKnownMethodData(state, data) || {}; - const fullTxData = getFullTxData( + const initialTxData = getFullTxData( state, txId, TransactionStatus.unapproved, customTxParamsData, ); + const fullTxData = { + ...initialTxData, + txParams: { + ...txData.txParams, + value: hexTransactionAmount, + }, + }; + customNonceValue = getCustomNonceValue(state); const isEthGasPrice = getIsEthGasPriceFetched(state); const noGasPrice = !supportsEIP1559 && getNoGasPriceFetched(state); @@ -305,6 +321,8 @@ const mapStateToProps = (state, ownProps) => { keyringForAccount: keyring, isUsingPaymaster, isSigningOrSubmitting, + useMaxValue, + maxValue, ///: BEGIN:ONLY_INCLUDE_IF(build-mmi) accountType, isNoteToTraderSupported, diff --git a/ui/pages/home/home.component.js b/ui/pages/home/home.component.js index 3743ba306cfa..849413832ccb 100644 --- a/ui/pages/home/home.component.js +++ b/ui/pages/home/home.component.js @@ -200,6 +200,10 @@ export default class Home extends PureComponent { modalOpen: PropTypes.bool, setWaitForConfirmDeepLinkDialog: PropTypes.func, waitForConfirmDeepLinkDialog: PropTypes.bool, + showCustodianDeepLink: PropTypes.func, + cleanCustodianDeepLink: PropTypes.func, + custodianDeepLink: PropTypes.object, + accountType: PropTypes.string, ///: END:ONLY_INCLUDE_IF }; @@ -354,6 +358,12 @@ export default class Home extends PureComponent { closeNotificationPopup, isNotification, hasAllowedPopupRedirectApprovals, + ///: BEGIN:ONLY_INCLUDE_IF(build-mmi) + custodianDeepLink, + showCustodianDeepLink, + cleanCustodianDeepLink, + accountType, + ///: END:ONLY_INCLUDE_IF } = this.props; const { notificationClosing } = this.state; @@ -363,6 +373,30 @@ export default class Home extends PureComponent { } else if (isNotification || hasAllowedPopupRedirectApprovals) { this.checkStatusAndNavigate(); } + + ///: BEGIN:ONLY_INCLUDE_IF(build-mmi) + if ( + accountType === 'custody' && + custodianDeepLink && + Object.keys(custodianDeepLink).length + ) { + const { custodyId, fromAddress } = custodianDeepLink; + + showCustodianDeepLink({ + fromAddress, + custodyId, + isSignature: true, + isNotification, + onDeepLinkShown: () => { + this.context.trackEvent({ + category: MetaMetricsEventCategory.MMI, + event: MetaMetricsEventName.SignatureDeeplinkDisplayed, + }); + cleanCustodianDeepLink(); + }, + }); + } + ///: END:ONLY_INCLUDE_IF } onRecoveryPhraseReminderClose = () => { diff --git a/ui/pages/home/home.container.js b/ui/pages/home/home.container.js index 615fa30101af..3149cb5b6ada 100644 --- a/ui/pages/home/home.container.js +++ b/ui/pages/home/home.container.js @@ -2,12 +2,18 @@ import { compose } from 'redux'; import { connect } from 'react-redux'; import { withRouter } from 'react-router-dom'; ///: BEGIN:ONLY_INCLUDE_IF(build-mmi) +import { showCustodianDeepLink } from '@metamask-institutional/extension'; import { getMmiPortfolioEnabled, getMmiPortfolioUrl, + getCustodianDeepLink, getWaitForConfirmDeepLinkDialog, } from '../../selectors/institutional/selectors'; -import { mmiActionsFactory } from '../../store/institutional/institution-background'; +import { + mmiActionsFactory, + setCustodianDeepLink, +} from '../../store/institutional/institution-background'; +import { showCustodyConfirmLink } from '../../store/institutional/institution-actions'; import { getInstitutionalConnectRequests } from '../../ducks/institutional/institutional'; ///: END:ONLY_INCLUDE_IF import { @@ -39,6 +45,9 @@ import { getShowSurveyToast, getNewTokensImportedError, hasPendingApprovals, + ///: BEGIN:ONLY_INCLUDE_IF(build-mmi) + getAccountType, + ///: END:ONLY_INCLUDE_IF } from '../../selectors'; import { @@ -181,6 +190,8 @@ const mapStateToProps = (state) => { mmiPortfolioUrl: getMmiPortfolioUrl(state), mmiPortfolioEnabled: getMmiPortfolioEnabled(state), notificationsToShow: getSortedAnnouncementsToShow(state).length > 0, + custodianDeepLink: getCustodianDeepLink(state), + accountType: getAccountType(state), ///: END:ONLY_INCLUDE_IF }; }; @@ -233,6 +244,30 @@ const mapDispatchToProps = (dispatch) => { ///: BEGIN:ONLY_INCLUDE_IF(build-mmi) setWaitForConfirmDeepLinkDialog: (wait) => dispatch(mmiActions.setWaitForConfirmDeepLinkDialog(wait)), + showCustodianDeepLink: ({ + txId = undefined, + fromAddress, + custodyId, + onDeepLinkFetched = () => undefined, + onDeepLinkShown = () => undefined, + isSignature = false, + isNotification = false, + }) => + showCustodianDeepLink({ + dispatch, + mmiActions, + txId, + fromAddress, + custodyId, + closeNotification: isNotification, + onDeepLinkFetched, + onDeepLinkShown, + showCustodyConfirmLink, + isSignature, + }), + cleanCustodianDeepLink: () => { + dispatch(setCustodianDeepLink({})); + }, ///: END:ONLY_INCLUDE_IF setSurveyLinkLastClickedOrClosed: (time) => dispatch(setSurveyLinkLastClickedOrClosed(time)), diff --git a/ui/pages/settings/experimental-tab/__snapshots__/experimental-tab.test.js.snap b/ui/pages/settings/experimental-tab/__snapshots__/experimental-tab.test.js.snap index 7e0c3c9db857..6440e15c130c 100644 --- a/ui/pages/settings/experimental-tab/__snapshots__/experimental-tab.test.js.snap +++ b/ui/pages/settings/experimental-tab/__snapshots__/experimental-tab.test.js.snap @@ -71,187 +71,6 @@ exports[`ExperimentalTab with desktop enabled renders ExperimentalTab component
-

- Security -

-
- - Security alerts - -

- This feature alerts you to malicious activity by actively reviewing transaction and signature requests. Always do your own due diligence before approving any requests. There's no guarantee that this feature will detect all malicious activity. By enabling this feature you agree to the provider's terms of use. -

-
-

- Select your preferred provider -

-
-
-
-

- Blockaid -

-
-

- Recommended -

-
-
-
- Privacy preserving - no data is shared with third parties. Available on Arbitrum, Avalanche, BNB chain, Ethereum Mainnet, Linea, Optimism and Polygon. -
-
-