diff --git a/app/scripts/lib/setupSentry.js b/app/scripts/lib/setupSentry.js index 9432f8c4e7af..380da4c272ba 100644 --- a/app/scripts/lib/setupSentry.js +++ b/app/scripts/lib/setupSentry.js @@ -246,7 +246,6 @@ export const SENTRY_BACKGROUND_STATE = { preferences: { autoLockTimeLimit: true, hideZeroBalanceTokens: true, - redesignedConfirmationsEnabled: true, isRedesignedConfirmationsDeveloperEnabled: false, showExtensionInFullSizeView: true, showFiatInTestnets: true, diff --git a/app/scripts/migrations/122.test.ts b/app/scripts/migrations/122.test.ts deleted file mode 100644 index 0cfeb025150d..000000000000 --- a/app/scripts/migrations/122.test.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { migrate, version } from './122'; - -const oldVersion = 121; - -describe('migration #122', () => { - afterEach(() => { - jest.resetAllMocks(); - }); - - it('updates the version metadata', async () => { - const oldStorage = { - meta: { - version: oldVersion, - }, - data: {}, - }; - - const newStorage = await migrate(oldStorage); - - expect(newStorage.meta).toStrictEqual({ version }); - }); - - describe('set redesignedConfirmationsEnabled to true in PreferencesController', () => { - it('sets redesignedConfirmationsEnabled to true', async () => { - const oldStorage = { - PreferencesController: { - preferences: { - redesignedConfirmationsEnabled: false, - }, - }, - }; - - const expectedState = { - PreferencesController: { - preferences: { - redesignedConfirmationsEnabled: true, - }, - }, - }; - - const transformedState = await migrate({ - meta: { version: oldVersion }, - data: oldStorage, - }); - - expect(transformedState.data).toEqual(expectedState); - }); - - it( - 'sets redesignedConfirmationsEnabled to true even with original preferences object in the' + - 'state', - async () => { - const oldStorage = { - PreferencesController: {}, - }; - - const expectedState = { - PreferencesController: { - preferences: { - redesignedConfirmationsEnabled: true, - }, - }, - }; - - const transformedState = await migrate({ - meta: { version: oldVersion }, - data: oldStorage, - }); - - expect(transformedState.data).toEqual(expectedState); - }, - ); - }); -}); diff --git a/app/scripts/migrations/122.ts b/app/scripts/migrations/122.ts deleted file mode 100644 index cb0b2090472b..000000000000 --- a/app/scripts/migrations/122.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { cloneDeep } from 'lodash'; -import { hasProperty, isObject } from '@metamask/utils'; - -type VersionedData = { - meta: { version: number }; - data: Record; -}; - -export const version = 122; - -/** - * This migration sets preference redesignedConfirmationsEnabled to true - * - * @param originalVersionedData - Versioned MetaMask extension state, exactly what we persist to dist. - * @param originalVersionedData.meta - State metadata. - * @param originalVersionedData.meta.version - The current state version. - * @param originalVersionedData.data - The persisted MetaMask state, keyed by controller. - * @returns Updated versioned MetaMask extension state. - */ -export async function migrate( - originalVersionedData: VersionedData, -): Promise { - const versionedData = cloneDeep(originalVersionedData); - versionedData.meta.version = version; - transformState(versionedData.data); - return versionedData; -} - -// TODO: Replace `any` with specific type -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function transformState(state: Record) { - if (!hasProperty(state, 'PreferencesController')) { - return; - } - - if (!isObject(state.PreferencesController)) { - const controllerType = typeof state.PreferencesController; - global.sentry?.captureException?.( - new Error(`state.PreferencesController is type: ${controllerType}`), - ); - } - - if (!isObject(state.PreferencesController?.preferences)) { - state.PreferencesController = { - preferences: {}, - }; - } - - state.PreferencesController.preferences.redesignedConfirmationsEnabled = true; -} diff --git a/app/scripts/migrations/index.js b/app/scripts/migrations/index.js index a12285ac441d..1b680645a331 100644 --- a/app/scripts/migrations/index.js +++ b/app/scripts/migrations/index.js @@ -133,7 +133,7 @@ const migrations = [ require('./120'), require('./120.1'), require('./121'), - require('./122'), + require('./123'), ]; 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 24e996671da9..d00540360317 100644 --- a/test/e2e/accounts/snap-account-signatures-and-disconnects.spec.ts +++ b/test/e2e/accounts/snap-account-signatures-and-disconnects.spec.ts @@ -1,10 +1,6 @@ import { Suite } from 'mocha'; import FixtureBuilder from '../fixture-builder'; -import { - withFixtures, - multipleGanacheOptions, - tempToggleSettingRedesignedConfirmations, -} from '../helpers'; +import { withFixtures, multipleGanacheOptions } from '../helpers'; import { Driver } from '../webdriver/driver'; import { installSnapSimpleKeyring, @@ -31,8 +27,6 @@ describe('Snap Account Signatures and Disconnects', function (this: Suite) { const newPublicKey = await makeNewAccountAndSwitch(driver); - await tempToggleSettingRedesignedConfirmations(driver); - // open the Test Dapp and connect Account 2 to it await connectAccountToTestDapp(driver); diff --git a/test/e2e/accounts/snap-account-signatures.spec.ts b/test/e2e/accounts/snap-account-signatures.spec.ts index b4ef979bf123..5c1a00a2c00c 100644 --- a/test/e2e/accounts/snap-account-signatures.spec.ts +++ b/test/e2e/accounts/snap-account-signatures.spec.ts @@ -1,8 +1,5 @@ import { Suite } from 'mocha'; -import { - tempToggleSettingRedesignedConfirmations, - withFixtures, -} from '../helpers'; +import { openDapp, withFixtures } from '../helpers'; import { Driver } from '../webdriver/driver'; import { accountSnapFixtures, @@ -30,7 +27,7 @@ describe('Snap Account Signatures', function (this: Suite) { const newPublicKey = await makeNewAccountAndSwitch(driver); - await tempToggleSettingRedesignedConfirmations(driver); + await openDapp(driver); // Run all 6 signature types const locatorIDs = [ diff --git a/test/e2e/helpers.js b/test/e2e/helpers.js index b6d71827df03..b04b10dbf5a3 100644 --- a/test/e2e/helpers.js +++ b/test/e2e/helpers.js @@ -1268,6 +1268,5 @@ module.exports = { defaultGanacheOptionsForType2Transactions, removeSelectedAccount, getSelectedAccountAddress, - tempToggleSettingRedesignedConfirmations, openMenuSafe, }; diff --git a/test/e2e/snaps/test-snap-siginsights.spec.js b/test/e2e/snaps/test-snap-siginsights.spec.js index 2e69d08cd547..6b43551ac182 100644 --- a/test/e2e/snaps/test-snap-siginsights.spec.js +++ b/test/e2e/snaps/test-snap-siginsights.spec.js @@ -5,7 +5,6 @@ const { openDapp, unlockWallet, switchToNotificationWindow, - tempToggleSettingRedesignedConfirmations, WINDOW_TITLES, } = require('../helpers'); const FixtureBuilder = require('../fixture-builder'); @@ -30,7 +29,6 @@ describe('Test Snap Signature Insights', function () { }, async ({ driver }) => { await unlockWallet(driver); - await tempToggleSettingRedesignedConfirmations(driver); // navigate to test snaps page and connect await driver.openNewPage(TEST_SNAPS_WEBSITE_URL); diff --git a/test/e2e/tests/dapp-interactions/signin-with-ethereum.spec.js b/test/e2e/tests/dapp-interactions/signin-with-ethereum.spec.js index b2fe384f9523..5c6e3bb4803c 100644 --- a/test/e2e/tests/dapp-interactions/signin-with-ethereum.spec.js +++ b/test/e2e/tests/dapp-interactions/signin-with-ethereum.spec.js @@ -4,7 +4,6 @@ const { withFixtures, openDapp, DAPP_URL, - tempToggleSettingRedesignedConfirmations, unlockWallet, WINDOW_TITLES, } = require('../../helpers'); @@ -29,7 +28,6 @@ describe('Sign in with ethereum', function () { }, async ({ driver }) => { await unlockWallet(driver); - await tempToggleSettingRedesignedConfirmations(driver); // Create a signin with ethereum request in test dapp await openDapp(driver); diff --git a/test/e2e/tests/metrics/signature-approved.spec.js b/test/e2e/tests/metrics/signature-approved.spec.js index 065c1e792a54..c5b4a2ac1165 100644 --- a/test/e2e/tests/metrics/signature-approved.spec.js +++ b/test/e2e/tests/metrics/signature-approved.spec.js @@ -8,7 +8,6 @@ const { unlockWallet, getEventPayloads, clickSignOnSignatureConfirmation, - tempToggleSettingRedesignedConfirmations, validateContractDetails, } = require('../../helpers'); const FixtureBuilder = require('../../fixture-builder'); @@ -66,7 +65,6 @@ describe('Signature Approved Event @no-mmi', function () { }, async ({ driver, mockedEndpoint: mockedEndpoints }) => { await unlockWallet(driver); - await tempToggleSettingRedesignedConfirmations(driver); await openDapp(driver); // creates a sign typed data signature request @@ -118,7 +116,6 @@ describe('Signature Approved Event @no-mmi', function () { }, async ({ driver, mockedEndpoint: mockedEndpoints }) => { await unlockWallet(driver); - await tempToggleSettingRedesignedConfirmations(driver); await openDapp(driver); // creates a sign typed data signature request @@ -166,7 +163,6 @@ describe('Signature Approved Event @no-mmi', function () { }, async ({ driver, mockedEndpoint: mockedEndpoints }) => { await unlockWallet(driver); - await tempToggleSettingRedesignedConfirmations(driver); await openDapp(driver); // creates a sign typed data signature request @@ -213,7 +209,6 @@ describe('Signature Approved Event @no-mmi', function () { }, async ({ driver, mockedEndpoint: mockedEndpoints }) => { await unlockWallet(driver); - await tempToggleSettingRedesignedConfirmations(driver); await openDapp(driver); // creates a sign typed data signature request @@ -265,7 +260,6 @@ describe('Signature Approved Event @no-mmi', function () { }, async ({ driver, mockedEndpoint: mockedEndpoints }) => { await unlockWallet(driver); - await tempToggleSettingRedesignedConfirmations(driver); await openDapp(driver); // creates a sign typed data signature request diff --git a/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-background-state.json b/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-background-state.json index 391224338a39..e5e6a217f42f 100644 --- a/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-background-state.json +++ b/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-background-state.json @@ -204,7 +204,6 @@ "useNativeCurrencyAsPrimaryCurrency": true, "petnamesEnabled": true, "showTokenAutodetectModal": "boolean", - "redesignedConfirmationsEnabled": true, "isRedesignedConfirmationsDeveloperEnabled": "boolean" }, "ipfsGateway": "string", @@ -269,14 +268,14 @@ "errorKey": "", "topAggId": "object", "routeState": "", + "swapsFeatureFlags": {}, "swapsFeatureIsLive": true, "saveFetchedQuotes": false, "swapsQuoteRefreshTime": 60000, "swapsQuotePrefetchingRefreshTime": 60000, "swapsStxBatchStatusRefreshTime": 10000, "swapsStxGetTransactionsRefreshTime": 10000, - "swapsStxMaxFeeMultiplier": 2, - "swapsFeatureFlags": {} + "swapsStxMaxFeeMultiplier": 2 } }, "TokenListController": { diff --git a/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-ui-state.json b/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-ui-state.json index 4d3f7779e456..bf71f9095fbb 100644 --- a/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-ui-state.json +++ b/test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-ui-state.json @@ -35,7 +35,6 @@ "useNativeCurrencyAsPrimaryCurrency": true, "petnamesEnabled": true, "showTokenAutodetectModal": "boolean", - "redesignedConfirmationsEnabled": true, "isRedesignedConfirmationsDeveloperEnabled": "boolean" }, "firstTimeFlowType": "import", @@ -63,6 +62,11 @@ }, "connectedStatusPopoverHasBeenShown": true, "defaultHomeActiveTabName": null, + "bridgeState": { + "bridgeFeatureFlags": { + "extensionSupport": "boolean" + } + }, "browserEnvironment": { "os": "string", "browser": "string" }, "popupGasPollTokens": "object", "notificationGasPollTokens": "object", @@ -117,9 +121,9 @@ "useRequestQueue": true, "openSeaEnabled": false, "securityAlertsEnabled": "boolean", + "addSnapAccountEnabled": "boolean", "bitcoinSupportEnabled": "boolean", "bitcoinTestnetSupportEnabled": "boolean", - "addSnapAccountEnabled": "boolean", "advancedGasFee": {}, "incomingTransactionsPreferences": {}, "identities": "object", @@ -244,16 +248,15 @@ "errorKey": "", "topAggId": "object", "routeState": "", + "swapsFeatureFlags": {}, "swapsFeatureIsLive": true, "saveFetchedQuotes": false, "swapsQuoteRefreshTime": 60000, "swapsQuotePrefetchingRefreshTime": 60000, "swapsStxBatchStatusRefreshTime": 10000, "swapsStxGetTransactionsRefreshTime": 10000, - "swapsStxMaxFeeMultiplier": 2, - "swapsFeatureFlags": {} + "swapsStxMaxFeeMultiplier": 2 }, - "bridgeState": { "bridgeFeatureFlags": { "extensionSupport": "boolean" } }, "ensEntries": "object", "ensResolutionsByAddress": "object", "pendingApprovals": "object", diff --git a/test/e2e/tests/petnames/petnames-signatures.spec.js b/test/e2e/tests/petnames/petnames-signatures.spec.js index ba6cf7642c59..ecc972ca9f6b 100644 --- a/test/e2e/tests/petnames/petnames-signatures.spec.js +++ b/test/e2e/tests/petnames/petnames-signatures.spec.js @@ -2,7 +2,6 @@ const { openDapp, switchToNotificationWindow, withFixtures, - tempToggleSettingRedesignedConfirmations, unlockWallet, defaultGanacheOptions, } = require('../../helpers'); @@ -109,7 +108,6 @@ describe('Petnames - Signatures', function () { }, async ({ driver }) => { await unlockWallet(driver); - await tempToggleSettingRedesignedConfirmations(driver); await openDapp(driver); await createSignatureRequest(driver, SIGNATURE_TYPE.TYPED_V3); await switchToNotificationWindow(driver, 3); @@ -146,7 +144,6 @@ describe('Petnames - Signatures', function () { }, async ({ driver }) => { await unlockWallet(driver); - await tempToggleSettingRedesignedConfirmations(driver); await openDapp(driver); await createSignatureRequest(driver, SIGNATURE_TYPE.TYPED_V4); await switchToNotificationWindow(driver, 3); @@ -188,7 +185,6 @@ describe('Petnames - Signatures', function () { }, async ({ driver }) => { await unlockWallet(driver); - await tempToggleSettingRedesignedConfirmations(driver); await openDapp(driver); await openTestSnaps(driver); await installNameLookupSnap(driver); diff --git a/test/e2e/tests/request-queuing/dapp1-send-dapp2-signTypedData.spec.js b/test/e2e/tests/request-queuing/dapp1-send-dapp2-signTypedData.spec.js index 4a6bbec462ab..cd197970baea 100644 --- a/test/e2e/tests/request-queuing/dapp1-send-dapp2-signTypedData.spec.js +++ b/test/e2e/tests/request-queuing/dapp1-send-dapp2-signTypedData.spec.js @@ -7,7 +7,6 @@ const { DAPP_ONE_URL, regularDelayMs, defaultGanacheOptions, - tempToggleSettingRedesignedConfirmations, WINDOW_TITLES, } = require('../../helpers'); @@ -43,7 +42,6 @@ describe('Request Queuing Dapp 1, Switch Tx -> Dapp 2 Send Tx', function () { }, async ({ driver }) => { await unlockWallet(driver); - await tempToggleSettingRedesignedConfirmations(driver); // Open Dapp One await openDapp(driver, undefined, DAPP_URL); diff --git a/test/e2e/tests/request-queuing/ui.spec.js b/test/e2e/tests/request-queuing/ui.spec.js index ae84d7125d02..cea9e045ceed 100644 --- a/test/e2e/tests/request-queuing/ui.spec.js +++ b/test/e2e/tests/request-queuing/ui.spec.js @@ -11,7 +11,6 @@ const { WINDOW_TITLES, defaultGanacheOptions, switchToNotificationWindow, - tempToggleSettingRedesignedConfirmations, veryLargeDelayMs, DAPP_TWO_URL, } = require('../../helpers'); @@ -636,7 +635,6 @@ describe('Request-queue UI changes', function () { }, async ({ driver, ganacheServer, secondaryGanacheServer }) => { await unlockWallet(driver); - await tempToggleSettingRedesignedConfirmations(driver); // Navigate to extension home screen await driver.navigate(PAGES.HOME); diff --git a/test/e2e/tests/signature/personal-sign.spec.js b/test/e2e/tests/signature/personal-sign.spec.js index e4864a84db47..a9ca117d5fe7 100644 --- a/test/e2e/tests/signature/personal-sign.spec.js +++ b/test/e2e/tests/signature/personal-sign.spec.js @@ -4,7 +4,6 @@ const { withFixtures, openDapp, regularDelayMs, - tempToggleSettingRedesignedConfirmations, unlockWallet, WINDOW_TITLES, } = require('../../helpers'); @@ -25,7 +24,6 @@ describe('Personal sign', function () { const addresses = await ganacheServer.getAccounts(); const publicAddress = addresses[0]; await unlockWallet(driver); - await tempToggleSettingRedesignedConfirmations(driver); await openDapp(driver); await driver.clickElement('#personalSign'); @@ -49,7 +47,6 @@ describe('Personal sign', function () { }, ); }); - it('can queue multiple personal signs and confirm', async function () { await withFixtures( { @@ -64,7 +61,6 @@ describe('Personal sign', function () { const addresses = await ganacheServer.getAccounts(); const publicAddress = addresses[0]; await unlockWallet(driver); - await tempToggleSettingRedesignedConfirmations(driver); await openDapp(driver); // Create personal sign diff --git a/test/e2e/tests/signature/signature-request.spec.js b/test/e2e/tests/signature/signature-request.spec.js index 99fcb61c5067..5a623b683f8c 100644 --- a/test/e2e/tests/signature/signature-request.spec.js +++ b/test/e2e/tests/signature/signature-request.spec.js @@ -5,7 +5,6 @@ const { openDapp, DAPP_URL, defaultGanacheOptions, - tempToggleSettingRedesignedConfirmations, unlockWallet, WINDOW_TITLES, } = require('../../helpers'); @@ -78,7 +77,6 @@ describe('Sign Typed Data Signature Request', function () { const addresses = await ganacheServer.getAccounts(); const publicAddress = addresses[0]; await unlockWallet(driver); - await tempToggleSettingRedesignedConfirmations(driver); await openDapp(driver); @@ -139,7 +137,6 @@ describe('Sign Typed Data Signature Request', function () { const addresses = await ganacheServer.getAccounts(); const publicAddress = addresses[0]; await unlockWallet(driver); - await tempToggleSettingRedesignedConfirmations(driver); await openDapp(driver); @@ -215,7 +212,6 @@ describe('Sign Typed Data Signature Request', function () { }, async ({ driver }) => { await unlockWallet(driver); - await tempToggleSettingRedesignedConfirmations(driver); await openDapp(driver); @@ -241,8 +237,6 @@ describe('Sign Typed Data Signature Request', function () { // switch to the Dapp and verify the rejection was successful await driver.switchToWindowWithTitle('E2E Test Dapp', windowHandles); - - await driver.waitForSelector(data.verifyRejectionResultId); const rejectionResult = await driver.findElement( data.verifyRejectionResultId, ); @@ -269,7 +263,6 @@ describe('Sign Typed Data Signature Request', function () { }, async ({ driver }) => { await unlockWallet(driver); - await tempToggleSettingRedesignedConfirmations(driver); await openDapp(driver); @@ -313,8 +306,6 @@ describe('Sign Typed Data Signature Request', function () { // switch to the Dapp and verify the rejection was successful await driver.switchToWindowWithTitle('E2E Test Dapp'); - - await driver.waitForSelector(data.verifyRejectionResultId); const rejectionResult = await driver.findElement( data.verifyRejectionResultId, ); diff --git a/test/e2e/webdriver/driver.js b/test/e2e/webdriver/driver.js index 876f7fc35e91..0ca785b92ef4 100644 --- a/test/e2e/webdriver/driver.js +++ b/test/e2e/webdriver/driver.js @@ -887,10 +887,7 @@ class Driver { await this.delay(delayStep); timeElapsed += delayStep; } - - throw new Error( - `waitUntilXWindowHandles timed out polling window handles. Expected: ${x}, Actual: ${windowHandles.length}`, - ); + throw new Error('waitUntilXWindowHandles timed out polling window handles'); } /** diff --git a/ui/pages/settings/experimental-tab/experimental-tab.component.tsx b/ui/pages/settings/experimental-tab/experimental-tab.component.tsx index ca1345cffd1e..c1dcdf7d0397 100644 --- a/ui/pages/settings/experimental-tab/experimental-tab.component.tsx +++ b/ui/pages/settings/experimental-tab/experimental-tab.component.tsx @@ -153,7 +153,6 @@ export default class ExperimentalTab extends PureComponent description: t('redesignedConfirmationsToggleDescription'), toggleValue: redesignedConfirmationsEnabled, toggleCallback: (value) => setRedesignedConfirmationsEnabled(!value), - toggleContainerDataTestId: 'toggle-redesigned-confirmations-container', toggleDataTestId: 'toggle-redesigned-confirmations', toggleOffLabel: t('off'), toggleOnLabel: t('on'),