Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Move ENABLE_CONFIRMATION_REDESIGN feature flag to the developer settings page #25520

Merged
merged 57 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from 45 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
fd5e7ac
feat: Move ENABLE_CONFIRMATION_REDESIGN feature flag to the developer…
pnarayanaswamy Jun 25, 2024
1df409c
test: add unit tests
pnarayanaswamy Jun 26, 2024
10efc78
refactor: move hooks to useCurrentConfirmations
pnarayanaswamy Jun 27, 2024
30f51ed
chore: remove ENABLE_CONFIRMATION_REDESIGN feature flag
pnarayanaswamy Jun 27, 2024
231e6cd
chore: remove circle ci job for running tests
pnarayanaswamy Jun 27, 2024
896ace1
test: update snapshot
pnarayanaswamy Jun 27, 2024
f5224b4
test: fix failing e2e
pnarayanaswamy Jun 28, 2024
5f90017
Revert "test: fix failing e2e"
pnarayanaswamy Jun 28, 2024
c764df7
test: fix failing e2e
pnarayanaswamy Jun 28, 2024
5736f66
test: fix failing sentry e2e and update snapshots
pnarayanaswamy Jun 28, 2024
6a18cb1
refactor: update condition for when to show redesigned transactions
pnarayanaswamy Jun 28, 2024
596dc8b
fix: lint
pnarayanaswamy Jun 28, 2024
9cb635a
merge: develop
pnarayanaswamy Jun 28, 2024
1400142
refactor: rename toggle
pnarayanaswamy Jun 28, 2024
f32ec89
fix: lint error
pnarayanaswamy Jun 28, 2024
e38c825
fix: add env variable back
pnarayanaswamy Jun 28, 2024
ad9e3c2
fix: lint for env var
pnarayanaswamy Jun 28, 2024
5b2e380
merge: Merge branch 'develop' into developer-settings
pnarayanaswamy Jul 3, 2024
1760b53
refactor: address review rename and move toggle
pnarayanaswamy Jul 4, 2024
612eff2
review: create new component for toggle row
pnarayanaswamy Jul 4, 2024
104c4eb
review: update tests
pnarayanaswamy Jul 4, 2024
d629e99
merge: merge develop
pnarayanaswamy Jul 5, 2024
ae04ce8
test: update contract interaction test
pnarayanaswamy Jul 5, 2024
72a6968
review: rename shouldProcess
pnarayanaswamy Jul 5, 2024
5144336
Merge branch 'develop' into developer-settings
pnarayanaswamy Jul 11, 2024
e35bf8e
Merge branch 'develop' into developer-settings
pnarayanaswamy Jul 11, 2024
5a063ed
refactor: adress reviews
pnarayanaswamy Jul 11, 2024
d0ffc3b
Merge branch 'develop' into developer-settings
pnarayanaswamy Jul 11, 2024
4082123
Merge branch 'develop' into developer-settings
pnarayanaswamy Jul 12, 2024
f18094a
Merge branch 'develop' into developer-settings
pnarayanaswamy Jul 16, 2024
09c0126
Merge branch 'develop' into developer-settings
pnarayanaswamy Jul 16, 2024
59bdde3
Merge branch 'develop' into developer-settings
pnarayanaswamy Jul 17, 2024
9e7015c
test: add no-mmi tag
pnarayanaswamy Jul 17, 2024
b132eee
chore: add delay to metrics test
pnarayanaswamy Jul 17, 2024
27d7994
Merge branch 'develop' into developer-settings
pnarayanaswamy Jul 17, 2024
902fb04
Merge branch 'develop' into developer-settings
pnarayanaswamy Jul 17, 2024
e99eb71
chore: add preference to contract interaction test
pnarayanaswamy Jul 17, 2024
a943385
Merge branch 'developer-settings' of github.com:MetaMask/metamask-ext…
pnarayanaswamy Jul 17, 2024
bf1c98a
chore: add preference to metric test
pnarayanaswamy Jul 17, 2024
2cc18e3
chore: add no-mmi to metric test
pnarayanaswamy Jul 17, 2024
15ec906
Merge branch 'develop' into developer-settings
pnarayanaswamy Jul 17, 2024
a50baaf
chore: add try catch for helper
pnarayanaswamy Jul 17, 2024
21ab57c
Merge branch 'developer-settings' of github.com:MetaMask/metamask-ext…
pnarayanaswamy Jul 17, 2024
032f17a
Merge branch 'develop' into developer-settings
pnarayanaswamy Jul 18, 2024
fad73b8
Merge branch 'develop' into developer-settings
pnarayanaswamy Jul 18, 2024
d78a1e2
fix: use developer setting for metrics
pnarayanaswamy Jul 18, 2024
4ebf249
Revert "chore: add try catch for helper"
pnarayanaswamy Jul 18, 2024
ddbc44e
Merge branch 'develop' into developer-settings
pnarayanaswamy Jul 18, 2024
cd543bb
Merge branch 'develop' into developer-settings
pnarayanaswamy Jul 18, 2024
14258df
Merge branch 'develop' into developer-settings
pnarayanaswamy Jul 19, 2024
05f5945
Merge branch 'develop' into developer-settings
pnarayanaswamy Jul 19, 2024
5fcc2a2
Merge branch 'develop' into developer-settings
pnarayanaswamy Jul 19, 2024
5cac014
Merge branch 'develop' into developer-settings
pnarayanaswamy Jul 19, 2024
da6a204
Merge branch 'develop' into developer-settings
pnarayanaswamy Jul 22, 2024
c03dc94
Merge branch 'develop' into developer-settings
pnarayanaswamy Jul 22, 2024
f19d901
Merge branch 'develop' into developer-settings
pnarayanaswamy Jul 22, 2024
50b45b5
Merge branch 'develop' into developer-settings
pnarayanaswamy Jul 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
122 changes: 0 additions & 122 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,6 @@ workflows:
- prep-build-test-mv2:
requires:
- prep-deps
- prep-build-confirmation-redesign-test:
requires:
- prep-deps
- prep-build-confirmation-redesign-test-mv2:
<<: *develop_master_rc_only
requires:
- prep-deps
- prep-build-test-flask:
requires:
- prep-deps
Expand Down Expand Up @@ -199,18 +192,10 @@ workflows:
requires:
- prep-build-test
- get-changed-files-with-git-diff
- test-e2e-chrome-confirmation-redesign:
requires:
- prep-build-confirmation-redesign-test
- get-changed-files-with-git-diff
- test-e2e-firefox:
requires:
- prep-build-test-mv2
- get-changed-files-with-git-diff
- test-e2e-firefox-confirmation-redesign:
<<: *develop_master_rc_only
requires:
- prep-build-confirmation-redesign-test-mv2
- test-e2e-chrome-rpc:
requires:
- prep-build-test
Expand Down Expand Up @@ -304,8 +289,6 @@ workflows:
- test-mozilla-lint-flask-mv2
- test-e2e-chrome
- test-e2e-chrome-multiple-providers
- test-e2e-chrome-confirmation-redesign
- test-e2e-firefox-confirmation-redesign
- test-e2e-firefox
- test-e2e-chrome-flask
- test-e2e-firefox-flask
Expand Down Expand Up @@ -893,50 +876,6 @@ jobs:
- dist-test-mv2
- builds-test-mv2

prep-build-confirmation-redesign-test:
executor: node-linux-medium
steps:
- run: *shallow-git-clone
- run: corepack enable
- attach_workspace:
at: .
- run:
name: Build extension for testing
command: ENABLE_CONFIRMATION_REDESIGN="true" yarn build:test
- run:
name: Move test build to 'dist-test' to avoid conflict with production build
command: mv ./dist ./dist-test-confirmations
- run:
name: Move test zips to 'builds-test' to avoid conflict with production build
command: mv ./builds ./builds-test-confirmations
- persist_to_workspace:
root: .
paths:
- dist-test-confirmations
- builds-test-confirmations

prep-build-confirmation-redesign-test-mv2:
executor: node-linux-medium
steps:
- run: *shallow-git-clone
- run: corepack enable
- attach_workspace:
at: .
- run:
name: Build extension for testing
command: ENABLE_CONFIRMATION_REDESIGN="true" yarn build:test:mv2
- run:
name: Move test build to 'dist-test-confirmations-mv2' to avoid conflict with production build
command: mv ./dist ./dist-test-confirmations-mv2
- run:
name: Move test zips to 'builds-test-confirmations-mv2' to avoid conflict with production build
command: mv ./builds ./builds-test-confirmations-mv2
- persist_to_workspace:
root: .
paths:
- dist-test-confirmations-mv2
- builds-test-confirmations-mv2

prep-build-storybook:
executor: node-linux-medium
steps:
Expand Down Expand Up @@ -1138,36 +1077,6 @@ jobs:
- store_test_results:
path: test/test-results/e2e

test-e2e-chrome-confirmation-redesign:
executor: node-browsers-medium-plus
parallelism: 20
steps:
- run: *shallow-git-clone
- run: sudo corepack enable
- attach_workspace:
at: .
- run:
name: Move test build to dist
command: mv ./dist-test-confirmations ./dist
- run:
name: Move test zips to builds
command: mv ./builds-test-confirmations ./builds
- run:
name: test:e2e:chrome-confirmation-redesign
command: |
if .circleci/scripts/test-run-e2e.sh
then
timeout 20m yarn test:e2e:chrome:confirmation-redesign --retries 1
fi
no_output_timeout: 5m
environment:
ENABLE_CONFIRMATION_REDESIGN: 'true'
- store_artifacts:
path: test-artifacts
destination: test-artifacts
- store_test_results:
path: test/test-results/e2e

test-e2e-chrome-rpc:
executor: node-browsers-medium
parallelism: 1
Expand Down Expand Up @@ -1459,37 +1368,6 @@ jobs:
- store_test_results:
path: test/test-results/e2e

test-e2e-firefox-confirmation-redesign:
executor: node-browsers-medium-plus
parallelism: 20
steps:
- run: *shallow-git-clone
- run: sudo corepack enable
- attach_workspace:
at: .
- run:
name: Move test build to dist
command: mv ./dist-test-confirmations-mv2 ./dist
- run:
name: Move test zips to builds
command: mv ./builds-test-confirmations-mv2 ./builds
- run:
name: test:e2e:firefox-confirmation-redesign
command: |
export ENABLE_MV3=false
if .circleci/scripts/test-run-e2e.sh
then
timeout 20m yarn test:e2e:firefox --retries 1
fi
no_output_timeout: 5m
environment:
ENABLE_CONFIRMATION_REDESIGN: 'true'
- store_artifacts:
path: test-artifacts
destination: test-artifacts
- store_test_results:
path: test/test-results/e2e

benchmark:
executor: node-browsers-small
steps:
Expand Down
6 changes: 6 additions & 0 deletions app/_locales/en/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/scripts/controllers/preferences.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export default class PreferencesController {
featureNotificationsEnabled: false,
showTokenAutodetectModal: null,
showNftAutodetectModal: null, // null because we want to show the modal only the first time
isRedesignedConfirmationsDeveloperEnabled: false,
showConfirmationAdvancedDetails: false,
},
// ENS decentralized website resolution
Expand Down
9 changes: 9 additions & 0 deletions app/scripts/controllers/preferences.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,15 @@ describe('preferences controller', () => {
});
});

describe('isRedesignedConfirmationsFeatureEnabled', () => {
it('isRedesignedConfirmationsFeatureEnabled should default to false', () => {
expect(
preferencesController.store.getState().preferences
.isRedesignedConfirmationsDeveloperEnabled,
).toStrictEqual(false);
});
});

describe('setUseSafeChainsListValidation', function () {
it('should default to true', function () {
const state = preferencesController.store.getState();
Expand Down
1 change: 1 addition & 0 deletions app/scripts/lib/setupSentry.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ export const SENTRY_BACKGROUND_STATE = {
preferences: {
autoLockTimeLimit: true,
hideZeroBalanceTokens: true,
isRedesignedConfirmationsDeveloperEnabled: false,
showExtensionInFullSizeView: true,
showFiatInTestnets: true,
showTestNetworks: true,
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
"test:e2e:mmi:visual:update": "./test/e2e/playwright/mmi/scripts/run-visual-test.sh update",
"test:e2e:swap": "yarn playwright test --project=swap",
"test:e2e:pw:report": "yarn playwright show-report public/playwright/playwright-reports/html",
"test:e2e:chrome:confirmation-redesign": "ENABLE_CONFIRMATION_REDESIGN=true SELENIUM_BROWSER=chrome node test/e2e/run-all.js",
"test:e2e:chrome:rpc": "SELENIUM_BROWSER=chrome node test/e2e/run-all.js --rpc",
"test:e2e:chrome:multi-provider": "MULTIPROVIDER=true SELENIUM_BROWSER=chrome node test/e2e/run-all.js --multi-provider",
"test:e2e:firefox": "SELENIUM_BROWSER=firefox node test/e2e/run-all.js",
Expand Down
1 change: 1 addition & 0 deletions test/data/mock-state.json
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@
},
"preferences": {
"hideZeroBalanceTokens": false,
"isRedesignedConfirmationsDeveloperEnabled": false,
"showExtensionInFullSizeView": false,
"showFiatInTestnets": false,
"showTestNetworks": true,
Expand Down
1 change: 1 addition & 0 deletions test/e2e/default-fixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ function defaultFixture(inputChainId = CHAIN_IDS.LOCALHOST) {
useNativeCurrencyAsPrimaryCurrency: true,
petnamesEnabled: true,
showTokenAutodetectModal: false,
isRedesignedConfirmationsDeveloperEnabled: false,
showConfirmationAdvancedDetails: false,
},
selectedAddress: '0x5cfe73b6021e818b776b421b1c4db2474086a7e1',
Expand Down
1 change: 1 addition & 0 deletions test/e2e/fixture-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ function onboardingFixture() {
useNativeCurrencyAsPrimaryCurrency: true,
petnamesEnabled: true,
showTokenAutodetectModal: false,
isRedesignedConfirmationsDeveloperEnabled: false,
showConfirmationAdvancedDetails: false,
},
useExternalServices: true,
Expand Down
27 changes: 16 additions & 11 deletions test/e2e/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -1047,19 +1047,24 @@ async function switchToNotificationWindow(driver, numHandles = 3) {
* @returns {import('mockttp/dist/pluggable-admin').MockttpClientResponse[]}
*/
async function getEventPayloads(driver, mockedEndpoints, hasRequest = true) {
await driver.wait(
async () => {
let isPending = true;
try {
await driver.wait(
async () => {
let isPending = true;

for (const mockedEndpoint of mockedEndpoints) {
isPending = await mockedEndpoint.isPending();
}
for (const mockedEndpoint of mockedEndpoints) {
isPending = await mockedEndpoint.isPending();
}

return isPending === !hasRequest;
},
driver.timeout,
true,
);
return isPending === !hasRequest;
},
driver.timeout,
true,
);
} catch (error) {
console.error('Error waiting for mock server to be ready', error);
Promise.reject(error);
}
const mockedRequests = [];
for (const mockedEndpoint of mockedEndpoints) {
mockedRequests.push(...(await mockedEndpoint.getSeenRequests()));
Expand Down
6 changes: 1 addition & 5 deletions test/e2e/tests/confirmations/signatures/permit.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ import {
copyAddressAndPasteWalletAddress,
} from './signature-helpers';

describe('Confirmation Signature - Permit', function (this: Suite) {
if (!process.env.ENABLE_CONFIRMATION_REDESIGN) {
matthewwalsh0 marked this conversation as resolved.
Show resolved Hide resolved
return;
}

describe('Confirmation Signature - Permit @no-mmi', function (this: Suite) {
it('initiates and confirms and emits the correct events', async function () {
await withRedesignConfirmationFixtures(
this.test?.fullTitle(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ import {
assertAccountDetailsMetrics,
} from './signature-helpers';

describe('Confirmation Signature - Personal Sign', function (this: Suite) {
if (!process.env.ENABLE_CONFIRMATION_REDESIGN) {
return;
}

describe('Confirmation Signature - Personal Sign @no-mmi', function (this: Suite) {
it('initiates and confirms', async function () {
await withRedesignConfirmationFixtures(
this.test?.fullTitle(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ import {
assertAccountDetailsMetrics,
} from './signature-helpers';

describe('Confirmation Signature - Sign Typed Data V3', function (this: Suite) {
if (!process.env.ENABLE_CONFIRMATION_REDESIGN) {
return;
}

describe('Confirmation Signature - Sign Typed Data V3 @no-mmi', function (this: Suite) {
it('initiates and confirms', async function () {
await withRedesignConfirmationFixtures(
this.test?.fullTitle(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ import {
assertAccountDetailsMetrics,
} from './signature-helpers';

describe('Confirmation Signature - Sign Typed Data V4', function (this: Suite) {
if (!process.env.ENABLE_CONFIRMATION_REDESIGN) {
return;
}

describe('Confirmation Signature - Sign Typed Data V4 @no-mmi', function (this: Suite) {
it('initiates and confirms', async function () {
await withRedesignConfirmationFixtures(
this.test?.fullTitle(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@ import {
copyAddressAndPasteWalletAddress,
} from './signature-helpers';

describe('Confirmation Signature - Sign Typed Data', function (this: Suite) {
if (!process.env.ENABLE_CONFIRMATION_REDESIGN) {
return;
}

describe('Confirmation Signature - Sign Typed Data @no-mmi', function (this: Suite) {
it('initiates and confirms', async function () {
await withRedesignConfirmationFixtures(
this.test?.fullTitle(),
Expand Down
Loading