Skip to content

Commit bd2248d

Browse files
gambinishjonybur
andauthored
refactor: Cherry pick asset-list-control-bar updates (#28575)
## **Description** Cherry picks design updates for `AssetListControlBar` introduced from #28386 separately in it's own PR to help minimize diff in main feature branch. Also includes unit test and e2e updates impacted from these changes. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28575?quickstart=1) ## **Related issues** Fixes: ## **Manual testing steps** Run with feature flag and without feature flag: `yarn webpack --watch` `PORTFOLIO_VIEW=1 yarn webpack --watch` Validate that sort works, validate that import works, validate that refresh list works. ## **Screenshots/Recordings** Without feature flag: https://github.com/user-attachments/assets/445d4fd1-93d1-4cee-bd7b-bcc36518d7ca With feature flag (network filter not yet integrated) https://github.com/user-attachments/assets/d1aa8812-9787-49b5-9696-39e56d82ed56 ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. --------- Co-authored-by: Jonathan Bursztyn <[email protected]>
1 parent 1975c85 commit bd2248d

31 files changed

+373
-294
lines changed

.storybook/test-data.js

+27
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,32 @@ const state = {
487487
},
488488
},
489489
},
490+
allTokens: {
491+
'0x1': {
492+
'0x64a845a5b02460acf8a3d84503b0d68d028b4bb4': [
493+
{
494+
address: '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48',
495+
aggregators: [],
496+
decimals: 6,
497+
symbol: 'USDC',
498+
},
499+
{
500+
address: '0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e',
501+
aggregators: [],
502+
decimals: 18,
503+
symbol: 'YFI',
504+
},
505+
],
506+
},
507+
},
508+
tokenBalances: {
509+
'0x64a845a5b02460acf8a3d84503b0d68d028b4bb4': {
510+
'0x1': {
511+
'0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48': '0xbdbd',
512+
'0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e': '0x501b4176a64d6',
513+
},
514+
},
515+
},
490516
tokens: [
491517
{
492518
address: '0xaD6D458402F60fD3Bd25163575031ACDce07538A',
@@ -682,6 +708,7 @@ const state = {
682708
order: 'dsc',
683709
sortCallback: 'stringNumeric',
684710
},
711+
tokenNetworkFilter: {},
685712
},
686713
incomingTransactionsPreferences: {
687714
[CHAIN_IDS.MAINNET]: true,

app/scripts/constants/sentry-state.ts

+1
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ export const SENTRY_BACKGROUND_STATE = {
245245
showFiatInTestnets: true,
246246
showTestNetworks: true,
247247
smartTransactionsOptInStatus: true,
248+
tokenNetworkFilter: {},
248249
showNativeTokenAsMainBalance: true,
249250
petnamesEnabled: true,
250251
showConfirmationAdvancedDetails: true,

test/e2e/fixture-builder.js

+3
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ function onboardingFixture() {
8989
order: 'dsc',
9090
sortCallback: 'stringNumeric',
9191
},
92+
tokenNetworkFilter: {},
9293
shouldShowAggregatedBalancePopover: true,
9394
},
9495
useExternalServices: true,
@@ -126,6 +127,7 @@ function onboardingFixture() {
126127
},
127128
showTestNetworks: false,
128129
smartTransactionsOptInStatus: true,
130+
tokenNetworkFilter: {},
129131
},
130132
QueuedRequestController: {
131133
queuedRequestCount: 0,
@@ -664,6 +666,7 @@ class FixtureBuilder {
664666
return this.withPreferencesController({
665667
preferences: {
666668
smartTransactionsOptInStatus: true,
669+
tokenNetworkFilter: {},
667670
},
668671
});
669672
}

test/e2e/tests/confirmations/transactions/erc20-approve-redesign.spec.ts

+1
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ async function mocks(server: MockttpServer) {
118118
export async function importTST(driver: Driver) {
119119
await driver.switchToWindowWithTitle(WINDOW_TITLES.ExtensionInFullScreenView);
120120
await driver.clickElement('[data-testid="import-token-button"]');
121+
await driver.clickElement('[data-testid="importTokens"]');
121122

122123
await driver.waitForSelector({
123124
css: '.import-tokens-modal__button-tab',

test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-background-state.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,13 @@
237237
"redesignedConfirmationsEnabled": true,
238238
"redesignedTransactionsEnabled": "boolean",
239239
"tokenSortConfig": "object",
240-
"tokenNetworkFilter": "object",
240+
"tokenNetworkFilter": {
241+
"0x1": "boolean",
242+
"0xaa36a7": "boolean",
243+
"0xe705": "boolean",
244+
"0xe708": "boolean",
245+
"0x539": "boolean"
246+
},
241247
"shouldShowAggregatedBalancePopover": "boolean"
242248
},
243249
"ipfsGateway": "string",

test/e2e/tests/metrics/state-snapshots/errors-after-init-opt-in-ui-state.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,13 @@
3838
"redesignedConfirmationsEnabled": true,
3939
"redesignedTransactionsEnabled": "boolean",
4040
"tokenSortConfig": "object",
41-
"tokenNetworkFilter": "object",
41+
"tokenNetworkFilter": {
42+
"0x1": "boolean",
43+
"0xaa36a7": "boolean",
44+
"0xe705": "boolean",
45+
"0xe708": "boolean",
46+
"0x539": "boolean"
47+
},
4248
"shouldShowAggregatedBalancePopover": "boolean"
4349
},
4450
"firstTimeFlowType": "import",

test/e2e/tests/metrics/state-snapshots/errors-before-init-opt-in-background-state.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@
120120
"tokenSortConfig": "object",
121121
"showMultiRpcModal": "boolean",
122122
"shouldShowAggregatedBalancePopover": "boolean",
123-
"tokenNetworkFilter": "object"
123+
"tokenNetworkFilter": {}
124124
},
125125
"selectedAddress": "string",
126126
"theme": "light",

test/e2e/tests/metrics/state-snapshots/errors-before-init-opt-in-ui-state.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
"isRedesignedConfirmationsDeveloperEnabled": "boolean",
136136
"showConfirmationAdvancedDetails": false,
137137
"tokenSortConfig": "object",
138-
"tokenNetworkFilter": "object",
138+
"tokenNetworkFilter": {},
139139
"showMultiRpcModal": "boolean",
140140
"shouldShowAggregatedBalancePopover": "boolean"
141141
},

test/e2e/tests/privacy/basic-functionality.spec.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ describe('MetaMask onboarding @no-mmi', function () {
102102

103103
// Wait until network is fully switched and refresh tokens before asserting to mitigate flakiness
104104
await driver.assertElementNotPresent('.loading-overlay');
105-
await driver.clickElement('[data-testid="refresh-list-button"]');
105+
await driver.clickElement(`[data-testid="import-token-button"]`);
106+
await driver.clickElement('[data-testid="refreshList"]');
106107

107108
for (let i = 0; i < mockedEndpoints.length; i += 1) {
108109
const requests = await mockedEndpoints[i].getSeenRequests();
@@ -157,7 +158,8 @@ describe('MetaMask onboarding @no-mmi', function () {
157158

158159
// Wait until network is fully switched and refresh tokens before asserting to mitigate flakiness
159160
await driver.assertElementNotPresent('.loading-overlay');
160-
await driver.clickElement('[data-testid="refresh-list-button"]');
161+
await driver.clickElement(`[data-testid="import-token-button"]`);
162+
await driver.clickElement('[data-testid="refreshList"]');
161163
// intended delay to allow for network requests to complete
162164
await driver.delay(1000);
163165
for (let i = 0; i < mockedEndpoints.length; i += 1) {

test/e2e/tests/tokens/add-hide-token.spec.js

+1
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ describe('Add existing token using search', function () {
130130
await unlockWallet(driver);
131131

132132
await driver.clickElement(`[data-testid="import-token-button"]`);
133+
await driver.clickElement(`[data-testid="importTokens"]`);
133134
await driver.fill('input[placeholder="Search tokens"]', 'BAT');
134135
await driver.clickElement({
135136
text: 'BAT',

test/e2e/tests/tokens/custom-token-add-approve.spec.js

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ describe('Create token, approve token and approve token without gas', function (
3636
await clickNestedButton(driver, 'Tokens');
3737

3838
await driver.clickElement(`[data-testid="import-token-button"]`);
39+
await driver.clickElement(`[data-testid="importTokens"]`);
3940
await clickNestedButton(driver, 'Custom token');
4041
await driver.fill(
4142
'[data-testid="import-tokens-modal-custom-address"]',

test/e2e/tests/tokens/import-tokens.spec.js

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ describe('Import flow', function () {
6969
await driver.assertElementNotPresent('.loading-overlay');
7070

7171
await driver.clickElement('[data-testid="import-token-button"]');
72+
await driver.clickElement('[data-testid="importTokens"]');
7273

7374
await driver.fill('input[placeholder="Search tokens"]', 'cha');
7475

test/e2e/tests/tokens/token-details.spec.ts

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ describe('Token Details', function () {
2828

2929
const importToken = async (driver: Driver) => {
3030
await driver.clickElement(`[data-testid="import-token-button"]`);
31+
await driver.clickElement(`[data-testid="importTokens"]`);
3132
await clickNestedButton(driver, 'Custom token');
3233
await driver.fill(
3334
'[data-testid="import-tokens-modal-custom-address"]',

test/e2e/tests/tokens/token-list.spec.ts

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ describe('Token List', function () {
2828

2929
const importToken = async (driver: Driver) => {
3030
await driver.clickElement(`[data-testid="import-token-button"]`);
31+
await driver.clickElement(`[data-testid="importTokens"]`);
3132
await clickNestedButton(driver, 'Custom token');
3233
await driver.fill(
3334
'[data-testid="import-tokens-modal-custom-address"]',

test/e2e/tests/tokens/token-sort.spec.ts

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ describe('Token List', function () {
2626

2727
const importToken = async (driver: Driver) => {
2828
await driver.clickElement(`[data-testid="import-token-button"]`);
29+
await driver.clickElement(`[data-testid="importTokens"]`);
2930
await clickNestedButton(driver, 'Custom token');
3031
await driver.fill(
3132
'[data-testid="import-tokens-modal-custom-address"]',

0 commit comments

Comments
 (0)