Skip to content

Commit

Permalink
fix: fix account list item for portfolio view (#28598)
Browse files Browse the repository at this point in the history
## **Description**

Fixes account list item wit Portfolio view feature flag.

[![Open in GitHub
Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/28598?quickstart=1)

## **Related issues**

Fixes: #28592

## **Manual testing steps**

Make sure you run the steps with AND without the PORTFOLIO_VIEW flag
1. Go to settings => Security and privacy => and disable "Show balance
and token price checker"
2. Open account picker make sure you see crypto values
3. Enable the setting again and you should see Fiat values

## **Screenshots/Recordings**

<!-- If applicable, add screenshots and/or recordings to visualize the
before and after of your change. -->

### **Before**

<!-- [screenshots/recordings] -->

### **After**

<!-- [screenshots/recordings] -->

## **Pre-merge author checklist**

- [ ] 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).
- [ ] I've completed the PR template to the best of my ability
- [ ] I’ve included tests if applicable
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format
if applicable
- [ ] 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.
  • Loading branch information
sahar-fehri authored Nov 21, 2024
1 parent f455a6e commit ba11881
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
37 changes: 37 additions & 0 deletions test/e2e/tests/settings/account-token-list.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,41 @@ describe('Settings', function () {
},
);
});

it('Should show crypto value when price checker setting is off', async function () {
await withFixtures(
{
fixtures: new FixtureBuilder()
.withConversionRateEnabled()
.withShowFiatTestnetEnabled()
.withPreferencesControllerShowNativeTokenAsMainBalanceDisabled()
.withConversionRateDisabled()
.build(),
ganacheOptions: defaultGanacheOptions,
title: this.test.fullTitle(),
testSpecificMock: mockInfuraResponses,
},
async ({ driver }) => {
await unlockWallet(driver);

await driver.clickElement('[data-testid="popover-close"]');
await driver.clickElement(
'[data-testid="account-overview__asset-tab"]',
);

const tokenListAmount = await driver.findElement(
'.eth-overview__primary-container',
);
await driver.delay(1000);
assert.equal(await tokenListAmount.getText(), '25\nETH');

await driver.clickElement('[data-testid="account-menu-icon"]');
const accountTokenValue = await driver.waitForSelector(
'.multichain-account-list-item .multichain-account-list-item__asset',
);

assert.equal(await accountTokenValue.getText(), '25ETH');
},
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ const AccountListItem = ({
let balanceToTranslate;
if (isEvmNetwork) {
balanceToTranslate =
shouldShowFiat || isTestnet || !process.env.PORTFOLIO_VIEW
!shouldShowFiat || isTestnet || !process.env.PORTFOLIO_VIEW
? account.balance
: totalFiatBalance;
} else {
Expand Down Expand Up @@ -345,7 +345,7 @@ const AccountListItem = ({
type={PRIMARY}
showFiat={showFiat}
isAggregatedFiatOverviewBalance={
!isTestnet && process.env.PORTFOLIO_VIEW
!isTestnet && process.env.PORTFOLIO_VIEW && shouldShowFiat
}
data-testid="first-currency-display"
privacyMode={privacyMode}
Expand Down

0 comments on commit ba11881

Please sign in to comment.