From ad576c0490e5d62cbcf4ebe37b32869f6e1c4ec6 Mon Sep 17 00:00:00 2001 From: OGPoyraz Date: Thu, 1 Aug 2024 12:30:07 +0200 Subject: [PATCH 01/19] Fix fiat values in testnet visibility --- shared/constants/network.ts | 2 + .../confirm-subtitle/confirm-subtitle.js | 9 ++- .../confirm-subtitle/confirm-subtitle.test.js | 5 +- .../fee-details-component.js | 67 +++++++++++-------- .../gas-details-item/gas-details-item.js | 4 +- .../confirm-transaction-base.component.js | 31 +++++---- ui/selectors/selectors.js | 19 +++--- 7 files changed, 80 insertions(+), 57 deletions(-) diff --git a/shared/constants/network.ts b/shared/constants/network.ts index 6f9de90f80d2..32b1cb493504 100644 --- a/shared/constants/network.ts +++ b/shared/constants/network.ts @@ -144,6 +144,7 @@ export const CHAIN_IDS = { SEI: '0x531', BERACHAIN: '0x138d5', METACHAIN_ONE: '0x1b6e6', + ARBITRUM_SEPOLIA: '0x66eee', } as const; export const CHAINLIST_CHAIN_IDS_MAP = { @@ -1012,4 +1013,5 @@ export const TEST_NETWORK_IDS = [ CHAIN_IDS.SEPOLIA, CHAIN_IDS.LINEA_GOERLI, CHAIN_IDS.LINEA_SEPOLIA, + CHAIN_IDS.ARBITRUM_SEPOLIA, ]; diff --git a/ui/pages/confirmations/components/confirm-subtitle/confirm-subtitle.js b/ui/pages/confirmations/components/confirm-subtitle/confirm-subtitle.js index e1219d299288..5c18d5adc3c2 100644 --- a/ui/pages/confirmations/components/confirm-subtitle/confirm-subtitle.js +++ b/ui/pages/confirmations/components/confirm-subtitle/confirm-subtitle.js @@ -12,6 +12,7 @@ import { getShouldShowFiat } from '../../../../selectors'; import { useTransactionInfo } from '../../hooks/useTransactionInfo'; import { Text } from '../../../../components/component-library'; import UserPreferencedCurrencyDisplay from '../../../../components/app/user-preferenced-currency-display'; +import { useHideFiatForTestnet } from '../../../../hooks/useHideFiatForTestnet'; const ConfirmSubTitle = ({ txData, @@ -19,10 +20,14 @@ const ConfirmSubTitle = ({ subtitleComponent, assetStandard, }) => { - const shouldShowFiat = useSelector(getShouldShowFiat); const { isNftTransfer } = useTransactionInfo(txData); + const hideFiatForTestNet = useHideFiatForTestnet(); - if (!shouldShowFiat && !isNftTransfer && !isNFTAssetStandard(assetStandard)) { + if ( + hideFiatForTestNet && + !isNftTransfer && + !isNFTAssetStandard(assetStandard) + ) { return null; } diff --git a/ui/pages/confirmations/components/confirm-subtitle/confirm-subtitle.test.js b/ui/pages/confirmations/components/confirm-subtitle/confirm-subtitle.test.js index ac6095a28921..55ccb6315f5b 100644 --- a/ui/pages/confirmations/components/confirm-subtitle/confirm-subtitle.test.js +++ b/ui/pages/confirmations/components/confirm-subtitle/confirm-subtitle.test.js @@ -6,6 +6,7 @@ import { renderWithProvider } from '../../../../../test/lib/render-helpers'; import configureStore from '../../../../store/store'; import { getSelectedInternalAccountFromMockState } from '../../../../../test/jest/mocks'; import ConfirmSubTitle from './confirm-subtitle'; +// import { CHAIN_IDS } from '../../../../../shared/constants/network'; const mockSelectedInternalAccount = getSelectedInternalAccountFromMockState(mockState); @@ -47,7 +48,7 @@ describe('ConfirmSubTitle', () => { }); it('should not return null if it is NFT Transfer', async () => { - mockState.metamask.preferences.showFiatInTestnets = false; + mockState.metamask.preferences.showFiatInTestnets = true; mockState.metamask.allNftContracts = { [mockSelectedInternalAccount.address]: { [mockState.metamask.providerConfig.chainId]: [{ address: '0x9' }], @@ -66,7 +67,7 @@ describe('ConfirmSubTitle', () => { />, store, ); - expect(await findByText('0.00001')).toBeInTheDocument(); + expect(await findByText('$0.01')).toBeInTheDocument(); }); it('should not return null if assetStandard is ERC1155', async () => { diff --git a/ui/pages/confirmations/components/fee-details-component/fee-details-component.js b/ui/pages/confirmations/components/fee-details-component/fee-details-component.js index 7b310b6fb623..3ce64547b688 100644 --- a/ui/pages/confirmations/components/fee-details-component/fee-details-component.js +++ b/ui/pages/confirmations/components/fee-details-component/fee-details-component.js @@ -26,6 +26,7 @@ import UserPreferencedCurrencyDisplay from '../../../../components/app/user-pref import { PRIMARY, SECONDARY } from '../../../../helpers/constants/common'; import { addHexes } from '../../../../../shared/modules/conversion.utils'; import { useGasFeeContext } from '../../../../contexts/gasFee'; +import { useHideFiatForTestnet } from '../../../../hooks/useHideFiatForTestnet'; export default function FeeDetailsComponent({ txData, @@ -34,6 +35,7 @@ export default function FeeDetailsComponent({ }) { const layer1GasFee = txData?.layer1GasFee ?? null; const [expandFeeDetails, setExpandFeeDetails] = useState(false); + const hideFiatForTestNet = useHideFiatForTestnet(); const { useNativeCurrencyAsPrimaryCurrency } = useSelector(getPreferences); @@ -50,20 +52,22 @@ export default function FeeDetailsComponent({ return (
- + {!hideFiatForTestNet && ( + + )}
); }, @@ -75,20 +79,22 @@ export default function FeeDetailsComponent({ return ( - + {!hideFiatForTestNet && ( + + )} ); }, @@ -169,7 +175,9 @@ export default function FeeDetailsComponent({ } detailText={ - useCurrencyRateCheck && renderTotalDetailText(layer1GasFee) + useCurrencyRateCheck && + !hideFiatForTestNet && + renderTotalDetailText(layer1GasFee) } detailTotal={renderTotalDetailValue(layer1GasFee)} /> @@ -179,6 +187,7 @@ export default function FeeDetailsComponent({ detailTitle={t('total')} detailText={ useCurrencyRateCheck && + !hideFiatForTestNet && renderTotalDetailText(getTransactionFeeTotal) } detailTotal={renderTotalDetailValue(getTransactionFeeTotal)} diff --git a/ui/pages/confirmations/components/gas-details-item/gas-details-item.js b/ui/pages/confirmations/components/gas-details-item/gas-details-item.js index ef02aadbfa33..0fa54afbe3b6 100644 --- a/ui/pages/confirmations/components/gas-details-item/gas-details-item.js +++ b/ui/pages/confirmations/components/gas-details-item/gas-details-item.js @@ -38,12 +38,14 @@ import GasTiming from '../gas-timing/gas-timing.component'; import TransactionDetailItem from '../transaction-detail-item/transaction-detail-item.component'; import UserPreferencedCurrencyDisplay from '../../../../components/app/user-preferenced-currency-display'; import Tooltip from '../../../../components/ui/tooltip'; +import { useHideFiatForTestnet } from '../../../../hooks/useHideFiatForTestnet'; const GasDetailsItem = ({ 'data-testid': dataTestId, userAcknowledgedGasMissing = false, }) => { const t = useI18nContext(); + const hideFiatForTestNet = useHideFiatForTestnet(); const txData = useSelector(getTxData); const { layer1GasFee } = txData; @@ -137,7 +139,7 @@ const GasDetailsItem = ({ - {useCurrencyRateCheck && ( + {useCurrencyRateCheck && !hideFiatForTestNet && ( - + {!hideFiatConversion && ( + + )} ); } diff --git a/ui/selectors/selectors.js b/ui/selectors/selectors.js index c9cc9c47d95f..a8fee356df9a 100644 --- a/ui/selectors/selectors.js +++ b/ui/selectors/selectors.js @@ -46,6 +46,7 @@ import { MOONBEAM_DISPLAY_NAME, MOONRIVER_DISPLAY_NAME, BUILT_IN_NETWORKS, + TEST_NETWORK_IDS, } from '../../shared/constants/network'; import { WebHIDConnectedStatuses, @@ -950,17 +951,17 @@ export function getDisabledRpcMethodPreferences(state) { } export function getShouldShowFiat(state) { - const isMainNet = getIsMainnet(state); - const isLineaMainNet = getIsLineaMainnet(state); - const isCustomNetwork = getIsCustomNetwork(state); + const currentChainId = getCurrentChainId(state); + const isTestnet = TEST_NETWORK_IDS.includes(currentChainId); + const { showFiatInTestnets } = getPreferences(state); + + if (isTestnet && !showFiatInTestnets) { + return false; + } + const conversionRate = getConversionRate(state); const useCurrencyRateCheck = getUseCurrencyRateCheck(state); - const { showFiatInTestnets } = getPreferences(state); - return Boolean( - (isMainNet || isLineaMainNet || isCustomNetwork || showFiatInTestnets) && - useCurrencyRateCheck && - conversionRate, - ); + return Boolean(useCurrencyRateCheck && conversionRate); } export function getShouldHideZeroBalanceTokens(state) { From f75cce6b608e81232fcb9b3bb124a8ee011ada34 Mon Sep 17 00:00:00 2001 From: OGPoyraz Date: Thu, 1 Aug 2024 12:39:21 +0200 Subject: [PATCH 02/19] Fix lint --- .../components/confirm-subtitle/confirm-subtitle.js | 2 -- .../confirm-transaction-base.component.js | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/ui/pages/confirmations/components/confirm-subtitle/confirm-subtitle.js b/ui/pages/confirmations/components/confirm-subtitle/confirm-subtitle.js index 5c18d5adc3c2..58fd61bd6be4 100644 --- a/ui/pages/confirmations/components/confirm-subtitle/confirm-subtitle.js +++ b/ui/pages/confirmations/components/confirm-subtitle/confirm-subtitle.js @@ -1,6 +1,5 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { useSelector } from 'react-redux'; import { SECONDARY } from '../../../../helpers/constants/common'; import { @@ -8,7 +7,6 @@ import { TextVariant, } from '../../../../helpers/constants/design-system'; import { isNFTAssetStandard } from '../../../../helpers/utils/transactions.util'; -import { getShouldShowFiat } from '../../../../selectors'; import { useTransactionInfo } from '../../hooks/useTransactionInfo'; import { Text } from '../../../../components/component-library'; import UserPreferencedCurrencyDisplay from '../../../../components/app/user-preferenced-currency-display'; diff --git a/ui/pages/confirmations/confirm-transaction-base/confirm-transaction-base.component.js b/ui/pages/confirmations/confirm-transaction-base/confirm-transaction-base.component.js index fb34d5c5804d..5fab1861167b 100644 --- a/ui/pages/confirmations/confirm-transaction-base/confirm-transaction-base.component.js +++ b/ui/pages/confirmations/confirm-transaction-base/confirm-transaction-base.component.js @@ -179,6 +179,7 @@ export default class ConfirmTransactionBase extends Component { isSmartTransactionsEnabled: PropTypes.bool, hasPriorityApprovalRequest: PropTypes.bool, chainId: PropTypes.string, + hideFiatConversion: PropTypes.bool, }; state = { From 3c7484590e1118c371a4b42260d721746dae32b3 Mon Sep 17 00:00:00 2001 From: OGPoyraz Date: Tue, 3 Sep 2024 10:56:33 +0200 Subject: [PATCH 03/19] Fix suggestions --- ui/hooks/useHideFiatForTestnet.test.ts | 69 ------------------- ui/hooks/useHideFiatForTestnet.ts | 17 ----- .../confirm-subtitle/confirm-subtitle.js | 11 ++- .../confirm-subtitle/confirm-subtitle.test.js | 5 +- .../fee-details-component.js | 19 ++--- .../gas-details-item/gas-details-item.js | 7 +- .../simulation-details/fiat-display.tsx | 7 +- .../confirm-transaction-base.component.js | 33 ++++----- 8 files changed, 35 insertions(+), 133 deletions(-) delete mode 100644 ui/hooks/useHideFiatForTestnet.test.ts delete mode 100644 ui/hooks/useHideFiatForTestnet.ts diff --git a/ui/hooks/useHideFiatForTestnet.test.ts b/ui/hooks/useHideFiatForTestnet.test.ts deleted file mode 100644 index cdc4905c74c4..000000000000 --- a/ui/hooks/useHideFiatForTestnet.test.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { renderHook } from '@testing-library/react-hooks'; -import { getShowFiatInTestnets, getCurrentChainId } from '../selectors'; -import { TEST_NETWORK_IDS, CHAIN_IDS } from '../../shared/constants/network'; -import { useHideFiatForTestnet } from './useHideFiatForTestnet'; - -jest.mock('react-redux', () => ({ - useSelector: jest.fn().mockImplementation((selector) => selector()), -})); - -jest.mock('../selectors', () => ({ - getShowFiatInTestnets: jest.fn(), - getCurrentChainId: jest.fn(), -})); - -describe('useHideFiatForTestnet', () => { - const mockGetShowFiatInTestnets = jest.mocked(getShowFiatInTestnets); - const mockGetCurrentChainId = jest.mocked(getCurrentChainId); - - beforeEach(() => { - jest.clearAllMocks(); - }); - - it('utilizes the specified chain id', () => { - mockGetShowFiatInTestnets.mockReturnValue(false); - mockGetCurrentChainId.mockReturnValue(TEST_NETWORK_IDS[0]); - - const { result } = renderHook(() => - useHideFiatForTestnet(CHAIN_IDS.MAINNET), - ); - - expect(result.current).toBe(false); - }); - - it('returns true if current network is a testnet and showFiatInTestnets is false', () => { - mockGetShowFiatInTestnets.mockReturnValue(false); - mockGetCurrentChainId.mockReturnValue(TEST_NETWORK_IDS[0]); - - const { result } = renderHook(() => useHideFiatForTestnet()); - - expect(result.current).toBe(true); - }); - - it('returns false if current network is a testnet and showFiatInTestnets is true', () => { - mockGetShowFiatInTestnets.mockReturnValue(true); - mockGetCurrentChainId.mockReturnValue(TEST_NETWORK_IDS[0]); - - const { result } = renderHook(() => useHideFiatForTestnet()); - - expect(result.current).toBe(false); - }); - - it('returns false if current network is not a testnet', () => { - mockGetShowFiatInTestnets.mockReturnValue(false); - mockGetCurrentChainId.mockReturnValue('1'); - - const { result } = renderHook(() => useHideFiatForTestnet()); - - expect(result.current).toBe(false); - }); - - it('returns false if current network is not a testnet but showFiatInTestnets is true', () => { - mockGetShowFiatInTestnets.mockReturnValue(true); - mockGetCurrentChainId.mockReturnValue('1'); - - const { result } = renderHook(() => useHideFiatForTestnet()); - - expect(result.current).toBe(false); - }); -}); diff --git a/ui/hooks/useHideFiatForTestnet.ts b/ui/hooks/useHideFiatForTestnet.ts deleted file mode 100644 index b01b20513550..000000000000 --- a/ui/hooks/useHideFiatForTestnet.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { useSelector } from 'react-redux'; -import type { Hex } from '@metamask/utils'; -import { getShowFiatInTestnets, getCurrentChainId } from '../selectors'; -import { TEST_NETWORK_IDS } from '../../shared/constants/network'; - -/** - * Returns true if the fiat value should be hidden for testnet networks. - * - * @param providedChainId - * @returns boolean - */ -export const useHideFiatForTestnet = (providedChainId?: Hex): boolean => { - const showFiatInTestnets = useSelector(getShowFiatInTestnets); - const currentChainId = useSelector(getCurrentChainId); - const chainId = providedChainId ?? currentChainId; - return TEST_NETWORK_IDS.includes(chainId) && !showFiatInTestnets; -}; diff --git a/ui/pages/confirmations/components/confirm-subtitle/confirm-subtitle.js b/ui/pages/confirmations/components/confirm-subtitle/confirm-subtitle.js index 58fd61bd6be4..e1219d299288 100644 --- a/ui/pages/confirmations/components/confirm-subtitle/confirm-subtitle.js +++ b/ui/pages/confirmations/components/confirm-subtitle/confirm-subtitle.js @@ -1,5 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; +import { useSelector } from 'react-redux'; import { SECONDARY } from '../../../../helpers/constants/common'; import { @@ -7,10 +8,10 @@ import { TextVariant, } from '../../../../helpers/constants/design-system'; import { isNFTAssetStandard } from '../../../../helpers/utils/transactions.util'; +import { getShouldShowFiat } from '../../../../selectors'; import { useTransactionInfo } from '../../hooks/useTransactionInfo'; import { Text } from '../../../../components/component-library'; import UserPreferencedCurrencyDisplay from '../../../../components/app/user-preferenced-currency-display'; -import { useHideFiatForTestnet } from '../../../../hooks/useHideFiatForTestnet'; const ConfirmSubTitle = ({ txData, @@ -18,14 +19,10 @@ const ConfirmSubTitle = ({ subtitleComponent, assetStandard, }) => { + const shouldShowFiat = useSelector(getShouldShowFiat); const { isNftTransfer } = useTransactionInfo(txData); - const hideFiatForTestNet = useHideFiatForTestnet(); - if ( - hideFiatForTestNet && - !isNftTransfer && - !isNFTAssetStandard(assetStandard) - ) { + if (!shouldShowFiat && !isNftTransfer && !isNFTAssetStandard(assetStandard)) { return null; } diff --git a/ui/pages/confirmations/components/confirm-subtitle/confirm-subtitle.test.js b/ui/pages/confirmations/components/confirm-subtitle/confirm-subtitle.test.js index d776c0b5d334..3c45b42cc717 100644 --- a/ui/pages/confirmations/components/confirm-subtitle/confirm-subtitle.test.js +++ b/ui/pages/confirmations/components/confirm-subtitle/confirm-subtitle.test.js @@ -6,7 +6,6 @@ import { renderWithProvider } from '../../../../../test/lib/render-helpers'; import configureStore from '../../../../store/store'; import { getSelectedInternalAccountFromMockState } from '../../../../../test/jest/mocks'; import ConfirmSubTitle from './confirm-subtitle'; -// import { CHAIN_IDS } from '../../../../../shared/constants/network'; const mockSelectedInternalAccount = getSelectedInternalAccountFromMockState(mockState); @@ -48,7 +47,7 @@ describe('ConfirmSubTitle', () => { }); it('should not return null if it is NFT Transfer', async () => { - mockState.metamask.preferences.showFiatInTestnets = true; + mockState.metamask.preferences.showFiatInTestnets = false; mockState.metamask.allNftContracts = { [mockSelectedInternalAccount.address]: { [mockState.metamask.networkConfigurations[ @@ -69,7 +68,7 @@ describe('ConfirmSubTitle', () => { />, store, ); - expect(await findByText('$0.01')).toBeInTheDocument(); + expect(await findByText('0.00001')).toBeInTheDocument(); }); it('should not return null if assetStandard is ERC1155', async () => { diff --git a/ui/pages/confirmations/components/fee-details-component/fee-details-component.js b/ui/pages/confirmations/components/fee-details-component/fee-details-component.js index 3ce64547b688..19bcc25e445f 100644 --- a/ui/pages/confirmations/components/fee-details-component/fee-details-component.js +++ b/ui/pages/confirmations/components/fee-details-component/fee-details-component.js @@ -19,14 +19,13 @@ import { Text, } from '../../../../components/component-library'; import TransactionDetailItem from '../transaction-detail-item/transaction-detail-item.component'; -import { getPreferences } from '../../../../selectors'; +import { getPreferences, getShouldShowFiat } from '../../../../selectors'; import { useI18nContext } from '../../../../hooks/useI18nContext'; import LoadingHeartBeat from '../../../../components/ui/loading-heartbeat'; import UserPreferencedCurrencyDisplay from '../../../../components/app/user-preferenced-currency-display/user-preferenced-currency-display.component'; import { PRIMARY, SECONDARY } from '../../../../helpers/constants/common'; import { addHexes } from '../../../../../shared/modules/conversion.utils'; import { useGasFeeContext } from '../../../../contexts/gasFee'; -import { useHideFiatForTestnet } from '../../../../hooks/useHideFiatForTestnet'; export default function FeeDetailsComponent({ txData, @@ -35,7 +34,7 @@ export default function FeeDetailsComponent({ }) { const layer1GasFee = txData?.layer1GasFee ?? null; const [expandFeeDetails, setExpandFeeDetails] = useState(false); - const hideFiatForTestNet = useHideFiatForTestnet(); + const shouldShowFiat = useSelector(getShouldShowFiat); const { useNativeCurrencyAsPrimaryCurrency } = useSelector(getPreferences); @@ -52,7 +51,7 @@ export default function FeeDetailsComponent({ return (
- {!hideFiatForTestNet && ( + {shouldShowFiat && ( - {!hideFiatForTestNet && ( + {shouldShowFiat && ( } - detailText={ - useCurrencyRateCheck && - !hideFiatForTestNet && - renderTotalDetailText(layer1GasFee) - } + detailText={shouldShowFiat && renderTotalDetailText(layer1GasFee)} detailTotal={renderTotalDetailValue(layer1GasFee)} /> )} @@ -186,9 +181,7 @@ export default function FeeDetailsComponent({ diff --git a/ui/pages/confirmations/components/gas-details-item/gas-details-item.js b/ui/pages/confirmations/components/gas-details-item/gas-details-item.js index 0fa54afbe3b6..d1b922c7a1ed 100644 --- a/ui/pages/confirmations/components/gas-details-item/gas-details-item.js +++ b/ui/pages/confirmations/components/gas-details-item/gas-details-item.js @@ -18,6 +18,7 @@ import { PRIMARY, SECONDARY } from '../../../../helpers/constants/common'; import { PriorityLevels } from '../../../../../shared/constants/gas'; import { getPreferences, + getShouldShowFiat, getTxData, getUseCurrencyRateCheck, transactionFeeSelector, @@ -38,20 +39,20 @@ import GasTiming from '../gas-timing/gas-timing.component'; import TransactionDetailItem from '../transaction-detail-item/transaction-detail-item.component'; import UserPreferencedCurrencyDisplay from '../../../../components/app/user-preferenced-currency-display'; import Tooltip from '../../../../components/ui/tooltip'; -import { useHideFiatForTestnet } from '../../../../hooks/useHideFiatForTestnet'; const GasDetailsItem = ({ 'data-testid': dataTestId, userAcknowledgedGasMissing = false, }) => { const t = useI18nContext(); - const hideFiatForTestNet = useHideFiatForTestnet(); + const shouldShowFiat = useSelector(getShouldShowFiat); const txData = useSelector(getTxData); const { layer1GasFee } = txData; const draftTransaction = useSelector(getCurrentDraftTransaction); const transactionData = useDraftTransactionWithTxParams(); + const { hexMinimumTransactionFee: draftHexMinimumTransactionFee, hexMaximumTransactionFee: draftHexMaximumTransactionFee, @@ -139,7 +140,7 @@ const GasDetailsItem = ({ - {useCurrencyRateCheck && !hideFiatForTestNet && ( + {useCurrencyRateCheck && shouldShowFiat && ( = ({ fiatAmount, shorten = false }) => { - const hideFiatForTestnet = useHideFiatForTestnet(); + const shouldShowFiat = useSelector(getShouldShowFiat); const fiatFormatter = useFiatFormatter(); - if (hideFiatForTestnet) { + if (!shouldShowFiat) { return null; } diff --git a/ui/pages/confirmations/confirm-transaction-base/confirm-transaction-base.component.js b/ui/pages/confirmations/confirm-transaction-base/confirm-transaction-base.component.js index 6e9379905889..752444823996 100644 --- a/ui/pages/confirmations/confirm-transaction-base/confirm-transaction-base.component.js +++ b/ui/pages/confirmations/confirm-transaction-base/confirm-transaction-base.component.js @@ -184,7 +184,6 @@ export default class ConfirmTransactionBase extends Component { isSmartTransactionsEnabled: PropTypes.bool, hasPriorityApprovalRequest: PropTypes.bool, chainId: PropTypes.string, - hideFiatConversion: PropTypes.bool, }; state = { @@ -408,7 +407,6 @@ export default class ConfirmTransactionBase extends Component { tokenSymbol, isUsingPaymaster, isSigningOrSubmitting, - hideFiatConversion, } = this.props; const { t } = this.context; @@ -476,22 +474,21 @@ export default class ConfirmTransactionBase extends Component { return (
- {!hideFiatConversion && ( - - )} + {/** OGP */} +
); } From 3042a8fa2383c7db93f90454bcb58ccb2a3e7a3a Mon Sep 17 00:00:00 2001 From: OGPoyraz Date: Tue, 3 Sep 2024 10:59:11 +0200 Subject: [PATCH 04/19] remove unnecessary useCurrencyRateCheck --- .../components/gas-details-item/gas-details-item.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ui/pages/confirmations/components/gas-details-item/gas-details-item.js b/ui/pages/confirmations/components/gas-details-item/gas-details-item.js index d1b922c7a1ed..90ccbb09ce23 100644 --- a/ui/pages/confirmations/components/gas-details-item/gas-details-item.js +++ b/ui/pages/confirmations/components/gas-details-item/gas-details-item.js @@ -20,7 +20,6 @@ import { getPreferences, getShouldShowFiat, getTxData, - getUseCurrencyRateCheck, transactionFeeSelector, } from '../../../../selectors'; import { getCurrentDraftTransaction } from '../../../../ducks/send'; @@ -70,8 +69,6 @@ const GasDetailsItem = ({ } = useGasFeeContext(); const { useNativeCurrencyAsPrimaryCurrency } = useSelector(getPreferences); - - const useCurrencyRateCheck = useSelector(getUseCurrencyRateCheck); const getTransactionFeeTotal = useMemo(() => { if (layer1GasFee) { return sumHexes(hexMinimumTransactionFee, layer1GasFee); @@ -140,7 +137,7 @@ const GasDetailsItem = ({ - {useCurrencyRateCheck && shouldShowFiat && ( + {shouldShowFiat && ( Date: Tue, 3 Sep 2024 11:00:09 +0200 Subject: [PATCH 05/19] Remove comment --- .../confirm-transaction-base.component.js | 1 - 1 file changed, 1 deletion(-) diff --git a/ui/pages/confirmations/confirm-transaction-base/confirm-transaction-base.component.js b/ui/pages/confirmations/confirm-transaction-base/confirm-transaction-base.component.js index 752444823996..8caf1043cf4a 100644 --- a/ui/pages/confirmations/confirm-transaction-base/confirm-transaction-base.component.js +++ b/ui/pages/confirmations/confirm-transaction-base/confirm-transaction-base.component.js @@ -474,7 +474,6 @@ export default class ConfirmTransactionBase extends Component { return (
- {/** OGP */} Date: Tue, 3 Sep 2024 12:23:52 +0200 Subject: [PATCH 06/19] Add localhost to testnets --- shared/constants/network.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/shared/constants/network.ts b/shared/constants/network.ts index 641e310517cb..349418ed0e27 100644 --- a/shared/constants/network.ts +++ b/shared/constants/network.ts @@ -1036,4 +1036,5 @@ export const TEST_NETWORK_IDS = [ CHAIN_IDS.LINEA_GOERLI, CHAIN_IDS.LINEA_SEPOLIA, CHAIN_IDS.ARBITRUM_SEPOLIA, + CHAIN_IDS.LOCALHOST, ]; From 775f8222465552e803ad94f60b4f5aaa75c4415a Mon Sep 17 00:00:00 2001 From: OGPoyraz Date: Tue, 3 Sep 2024 12:36:38 +0200 Subject: [PATCH 07/19] revert --- shared/constants/network.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/shared/constants/network.ts b/shared/constants/network.ts index 349418ed0e27..641e310517cb 100644 --- a/shared/constants/network.ts +++ b/shared/constants/network.ts @@ -1036,5 +1036,4 @@ export const TEST_NETWORK_IDS = [ CHAIN_IDS.LINEA_GOERLI, CHAIN_IDS.LINEA_SEPOLIA, CHAIN_IDS.ARBITRUM_SEPOLIA, - CHAIN_IDS.LOCALHOST, ]; From 81854ef71800f97ba22632a78e12efc28c593498 Mon Sep 17 00:00:00 2001 From: OGPoyraz Date: Tue, 3 Sep 2024 13:20:14 +0200 Subject: [PATCH 08/19] Fix e2e --- ui/selectors/selectors.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ui/selectors/selectors.js b/ui/selectors/selectors.js index 61bda6c1ba70..070cb6653e82 100644 --- a/ui/selectors/selectors.js +++ b/ui/selectors/selectors.js @@ -973,7 +973,16 @@ export function getShouldShowFiat(state) { const conversionRate = getConversionRate(state); const useCurrencyRateCheck = getUseCurrencyRateCheck(state); - return Boolean(useCurrencyRateCheck && conversionRate); + + const isMainNet = getIsMainnet(state); + const isLineaMainNet = getIsLineaMainnet(state); + const isCustomNetwork = getIsCustomNetwork(state); + + return Boolean( + (isMainNet || isLineaMainNet || isCustomNetwork) && + useCurrencyRateCheck && + conversionRate, + ); } export function getShouldHideZeroBalanceTokens(state) { From bc2cce18f7dcb2125d604efe0082450391de068a Mon Sep 17 00:00:00 2001 From: OGPoyraz Date: Tue, 3 Sep 2024 13:45:28 +0200 Subject: [PATCH 09/19] Fix unit tests --- ui/selectors/selectors.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ui/selectors/selectors.js b/ui/selectors/selectors.js index 070cb6653e82..2df44ba16b49 100644 --- a/ui/selectors/selectors.js +++ b/ui/selectors/selectors.js @@ -966,14 +966,15 @@ export function getShouldShowFiat(state) { const currentChainId = getCurrentChainId(state); const isTestnet = TEST_NETWORK_IDS.includes(currentChainId); const { showFiatInTestnets } = getPreferences(state); - - if (isTestnet && !showFiatInTestnets) { - return false; - } - const conversionRate = getConversionRate(state); const useCurrencyRateCheck = getUseCurrencyRateCheck(state); + if (isTestnet) { + return Boolean( + showFiatInTestnets && useCurrencyRateCheck && conversionRate, + ); + } + const isMainNet = getIsMainnet(state); const isLineaMainNet = getIsLineaMainnet(state); const isCustomNetwork = getIsCustomNetwork(state); From 7eb149bf008442029206e5c078a99c1e4934cf5f Mon Sep 17 00:00:00 2001 From: OGPoyraz Date: Tue, 3 Sep 2024 14:07:00 +0200 Subject: [PATCH 10/19] Fix tests --- .../components/simulation-details/fiat-display.test.tsx | 7 +++++++ .../components/simulation-details/fiat-display.tsx | 4 ++-- .../confirm-approve-content.component.test.js | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ui/pages/confirmations/components/simulation-details/fiat-display.test.tsx b/ui/pages/confirmations/components/simulation-details/fiat-display.test.tsx index 4110c2e9162c..922a2e414916 100644 --- a/ui/pages/confirmations/components/simulation-details/fiat-display.test.tsx +++ b/ui/pages/confirmations/components/simulation-details/fiat-display.test.tsx @@ -21,6 +21,12 @@ const mockStateWithShowingFiatOnTestnets = merge({}, mockStateWithTestnet, { preferences: { showFiatInTestnets: true, }, + useCurrencyRateCheck: true, + currencyRates: { + SepoliaETH: { + conversionRate: 1, + }, + }, }, }); const mockStoreWithShowingFiatOnTestnets = configureStore()( @@ -32,6 +38,7 @@ const mockStateWithHidingFiatOnTestnets = merge({}, mockStateWithTestnet, { preferences: { showFiatInTestnets: false, }, + useCurrencyRateCheck: false, }, }); const mockStoreWithHidingFiatOnTestnets = configureStore()( diff --git a/ui/pages/confirmations/components/simulation-details/fiat-display.tsx b/ui/pages/confirmations/components/simulation-details/fiat-display.tsx index 0b91340c040b..ac3fcebcc159 100644 --- a/ui/pages/confirmations/components/simulation-details/fiat-display.tsx +++ b/ui/pages/confirmations/components/simulation-details/fiat-display.tsx @@ -77,12 +77,12 @@ export const IndividualFiatDisplay: React.FC<{ export const TotalFiatDisplay: React.FC<{ fiatAmounts: FiatAmount[]; }> = ({ fiatAmounts }) => { - const hideFiatForTestnet = useHideFiatForTestnet(); + const shouldShowFiat = useSelector(getShouldShowFiat); const t = useI18nContext(); const fiatFormatter = useFiatFormatter(); const totalFiat = calculateTotalFiat(fiatAmounts); - if (hideFiatForTestnet) { + if (!shouldShowFiat) { return null; } diff --git a/ui/pages/confirmations/confirm-approve/confirm-approve-content/confirm-approve-content.component.test.js b/ui/pages/confirmations/confirm-approve/confirm-approve-content/confirm-approve-content.component.test.js index 916da9c1c58b..2abec9ef4c13 100644 --- a/ui/pages/confirmations/confirm-approve/confirm-approve-content/confirm-approve-content.component.test.js +++ b/ui/pages/confirmations/confirm-approve/confirm-approve-content/confirm-approve-content.component.test.js @@ -14,6 +14,7 @@ const renderComponent = (props) => { preferences: { useNativeCurrencyAsPrimaryCurrency: true, }, + currencyRates: {}, }, }); return renderWithProvider(, store); From bf2e3d72635d9882dadaac6e31820571ab570bc6 Mon Sep 17 00:00:00 2001 From: OGPoyraz Date: Tue, 3 Sep 2024 14:15:40 +0200 Subject: [PATCH 11/19] Update snapshot --- .../__snapshots__/confirm-send-ether.test.js.snap | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/ui/pages/confirmations/confirm-send-ether/__snapshots__/confirm-send-ether.test.js.snap b/ui/pages/confirmations/confirm-send-ether/__snapshots__/confirm-send-ether.test.js.snap index 42f9a93c1d4f..1da44ad87146 100644 --- a/ui/pages/confirmations/confirm-send-ether/__snapshots__/confirm-send-ether.test.js.snap +++ b/ui/pages/confirmations/confirm-send-ether/__snapshots__/confirm-send-ether.test.js.snap @@ -455,16 +455,6 @@ exports[`ConfirmSendEther should render correct information for for confirm send class="mm-box mm-text mm-text--inherit mm-box--color-primary-default" /> -
- - 0.000021 - -
Date: Tue, 3 Sep 2024 15:07:49 +0200 Subject: [PATCH 12/19] Fix e2e tests --- .../tests/settings/account-token-list.spec.js | 51 ------------------- .../confirm-gas-display.test.js.snap | 10 ---- 2 files changed, 61 deletions(-) diff --git a/test/e2e/tests/settings/account-token-list.spec.js b/test/e2e/tests/settings/account-token-list.spec.js index 921cacae9e3a..0d5dabf21bfb 100644 --- a/test/e2e/tests/settings/account-token-list.spec.js +++ b/test/e2e/tests/settings/account-token-list.spec.js @@ -37,55 +37,4 @@ describe('Settings', function () { }, ); }); - - it('Should match the value of token list item and account list item for fiat conversion', async function () { - await withFixtures( - { - fixtures: new FixtureBuilder().build(), - ganacheOptions: defaultGanacheOptions, - title: this.test.fullTitle(), - }, - async ({ driver, ganacheServer }) => { - await logInWithBalanceValidation(driver, ganacheServer); - - await driver.clickElement( - '[data-testid="account-options-menu-button"]', - ); - await driver.clickElement({ text: 'Settings', tag: 'div' }); - await driver.clickElement({ - text: 'General', - tag: 'div', - }); - await driver.clickElement({ text: 'Fiat', tag: 'label' }); - // We now need to enable "Show fiat on testnet" if we are using testnets (and since our custom - // network during test is using a testnet chain ID, it will be considered as a test network) - await driver.clickElement({ - text: 'Advanced', - tag: 'div', - }); - await driver.clickElement('.show-fiat-on-testnets-toggle'); - // Looks like when enabling the "Show fiat on testnet" it takes some time to re-update the - // overview screen, so just wait a bit here: - await driver.delay(1000); - - await driver.clickElement( - '.settings-page__header__title-container__close-button', - ); - await driver.clickElement( - '[data-testid="account-overview__asset-tab"]', - ); - - const tokenListAmount = await driver.findElement( - '.eth-overview__primary-container', - ); - assert.equal(await tokenListAmount.getText(), '$42,500.00\nUSD'); - 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(), '$42,500.00USD'); - }, - ); - }); }); diff --git a/ui/pages/confirmations/components/confirm-gas-display/__snapshots__/confirm-gas-display.test.js.snap b/ui/pages/confirmations/components/confirm-gas-display/__snapshots__/confirm-gas-display.test.js.snap index c6d58247c683..b13f1f6d31e9 100644 --- a/ui/pages/confirmations/components/confirm-gas-display/__snapshots__/confirm-gas-display.test.js.snap +++ b/ui/pages/confirmations/components/confirm-gas-display/__snapshots__/confirm-gas-display.test.js.snap @@ -37,16 +37,6 @@ exports[`ConfirmGasDisplay should match snapshot 1`] = ` class="mm-box mm-text mm-text--inherit mm-box--color-primary-default" /> -
- - 0.001197 - -
Date: Tue, 3 Sep 2024 15:28:04 +0200 Subject: [PATCH 13/19] Remove localization e2e test --- test/e2e/tests/settings/localization.spec.js | 41 -------------------- 1 file changed, 41 deletions(-) delete mode 100644 test/e2e/tests/settings/localization.spec.js diff --git a/test/e2e/tests/settings/localization.spec.js b/test/e2e/tests/settings/localization.spec.js deleted file mode 100644 index 707cc120e578..000000000000 --- a/test/e2e/tests/settings/localization.spec.js +++ /dev/null @@ -1,41 +0,0 @@ -const { strict: assert } = require('assert'); -const { - defaultGanacheOptions, - withFixtures, - unlockWallet, -} = require('../../helpers'); -const FixtureBuilder = require('../../fixture-builder'); - -describe('Localization', function () { - it('can correctly display Philippine peso symbol and code', async function () { - await withFixtures( - { - fixtures: new FixtureBuilder() - .withCurrencyController({ - currentCurrency: 'php', - }) - .withPreferencesController({ - preferences: { - showFiatInTestnets: true, - }, - }) - .build(), - ganacheOptions: defaultGanacheOptions, - title: this.test.fullTitle(), - }, - async ({ driver }) => { - await unlockWallet(driver); - - const secondaryBalance = await driver.findElement( - '[data-testid="eth-overview__secondary-currency"]', - ); - const secondaryBalanceText = await secondaryBalance.getText(); - const [fiatAmount, fiatUnit] = secondaryBalanceText - .trim() - .split(/\s+/u); - assert.ok(fiatAmount.startsWith('₱')); - assert.equal(fiatUnit, 'PHP'); - }, - ); - }); -}); From e2713a5cb69479329de7c008ade69352409f348a Mon Sep 17 00:00:00 2001 From: OGPoyraz Date: Wed, 4 Sep 2024 08:56:05 +0200 Subject: [PATCH 14/19] Fix e2e tests --- test/e2e/fixture-builder.js | 12 +++++ .../tests/settings/account-token-list.spec.js | 44 ++++++++++++++++++- test/e2e/tests/settings/localization.spec.js | 41 +++++++++++++++++ ui/selectors/selectors.js | 15 ++----- 4 files changed, 99 insertions(+), 13 deletions(-) create mode 100644 test/e2e/tests/settings/localization.spec.js diff --git a/test/e2e/fixture-builder.js b/test/e2e/fixture-builder.js index ddc819b2bcf3..2ad095a09492 100644 --- a/test/e2e/fixture-builder.js +++ b/test/e2e/fixture-builder.js @@ -169,6 +169,18 @@ class FixtureBuilder { return this; } + withConversionRateDisabled() { + return this.withPreferencesController({ + useCurrencyRateCheck: false, + }); + } + + withConversionRateEnabled() { + return this.withPreferencesController({ + useCurrencyRateCheck: true, + }); + } + withGasFeeController(data) { merge(this.fixture.data.GasFeeController, data); return this; diff --git a/test/e2e/tests/settings/account-token-list.spec.js b/test/e2e/tests/settings/account-token-list.spec.js index 0d5dabf21bfb..4b8202d1fddf 100644 --- a/test/e2e/tests/settings/account-token-list.spec.js +++ b/test/e2e/tests/settings/account-token-list.spec.js @@ -11,7 +11,7 @@ describe('Settings', function () { it('Should match the value of token list item and account list item for eth conversion', async function () { await withFixtures( { - fixtures: new FixtureBuilder().build(), + fixtures: new FixtureBuilder().withConversionRateDisabled().build(), ganacheOptions: defaultGanacheOptions, title: this.test.fullTitle(), }, @@ -37,4 +37,46 @@ describe('Settings', function () { }, ); }); + + it('Should match the value of token list item and account list item for fiat conversion', async function () { + await withFixtures( + { + fixtures: new FixtureBuilder().withConversionRateEnabled().build(), + ganacheOptions: defaultGanacheOptions, + title: this.test.fullTitle(), + }, + async ({ driver, ganacheServer }) => { + await logInWithBalanceValidation(driver, ganacheServer); + + await driver.clickElement( + '[data-testid="account-options-menu-button"]', + ); + await driver.clickElement({ text: 'Settings', tag: 'div' }); + await driver.clickElement({ + text: 'General', + tag: 'div', + }); + await driver.clickElement({ text: 'Fiat', tag: 'label' }); + + await driver.clickElement( + '.settings-page__header__title-container__close-button', + ); + await driver.delay(1000); + await driver.clickElement( + '[data-testid="account-overview__asset-tab"]', + ); + + const tokenListAmount = await driver.findElement( + '.eth-overview__primary-container', + ); + assert.equal(await tokenListAmount.getText(), '$42,500.00\nUSD'); + 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(), '$42,500.00USD'); + }, + ); + }); }); diff --git a/test/e2e/tests/settings/localization.spec.js b/test/e2e/tests/settings/localization.spec.js new file mode 100644 index 000000000000..707cc120e578 --- /dev/null +++ b/test/e2e/tests/settings/localization.spec.js @@ -0,0 +1,41 @@ +const { strict: assert } = require('assert'); +const { + defaultGanacheOptions, + withFixtures, + unlockWallet, +} = require('../../helpers'); +const FixtureBuilder = require('../../fixture-builder'); + +describe('Localization', function () { + it('can correctly display Philippine peso symbol and code', async function () { + await withFixtures( + { + fixtures: new FixtureBuilder() + .withCurrencyController({ + currentCurrency: 'php', + }) + .withPreferencesController({ + preferences: { + showFiatInTestnets: true, + }, + }) + .build(), + ganacheOptions: defaultGanacheOptions, + title: this.test.fullTitle(), + }, + async ({ driver }) => { + await unlockWallet(driver); + + const secondaryBalance = await driver.findElement( + '[data-testid="eth-overview__secondary-currency"]', + ); + const secondaryBalanceText = await secondaryBalance.getText(); + const [fiatAmount, fiatUnit] = secondaryBalanceText + .trim() + .split(/\s+/u); + assert.ok(fiatAmount.startsWith('₱')); + assert.equal(fiatUnit, 'PHP'); + }, + ); + }); +}); diff --git a/ui/selectors/selectors.js b/ui/selectors/selectors.js index 2df44ba16b49..18d3438734e9 100644 --- a/ui/selectors/selectors.js +++ b/ui/selectors/selectors.js @@ -968,22 +968,13 @@ export function getShouldShowFiat(state) { const { showFiatInTestnets } = getPreferences(state); const conversionRate = getConversionRate(state); const useCurrencyRateCheck = getUseCurrencyRateCheck(state); + const isConvertibleToFiat = Boolean(useCurrencyRateCheck && conversionRate); if (isTestnet) { - return Boolean( - showFiatInTestnets && useCurrencyRateCheck && conversionRate, - ); + return showFiatInTestnets && isConvertibleToFiat; } - const isMainNet = getIsMainnet(state); - const isLineaMainNet = getIsLineaMainnet(state); - const isCustomNetwork = getIsCustomNetwork(state); - - return Boolean( - (isMainNet || isLineaMainNet || isCustomNetwork) && - useCurrencyRateCheck && - conversionRate, - ); + return isConvertibleToFiat; } export function getShouldHideZeroBalanceTokens(state) { From 4b274ecf9803d58d9b016ae65e6a11dbe3f8ae3e Mon Sep 17 00:00:00 2001 From: OGPoyraz Date: Wed, 4 Sep 2024 09:00:16 +0200 Subject: [PATCH 15/19] Remove delay --- test/e2e/tests/settings/account-token-list.spec.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/e2e/tests/settings/account-token-list.spec.js b/test/e2e/tests/settings/account-token-list.spec.js index 4b8202d1fddf..0cc439ed3004 100644 --- a/test/e2e/tests/settings/account-token-list.spec.js +++ b/test/e2e/tests/settings/account-token-list.spec.js @@ -61,7 +61,6 @@ describe('Settings', function () { await driver.clickElement( '.settings-page__header__title-container__close-button', ); - await driver.delay(1000); await driver.clickElement( '[data-testid="account-overview__asset-tab"]', ); From 35543ad4c9bdbdee9dfe4ec23b978ea004493a2f Mon Sep 17 00:00:00 2001 From: OGPoyraz Date: Wed, 4 Sep 2024 09:16:11 +0200 Subject: [PATCH 16/19] Fix unit tests --- ui/hooks/useUserPreferencedCurrency.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/hooks/useUserPreferencedCurrency.test.js b/ui/hooks/useUserPreferencedCurrency.test.js index c4818d9e980d..12785d44b5ff 100644 --- a/ui/hooks/useUserPreferencedCurrency.test.js +++ b/ui/hooks/useUserPreferencedCurrency.test.js @@ -123,7 +123,7 @@ const renderUseUserPreferencedCurrency = (state, value, restProps) => { ...mockState.metamask, completedOnboarding: true, ...mockNetworkState({ - chainId: state.showFiat ? CHAIN_IDS.MAINNET : CHAIN_IDS.LOCALHOST, + chainId: state.showFiat ? CHAIN_IDS.MAINNET : CHAIN_IDS.SEPOLIA, ticker: state?.nativeCurrency, }), currentCurrency: state.currentCurrency, From dde672c0b4352502c90f92fbf1d8dc1d6f7746be Mon Sep 17 00:00:00 2001 From: OGPoyraz Date: Wed, 4 Sep 2024 09:36:49 +0200 Subject: [PATCH 17/19] Fix e2e tests --- test/e2e/tests/transaction/send-edit.spec.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/e2e/tests/transaction/send-edit.spec.js b/test/e2e/tests/transaction/send-edit.spec.js index a3665bd33591..95e5b3235ebd 100644 --- a/test/e2e/tests/transaction/send-edit.spec.js +++ b/test/e2e/tests/transaction/send-edit.spec.js @@ -13,6 +13,7 @@ describe('Editing Confirm Transaction', function () { { fixtures: new FixtureBuilder() .withTransactionControllerTypeOneTransaction() + .withConversionRateDisabled() .build(), ganacheOptions: defaultGanacheOptions, title: this.test.fullTitle(), @@ -87,6 +88,7 @@ describe('Editing Confirm Transaction', function () { { fixtures: new FixtureBuilder() .withTransactionControllerTypeTwoTransaction() + .withConversionRateDisabled() .build(), ganacheOptions: generateGanacheOptions({ hardfork: 'london' }), title: this.test.fullTitle(), From bad07570bd69327b0aa1a58d9565c10b97091982 Mon Sep 17 00:00:00 2001 From: OGPoyraz Date: Wed, 11 Sep 2024 15:09:16 +0200 Subject: [PATCH 18/19] Fix e2e test --- test/e2e/tests/tokens/custom-token-send-transfer.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/tests/tokens/custom-token-send-transfer.spec.js b/test/e2e/tests/tokens/custom-token-send-transfer.spec.js index a5ae0fea449e..fa87c9cfbe64 100644 --- a/test/e2e/tests/tokens/custom-token-send-transfer.spec.js +++ b/test/e2e/tests/tokens/custom-token-send-transfer.spec.js @@ -59,7 +59,7 @@ describe('Transfer custom tokens @no-mmi', function () { '.currency-display-component__text', ); assert.notEqual( - await estimatedGasFee[0].getText(), + await estimatedGasFee[1].getText(), '0', 'Estimated gas fee should not be 0', ); From 625217ce70f4c97bb9542c5bd59fb827abd59255 Mon Sep 17 00:00:00 2001 From: OGPoyraz Date: Mon, 16 Sep 2024 13:45:24 +0200 Subject: [PATCH 19/19] Fix mmi e2e test --- test/e2e/tests/settings/account-token-list.spec.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/e2e/tests/settings/account-token-list.spec.js b/test/e2e/tests/settings/account-token-list.spec.js index 0cc439ed3004..0fae71ae1d85 100644 --- a/test/e2e/tests/settings/account-token-list.spec.js +++ b/test/e2e/tests/settings/account-token-list.spec.js @@ -68,7 +68,9 @@ describe('Settings', function () { const tokenListAmount = await driver.findElement( '.eth-overview__primary-container', ); + await driver.delay(1000); assert.equal(await tokenListAmount.getText(), '$42,500.00\nUSD'); + await driver.clickElement('[data-testid="account-menu-icon"]'); const accountTokenValue = await driver.waitForSelector( '.multichain-account-list-item .multichain-account-list-item__asset',