diff --git a/app/components/Views/confirmations/hooks/useConfirmationRedesignEnabled.ts b/app/components/Views/confirmations/hooks/useConfirmationRedesignEnabled.ts index 140c58dcde4..43ec8489268 100644 --- a/app/components/Views/confirmations/hooks/useConfirmationRedesignEnabled.ts +++ b/app/components/Views/confirmations/hooks/useConfirmationRedesignEnabled.ts @@ -22,7 +22,6 @@ const useConfirmationRedesignEnabled = () => { const isRedesignedEnabled = useMemo( () => (confirmation_redesign as Record)?.signatures && - process.env.REDESIGNED_SIGNATURE_REQUEST === 'true' && // following condition will ensure that user is redirected to old designs is using QR scan aware hardware !isSyncingQRHardware && !isSigningQRObject && diff --git a/e2e/api-mocking/mock-config/mock-events.js b/e2e/api-mocking/mock-config/mock-events.js index 0e3423416b1..755fe4d39da 100644 --- a/e2e/api-mocking/mock-config/mock-events.js +++ b/e2e/api-mocking/mock-config/mock-events.js @@ -38,21 +38,37 @@ export const mockEvents = { securityAlertApiSupportedChains: { urlEndpoint: 'https://security-alerts.api.cx.metamask.io/supportedChains', response: [ - '0xa4b1', - '0xa86a', - '0x2105', - '0x138d5', - '0x38', - '0xe708', - '0x1', - '0x1b6e6', - '0xcc', - '0xa', - '0x89', - '0x82750', - '0xaa36a7', - '0x144' - ], + '0xa4b1', + '0xa86a', + '0x2105', + '0x138d5', + '0x38', + '0xe708', + '0x1', + '0x1b6e6', + '0xcc', + '0xa', + '0x89', + '0x82750', + '0xaa36a7', + '0x144', + ], + responseCode: 200, + }, + + remoteFeatureFlags: { + urlEndpoint: + 'https://client-config.api.cx.metamask.io/v1/flags?client=mobile&distribution=main&environment=dev', + response: [ + { + mobileMinimumVersions: { + appMinimumBuild: 1243, + appleMinimumOS: 6, + androidMinimumAPIVersion: 21, + }, + }, + { confirmation_redesign: { signatures: false } }, + ], responseCode: 200, }, }, @@ -77,7 +93,8 @@ export const mockEvents = { }, securityAlertApiValidate: { - urlEndpoint: 'https://security-alerts.api.cx.metamask.io/validate/0xaa36a7', + urlEndpoint: + 'https://security-alerts.api.cx.metamask.io/validate/0xaa36a7', response: { block: 20733513, result_type: 'Benign', @@ -93,9 +110,9 @@ export const mockEvents = { { from: '0x76cf1cdd1fcc252442b50d6e97207228aa4aefc3', to: '0x50587e46c5b96a3f6f9792922ec647f13e6efae4', - value: '0x0' - } - ] + value: '0x0', + }, + ], }, responseCode: 201, }, diff --git a/e2e/api-specs/json-rpc-coverage.js b/e2e/api-specs/json-rpc-coverage.js index ca5b30f828a..bcc75bc049c 100644 --- a/e2e/api-specs/json-rpc-coverage.js +++ b/e2e/api-specs/json-rpc-coverage.js @@ -22,6 +22,7 @@ import ConfirmationsRejectRule from './ConfirmationsRejectionRule'; import { createDriverTransport } from './helpers'; import { BrowserViewSelectorsIDs } from '../selectors/Browser/BrowserView.selectors'; import { getGanachePort } from '../fixtures/utils'; +import { mockEvents } from '../api-mocking/mock-config/mock-events'; const port = getGanachePort(8545, process.pid); const chainId = 1337; @@ -156,6 +157,10 @@ const main = async () => { const server = mockServer(port, openrpcDocument); server.start(); + const testSpecificMock = { + GET: [mockEvents.GET.remoteFeatureFlags], + }; + await withFixtures( { dapp: true, @@ -163,6 +168,7 @@ const main = async () => { ganacheOptions: defaultGanacheOptions, disableGanache: true, restartDevice: true, + testSpecificMock, }, async () => { await loginToApp(); diff --git a/e2e/specs/confirmations/signatures/ethereum-sign.spec.js b/e2e/specs/confirmations/signatures/ethereum-sign.spec.js index 4be24f172ca..b51be2c81b6 100644 --- a/e2e/specs/confirmations/signatures/ethereum-sign.spec.js +++ b/e2e/specs/confirmations/signatures/ethereum-sign.spec.js @@ -12,6 +12,7 @@ import { import { SmokeConfirmations } from '../../../tags'; import TestHelpers from '../../../helpers'; import Assertions from '../../../utils/Assertions'; +import { mockEvents } from '../../../api-mocking/mock-config/mock-events'; describe(SmokeConfirmations('Ethereum Sign'), () => { beforeAll(async () => { @@ -20,6 +21,10 @@ describe(SmokeConfirmations('Ethereum Sign'), () => { }); it('Sign in with Ethereum', async () => { + const testSpecificMock = { + GET: [mockEvents.GET.remoteFeatureFlags], + }; + await withFixtures( { dapp: true, @@ -29,6 +34,7 @@ describe(SmokeConfirmations('Ethereum Sign'), () => { .build(), restartDevice: true, ganacheOptions: defaultGanacheOptions, + testSpecificMock, }, async () => { await loginToApp(); diff --git a/e2e/specs/confirmations/signatures/personal-sign.spec.js b/e2e/specs/confirmations/signatures/personal-sign.spec.js index 0e3acf0579c..4fc37496141 100644 --- a/e2e/specs/confirmations/signatures/personal-sign.spec.js +++ b/e2e/specs/confirmations/signatures/personal-sign.spec.js @@ -12,8 +12,13 @@ import { import { SmokeConfirmations } from '../../../tags'; import TestHelpers from '../../../helpers'; import Assertions from '../../../utils/Assertions'; +import { mockEvents } from '../../../api-mocking/mock-config/mock-events'; describe(SmokeConfirmations('Personal Sign'), () => { + const testSpecificMock = { + GET: [mockEvents.GET.remoteFeatureFlags], + }; + beforeAll(async () => { jest.setTimeout(2500000); await TestHelpers.reverseServerPort(); @@ -29,6 +34,7 @@ describe(SmokeConfirmations('Personal Sign'), () => { .build(), restartDevice: true, ganacheOptions: defaultGanacheOptions, + testSpecificMock, }, async () => { await loginToApp(); diff --git a/e2e/specs/confirmations/signatures/security-alert-signatures.mock.spec.js b/e2e/specs/confirmations/signatures/security-alert-signatures.mock.spec.js index ff4a19e0137..77f0f3b3721 100644 --- a/e2e/specs/confirmations/signatures/security-alert-signatures.mock.spec.js +++ b/e2e/specs/confirmations/signatures/security-alert-signatures.mock.spec.js @@ -60,7 +60,10 @@ describe(SmokeConfirmations('Security Alert API - Signature'), () => { it('should sign typed message', async () => { const testSpecificMock = { - GET: [mockEvents.GET.securityAlertApiSupportedChains], + GET: [ + mockEvents.GET.securityAlertApiSupportedChains, + mockEvents.GET.remoteFeatureFlags, + ], POST: [ { ...mockEvents.POST.securityAlertApiValidate, @@ -83,7 +86,10 @@ describe(SmokeConfirmations('Security Alert API - Signature'), () => { it('should show security alert for malicious request', async () => { const testSpecificMock = { - GET: [mockEvents.GET.securityAlertApiSupportedChains], + GET: [ + mockEvents.GET.securityAlertApiSupportedChains, + mockEvents.GET.remoteFeatureFlags, + ], POST: [ { ...mockEvents.POST.securityAlertApiValidate, @@ -108,6 +114,7 @@ describe(SmokeConfirmations('Security Alert API - Signature'), () => { const testSpecificMock = { GET: [ mockEvents.GET.securityAlertApiSupportedChains, + mockEvents.GET.remoteFeatureFlags, { urlEndpoint: 'https://static.cx.metamask.io/api/v1/confirmations/ppom/ppom_version.json', diff --git a/e2e/specs/confirmations/signatures/typed-sign-v3.spec.js b/e2e/specs/confirmations/signatures/typed-sign-v3.spec.js index 86d958aa561..26cf84334ae 100644 --- a/e2e/specs/confirmations/signatures/typed-sign-v3.spec.js +++ b/e2e/specs/confirmations/signatures/typed-sign-v3.spec.js @@ -12,8 +12,13 @@ import { import { SmokeConfirmations } from '../../../tags'; import TestHelpers from '../../../helpers'; import Assertions from '../../../utils/Assertions'; +import { mockEvents } from '../../../api-mocking/mock-config/mock-events'; describe(SmokeConfirmations('Typed Sign V3'), () => { + const testSpecificMock = { + GET: [mockEvents.GET.remoteFeatureFlags], + }; + beforeAll(async () => { jest.setTimeout(2500000); await TestHelpers.reverseServerPort(); @@ -29,6 +34,7 @@ describe(SmokeConfirmations('Typed Sign V3'), () => { .build(), restartDevice: true, ganacheOptions: defaultGanacheOptions, + testSpecificMock, }, async () => { await loginToApp(); diff --git a/e2e/specs/confirmations/signatures/typed-sign-v4.spec.js b/e2e/specs/confirmations/signatures/typed-sign-v4.spec.js index 4de3dd9b006..c82b6e7a17b 100644 --- a/e2e/specs/confirmations/signatures/typed-sign-v4.spec.js +++ b/e2e/specs/confirmations/signatures/typed-sign-v4.spec.js @@ -12,8 +12,13 @@ import { import { SmokeConfirmations } from '../../../tags'; import TestHelpers from '../../../helpers'; import Assertions from '../../../utils/Assertions'; +import { mockEvents } from '../../../api-mocking/mock-config/mock-events'; describe(SmokeConfirmations('Typed Sign V4'), () => { + const testSpecificMock = { + GET: [mockEvents.GET.remoteFeatureFlags], + }; + beforeAll(async () => { jest.setTimeout(2500000); await TestHelpers.reverseServerPort(); @@ -29,6 +34,7 @@ describe(SmokeConfirmations('Typed Sign V4'), () => { .build(), restartDevice: true, ganacheOptions: defaultGanacheOptions, + testSpecificMock, }, async () => { await loginToApp(); diff --git a/e2e/specs/confirmations/signatures/typed-sign.spec.js b/e2e/specs/confirmations/signatures/typed-sign.spec.js index bee5b2a5e8a..c6b9cfed353 100644 --- a/e2e/specs/confirmations/signatures/typed-sign.spec.js +++ b/e2e/specs/confirmations/signatures/typed-sign.spec.js @@ -12,8 +12,13 @@ import { import { SmokeConfirmations } from '../../../tags'; import TestHelpers from '../../../helpers'; import Assertions from '../../../utils/Assertions'; +import { mockEvents } from '../../../api-mocking/mock-config/mock-events'; describe(SmokeConfirmations('Typed Sign'), () => { + const testSpecificMock = { + GET: [mockEvents.GET.remoteFeatureFlags], + }; + beforeAll(async () => { jest.setTimeout(2500000); await TestHelpers.reverseServerPort(); @@ -29,6 +34,7 @@ describe(SmokeConfirmations('Typed Sign'), () => { .build(), restartDevice: true, ganacheOptions: defaultGanacheOptions, + testSpecificMock, }, async () => { await loginToApp(); diff --git a/jest.config.js b/jest.config.js index bbc092b33f5..d54cc45b1f8 100644 --- a/jest.config.js +++ b/jest.config.js @@ -9,8 +9,6 @@ process.env.MM_SECURITY_ALERTS_API_ENABLED = 'true'; process.env.PORTFOLIO_VIEW = 'true'; process.env.SECURITY_ALERTS_API_URL = 'https://example.com'; -process.env.REDESIGNED_SIGNATURE_REQUEST = 'true'; - process.env.LAUNCH_DARKLY_URL = 'https://client-config.dev-api.cx.metamask.io/v1';