From 31a51bb777c1c4c7a3aa6a6b684f687fb6941f26 Mon Sep 17 00:00:00 2001 From: Julia Collins Date: Thu, 18 Jul 2024 15:12:14 -0700 Subject: [PATCH 01/13] chore: add privacy query params to portfolio navigation --- .../app/wallet-overview/coin-buttons.tsx | 12 +++++++++++- ui/helpers/utils/portfolio.js | 19 +++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/ui/components/app/wallet-overview/coin-buttons.tsx b/ui/components/app/wallet-overview/coin-buttons.tsx index 5d710b83adfb..bd78aa6b58f9 100644 --- a/ui/components/app/wallet-overview/coin-buttons.tsx +++ b/ui/components/app/wallet-overview/coin-buttons.tsx @@ -36,7 +36,9 @@ import { ///: BEGIN:ONLY_INCLUDE_IF(build-main,build-beta,build-flask) SwapsEthToken, getCurrentKeyring, + getDataCollectionForMarketing, getMetaMetricsId, + getParticipateInMetaMetrics, ///: END:ONLY_INCLUDE_IF getUseExternalServices, } from '../../../selectors'; @@ -102,6 +104,8 @@ const CoinButtons = ({ ///: END:ONLY_INCLUDE_IF const isExternalServicesEnabled = useSelector(getUseExternalServices); + const isMarketingEnabled = useSelector(getDataCollectionForMarketing); + const isMetaMetricsEnabled = useSelector(getParticipateInMetaMetrics); const buttonTooltips = { buyButton: [ @@ -307,7 +311,13 @@ const CoinButtons = ({ }, [isBridgeChain, chainId, metaMetricsId]); const handlePortfolioOnClick = useCallback(() => { - const url = getPortfolioUrl('', 'ext_portfolio_button', metaMetricsId); + const url = getPortfolioUrl( + '', + 'ext_portfolio_button', + metaMetricsId, + isMetaMetricsEnabled, + isMarketingEnabled, + ); global.platform.openTab({ url }); trackEvent({ category: MetaMetricsEventCategory.Navigation, diff --git a/ui/helpers/utils/portfolio.js b/ui/helpers/utils/portfolio.js index 06515c95bee7..79c409d7994c 100644 --- a/ui/helpers/utils/portfolio.js +++ b/ui/helpers/utils/portfolio.js @@ -2,7 +2,22 @@ export function getPortfolioUrl( endpoint = '', metamaskEntry = '', metaMetricsId = '', + metricsEnabled, + marketingEnabled, ) { - const portfolioUrl = process.env.PORTFOLIO_URL || ''; - return `${portfolioUrl}/${endpoint}?metamaskEntry=${metamaskEntry}&metametricsId=${metaMetricsId}`; + const baseUrl = process.env.PORTFOLIO_URL || ''; + const url = new URL(endpoint, baseUrl); + + url.searchParams.append('metamaskEntry', metamaskEntry); + url.searchParams.append('metametricsId', metaMetricsId); + + // If defined, append privacy preferences for metrics + marketing on user navigation to Portfolio + if (metricsEnabled !== undefined) { + url.searchParams.append('metricsEnabled', String(metricsEnabled)); + } + if (marketingEnabled !== undefined) { + url.searchParams.append('marketingEnabled', String(marketingEnabled)); + } + + return url.href; } From df8eb6977ab2ae766867ccf494d1a06e6c3d86fd Mon Sep 17 00:00:00 2001 From: Julia Collins Date: Thu, 18 Jul 2024 21:05:16 -0700 Subject: [PATCH 02/13] fix: unit test --- .../app/wallet-overview/btc-overview.test.tsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ui/components/app/wallet-overview/btc-overview.test.tsx b/ui/components/app/wallet-overview/btc-overview.test.tsx index 15893fa4d204..ec8978bbf22d 100644 --- a/ui/components/app/wallet-overview/btc-overview.test.tsx +++ b/ui/components/app/wallet-overview/btc-overview.test.tsx @@ -1,6 +1,6 @@ import React from 'react'; import configureMockStore from 'redux-mock-store'; -import { fireEvent } from '@testing-library/react'; +import { fireEvent, waitFor } from '@testing-library/react'; import thunk from 'redux-thunk'; import { Cryptocurrency } from '@metamask/assets-controllers'; import { BtcAccountType, BtcMethod } from '@metamask/keyring-api'; @@ -227,11 +227,12 @@ describe('BtcOverview', () => { fireEvent.click(portfolioButton as HTMLElement); expect(openTabSpy).toHaveBeenCalledTimes(1); - expect(openTabSpy).toHaveBeenCalledWith({ - url: makePortfolioUrl('', { - metamaskEntry: 'ext_portfolio_button', - metametricsId: mockMetaMetricsId, + await waitFor(() => + expect(openTabSpy).toHaveBeenCalledWith({ + url: expect.stringContaining( + `?metamaskEntry=ext_portfolio_button&metametricsId=${mockMetaMetricsId}`, + ), }), - }); + ); }); }); From 88fdc3f24c39b3c09d290d290b65fa3e90920503 Mon Sep 17 00:00:00 2001 From: Julia Collins Date: Thu, 18 Jul 2024 21:27:14 -0700 Subject: [PATCH 03/13] fix: move to within a only include if block --- ui/components/app/wallet-overview/coin-buttons.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/components/app/wallet-overview/coin-buttons.tsx b/ui/components/app/wallet-overview/coin-buttons.tsx index bd78aa6b58f9..1e75fd0fe13a 100644 --- a/ui/components/app/wallet-overview/coin-buttons.tsx +++ b/ui/components/app/wallet-overview/coin-buttons.tsx @@ -99,13 +99,13 @@ const CoinButtons = ({ ///: BEGIN:ONLY_INCLUDE_IF(build-main,build-beta,build-flask) const location = useLocation(); const metaMetricsId = useSelector(getMetaMetricsId); + const isMetaMetricsEnabled = useSelector(getParticipateInMetaMetrics); + const isMarketingEnabled = useSelector(getDataCollectionForMarketing); const keyring = useSelector(getCurrentKeyring); const usingHardwareWallet = isHardwareKeyring(keyring?.type); ///: END:ONLY_INCLUDE_IF const isExternalServicesEnabled = useSelector(getUseExternalServices); - const isMarketingEnabled = useSelector(getDataCollectionForMarketing); - const isMetaMetricsEnabled = useSelector(getParticipateInMetaMetrics); const buttonTooltips = { buyButton: [ From 4516f361d73e5a01a961a4a7717ce4db144252e1 Mon Sep 17 00:00:00 2001 From: Julia Collins Date: Fri, 19 Jul 2024 10:32:54 -0700 Subject: [PATCH 04/13] fix: e2e failing test --- test/e2e/tests/portfolio/portfolio-site.spec.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/e2e/tests/portfolio/portfolio-site.spec.js b/test/e2e/tests/portfolio/portfolio-site.spec.js index 8e8c0ab917c0..99c515ac36be 100644 --- a/test/e2e/tests/portfolio/portfolio-site.spec.js +++ b/test/e2e/tests/portfolio/portfolio-site.spec.js @@ -42,10 +42,10 @@ describe('Portfolio site', function () { await driver.switchToWindowWithTitle('E2E Test Page', windowHandles); // Verify site - assert.equal( - await driver.getCurrentUrl(), - 'https://portfolio.metamask.io/?metamaskEntry=ext_portfolio_button&metametricsId=null', - ); + const currentUrl = await driver.getCurrentUrl(); + const expectedUrl = + 'https://portfolio.metamask.io/?metamaskEntry=ext_portfolio_button&metametricsId=null&metricsEnabled=false&marketingEnabled=false'; + assert.equal(currentUrl, expectedUrl); }, ); }); From 94205549b491995270ff44ceeb07334c86a1d484 Mon Sep 17 00:00:00 2001 From: Julia Collins Date: Fri, 19 Jul 2024 11:42:08 -0700 Subject: [PATCH 05/13] chore: append query params to the rest of the portfolio links --- ui/components/app/wallet-overview/coin-buttons.tsx | 2 ++ .../multichain/token-list-item/token-list-item.js | 14 ++++++++++++-- .../ui/new-network-info/new-network-info.js | 6 ++++++ ui/hooks/ramps/useRamps/useRamps.ts | 14 +++++++++++++- ui/pages/asset/components/token-buttons.tsx | 6 ++++++ .../swaps/prepare-swap-page/prepare-swap-page.js | 6 ++++++ 6 files changed, 45 insertions(+), 3 deletions(-) diff --git a/ui/components/app/wallet-overview/coin-buttons.tsx b/ui/components/app/wallet-overview/coin-buttons.tsx index 1e75fd0fe13a..8ecb9ec60e4b 100644 --- a/ui/components/app/wallet-overview/coin-buttons.tsx +++ b/ui/components/app/wallet-overview/coin-buttons.tsx @@ -291,6 +291,8 @@ const CoinButtons = ({ 'bridge', 'ext_bridge_button', metaMetricsId, + isMetaMetricsEnabled, + isMarketingEnabled, ); global.platform.openTab({ url: `${portfolioUrl}${ diff --git a/ui/components/multichain/token-list-item/token-list-item.js b/ui/components/multichain/token-list-item/token-list-item.js index 17157d2528da..c24ad15393e2 100644 --- a/ui/components/multichain/token-list-item/token-list-item.js +++ b/ui/components/multichain/token-list-item/token-list-item.js @@ -39,6 +39,8 @@ import { getMetaMetricsId, getTestNetworkBackgroundColor, getTokensMarketData, + getParticipateInMetaMetrics, + getDataCollectionForMarketing, } from '../../../selectors'; import { getMultichainCurrentChainId, @@ -82,8 +84,10 @@ export const TokenListItem = ({ const isEvm = useSelector(getMultichainIsEvm); const primaryTokenImage = useSelector(getMultichainNativeCurrencyImage); const trackEvent = useContext(MetaMetricsContext); - const metaMetricsId = useSelector(getMetaMetricsId); const chainId = useSelector(getMultichainCurrentChainId); + const metaMetricsId = useSelector(getMetaMetricsId); + const isMetaMetricsEnabled = useSelector(getParticipateInMetaMetrics); + const isMarketingEnabled = useSelector(getDataCollectionForMarketing); // Scam warning const showScamWarning = @@ -133,7 +137,13 @@ export const TokenListItem = ({ onClick={(e) => { e.preventDefault(); e.stopPropagation(); - const url = getPortfolioUrl('stake', 'ext_stake_button', metaMetricsId); + const url = getPortfolioUrl( + 'stake', + 'ext_stake_button', + metaMetricsId, + isMetaMetricsEnabled, + isMarketingEnabled, + ); global.platform.openTab({ url }); trackEvent({ event: MetaMetricsEventName.StakingEntryPointClicked, diff --git a/ui/components/ui/new-network-info/new-network-info.js b/ui/components/ui/new-network-info/new-network-info.js index c659c200dfde..51b96bdc5b36 100644 --- a/ui/components/ui/new-network-info/new-network-info.js +++ b/ui/components/ui/new-network-info/new-network-info.js @@ -21,6 +21,8 @@ import { getMetaMetricsId, getUseTokenDetection, getUseExternalServices, + getParticipateInMetaMetrics, + getDataCollectionForMarketing, } from '../../../selectors'; import { setFirstTimeUsedNetwork } from '../../../store/actions'; import { @@ -49,6 +51,8 @@ export default function NewNetworkInfo() { const currentNetwork = useSelector(getCurrentNetwork); const metaMetricsId = useSelector(getMetaMetricsId); const isBridgeChain = useSelector(getIsBridgeChain); + const isMetaMetricsEnabled = useSelector(getParticipateInMetaMetrics); + const isMarketingEnabled = useSelector(getDataCollectionForMarketing); const onCloseClick = () => { setShowPopup(false); @@ -203,6 +207,8 @@ export default function NewNetworkInfo() { 'bridge', 'ext_bridge_new_network_info_link', metaMetricsId, + isMetaMetricsEnabled, + isMarketingEnabled, )}&destChain=${currentNetwork?.chainId}`} target="_blank" rel="noreferrer" diff --git a/ui/hooks/ramps/useRamps/useRamps.ts b/ui/hooks/ramps/useRamps/useRamps.ts index 55b1d1e222d9..429abbf1a96b 100644 --- a/ui/hooks/ramps/useRamps/useRamps.ts +++ b/ui/hooks/ramps/useRamps/useRamps.ts @@ -2,7 +2,12 @@ import { useCallback } from 'react'; import { useSelector } from 'react-redux'; import { CaipChainId } from '@metamask/utils'; import { ChainId } from '../../../../shared/constants/network'; -import { getCurrentChainId, getMetaMetricsId } from '../../../selectors'; +import { + getCurrentChainId, + getDataCollectionForMarketing, + getMetaMetricsId, + getParticipateInMetaMetrics, +} from '../../../selectors'; type IUseRamps = { openBuyCryptoInPdapp: (chainId?: ChainId | CaipChainId) => void; @@ -23,6 +28,8 @@ const useRamps = ( ): IUseRamps => { const chainId = useSelector(getCurrentChainId); const metaMetricsId = useSelector(getMetaMetricsId); + const isMetaMetricsEnabled = useSelector(getParticipateInMetaMetrics); + const isMarketingEnabled = useSelector(getDataCollectionForMarketing); const getBuyURI = useCallback( (_chainId: ChainId | CaipChainId) => { @@ -32,6 +39,11 @@ const useRamps = ( if (metaMetricsId) { params.set('metametricsId', metaMetricsId); } + params.set('metricsEnabled', String(isMetaMetricsEnabled)); + if (isMarketingEnabled) { + params.set('marketingEnabled', String(isMarketingEnabled)); + } + return `${portfolioUrl}/buy?${params.toString()}`; }, [metaMetricsId], diff --git a/ui/pages/asset/components/token-buttons.tsx b/ui/pages/asset/components/token-buttons.tsx index 6cd78fab7693..388eb9548968 100644 --- a/ui/pages/asset/components/token-buttons.tsx +++ b/ui/pages/asset/components/token-buttons.tsx @@ -29,6 +29,8 @@ import { getIsBridgeChain, getCurrentKeyring, getMetaMetricsId, + getParticipateInMetaMetrics, + getDataCollectionForMarketing, ///: END:ONLY_INCLUDE_IF } from '../../../selectors'; import { INVALID_ASSET_TYPE } from '../../../helpers/constants/error-keys'; @@ -73,6 +75,8 @@ const TokenButtons = ({ const isBridgeChain = useSelector(getIsBridgeChain); const isBuyableChain = useSelector(getIsNativeTokenBuyable); const metaMetricsId = useSelector(getMetaMetricsId); + const isMetaMetricsEnabled = useSelector(getParticipateInMetaMetrics); + const isMarketingEnabled = useSelector(getDataCollectionForMarketing); const { openBuyCryptoInPdapp } = useRamps(); ///: END:ONLY_INCLUDE_IF @@ -284,6 +288,8 @@ const TokenButtons = ({ 'bridge', 'ext_bridge_button', metaMetricsId, + isMetaMetricsEnabled, + isMarketingEnabled, ); global.platform.openTab({ url: `${portfolioUrl}&token=${token.address}`, diff --git a/ui/pages/swaps/prepare-swap-page/prepare-swap-page.js b/ui/pages/swaps/prepare-swap-page/prepare-swap-page.js index 206936aed148..98bb6933d0c3 100644 --- a/ui/pages/swaps/prepare-swap-page/prepare-swap-page.js +++ b/ui/pages/swaps/prepare-swap-page/prepare-swap-page.js @@ -64,6 +64,8 @@ import { getHardwareWalletType, getIsBridgeChain, getMetaMetricsId, + getParticipateInMetaMetrics, + getDataCollectionForMarketing, } from '../../../selectors'; import { getSmartTransactionsOptInStatus, @@ -219,6 +221,8 @@ export default function PrepareSwapPage({ const currentCurrency = useSelector(getCurrentCurrency); const fetchingQuotes = useSelector(getFetchingQuotes); const loadingComplete = !fetchingQuotes && areQuotesPresent; + const isMetaMetricsEnabled = useSelector(getParticipateInMetaMetrics); + const isMarketingEnabled = useSelector(getDataCollectionForMarketing); const fetchParamsFromToken = isSwapsDefaultTokenSymbol( sourceTokenInfo?.symbol, @@ -1024,6 +1028,8 @@ export default function PrepareSwapPage({ 'bridge', 'ext_bridge_prepare_swap_link', metaMetricsId, + isMetaMetricsEnabled, + isMarketingEnabled, ); global.platform.openTab({ From 5e7ccb38e659ad71df6b257b944a805e0fb8d19c Mon Sep 17 00:00:00 2001 From: Julia Collins Date: Fri, 19 Jul 2024 11:59:06 -0700 Subject: [PATCH 06/13] fix: unit test for buy portfolio button --- ui/components/app/wallet-overview/btc-overview.test.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/components/app/wallet-overview/btc-overview.test.tsx b/ui/components/app/wallet-overview/btc-overview.test.tsx index ec8978bbf22d..8f7441f72530 100644 --- a/ui/components/app/wallet-overview/btc-overview.test.tsx +++ b/ui/components/app/wallet-overview/btc-overview.test.tsx @@ -208,6 +208,7 @@ describe('BtcOverview', () => { metamaskEntry: RampsMetaMaskEntry.BuySellButton, chainId: MultichainNetworks.BITCOIN, metametricsId: mockMetaMetricsId, + metricsEnabled: String(false), }), }); }); From 246c3dad716fbaf36e756923e49e6b8a9f5282c9 Mon Sep 17 00:00:00 2001 From: Julia Collins Date: Fri, 19 Jul 2024 12:08:12 -0700 Subject: [PATCH 07/13] fix: unit test part 2 --- ui/hooks/ramps/useRamps/useRamps.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/hooks/ramps/useRamps/useRamps.test.tsx b/ui/hooks/ramps/useRamps/useRamps.test.tsx index 9c53eb9da247..8565eb1564b7 100644 --- a/ui/hooks/ramps/useRamps/useRamps.test.tsx +++ b/ui/hooks/ramps/useRamps/useRamps.test.tsx @@ -97,7 +97,7 @@ describe('useRamps', () => { }, }; - const mockBuyURI = `${process.env.PORTFOLIO_URL}/buy?metamaskEntry=ext_buy_sell_button&chainId=${mockChainId}&metametricsId=${mockedMetametricsId}`; + const mockBuyURI = `${process.env.PORTFOLIO_URL}/buy?metamaskEntry=ext_buy_sell_button&chainId=${mockChainId}&metametricsId=${mockedMetametricsId}&metricsEnabled=false`; const openTabSpy = jest.spyOn(global.platform, 'openTab'); const { result } = renderHook(() => useRamps(), { wrapper }); From bfdca88f815851da813eb7ef091a7ff4b7627550 Mon Sep 17 00:00:00 2001 From: Julia Collins Date: Fri, 19 Jul 2024 12:09:53 -0700 Subject: [PATCH 08/13] chore: update getPortfolioUrl params --- ui/helpers/utils/portfolio.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/ui/helpers/utils/portfolio.js b/ui/helpers/utils/portfolio.js index 79c409d7994c..3aa5d8f592b2 100644 --- a/ui/helpers/utils/portfolio.js +++ b/ui/helpers/utils/portfolio.js @@ -2,8 +2,8 @@ export function getPortfolioUrl( endpoint = '', metamaskEntry = '', metaMetricsId = '', - metricsEnabled, - marketingEnabled, + metricsEnabled = false, + marketingEnabled = false, ) { const baseUrl = process.env.PORTFOLIO_URL || ''; const url = new URL(endpoint, baseUrl); @@ -11,13 +11,9 @@ export function getPortfolioUrl( url.searchParams.append('metamaskEntry', metamaskEntry); url.searchParams.append('metametricsId', metaMetricsId); - // If defined, append privacy preferences for metrics + marketing on user navigation to Portfolio - if (metricsEnabled !== undefined) { - url.searchParams.append('metricsEnabled', String(metricsEnabled)); - } - if (marketingEnabled !== undefined) { - url.searchParams.append('marketingEnabled', String(marketingEnabled)); - } + // Append privacy preferences for metrics + marketing on user navigation to Portfolio + url.searchParams.append('metricsEnabled', String(metricsEnabled)); + url.searchParams.append('marketingEnabled', String(marketingEnabled)); return url.href; } From b7886b4badc700b67e7fefc5c8cfd97c160836d6 Mon Sep 17 00:00:00 2001 From: Julia Collins Date: Fri, 19 Jul 2024 12:18:56 -0700 Subject: [PATCH 09/13] fix: unit test metrics enables --- ui/hooks/ramps/useRamps/useRamps.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/hooks/ramps/useRamps/useRamps.test.tsx b/ui/hooks/ramps/useRamps/useRamps.test.tsx index 8565eb1564b7..201ad17fa095 100644 --- a/ui/hooks/ramps/useRamps/useRamps.test.tsx +++ b/ui/hooks/ramps/useRamps/useRamps.test.tsx @@ -68,7 +68,7 @@ describe('useRamps', () => { }, }; - const mockBuyURI = `${process.env.PORTFOLIO_URL}/buy?metamaskEntry=${metaMaskEntry}&chainId=${mockChainId}&metametricsId=${mockedMetametricsId}`; + const mockBuyURI = `${process.env.PORTFOLIO_URL}/buy?metamaskEntry=${metaMaskEntry}&chainId=${mockChainId}&metametricsId=${mockedMetametricsId}&metricsEnabled=false`; const openTabSpy = jest.spyOn(global.platform, 'openTab'); const { result } = renderHook( From aef1d741edb75b8e8e2b090ea3f82d167ef19d54 Mon Sep 17 00:00:00 2001 From: Julia Collins Date: Fri, 19 Jul 2024 12:28:14 -0700 Subject: [PATCH 10/13] fix: ramps unit test for query param --- ui/hooks/ramps/useRamps/useRamps.test.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/hooks/ramps/useRamps/useRamps.test.tsx b/ui/hooks/ramps/useRamps/useRamps.test.tsx index 201ad17fa095..3477827562d4 100644 --- a/ui/hooks/ramps/useRamps/useRamps.test.tsx +++ b/ui/hooks/ramps/useRamps/useRamps.test.tsx @@ -43,7 +43,7 @@ describe('useRamps', () => { }, }; - const mockBuyURI = `${process.env.PORTFOLIO_URL}/buy?metamaskEntry=${metaMaskEntry}&chainId=${mockChainId}&metametricsId=${mockedMetametricsId}`; + const mockBuyURI = `${process.env.PORTFOLIO_URL}/buy?metamaskEntry=${metaMaskEntry}&chainId=${mockChainId}&metametricsId=${mockedMetametricsId}&metricsEnabled=false`; const openTabSpy = jest.spyOn(global.platform, 'openTab'); const { result } = renderHook(() => useRamps(), { wrapper }); // default metamask entry From 1e319678310c6b692a4e4017fd4e60714bff07a3 Mon Sep 17 00:00:00 2001 From: Julia Collins Date: Fri, 19 Jul 2024 12:42:54 -0700 Subject: [PATCH 11/13] chore: unit test update with second query param --- ui/pages/asset/components/asset-page.test.tsx | 4 +--- .../confirmations/hooks/useConfirmationAlertActions.test.ts | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/ui/pages/asset/components/asset-page.test.tsx b/ui/pages/asset/components/asset-page.test.tsx index 2216535a1e2b..5fa7c0c51711 100644 --- a/ui/pages/asset/components/asset-page.test.tsx +++ b/ui/pages/asset/components/asset-page.test.tsx @@ -246,9 +246,7 @@ describe('AssetPage', () => { await waitFor(() => expect(openTabSpy).toHaveBeenCalledWith({ - url: expect.stringContaining( - `/bridge?metamaskEntry=ext_bridge_button&metametricsId=&token=${token.address}`, - ), + url: `https://portfolio.test/bridge?metamaskEntry=ext_bridge_button&metametricsId=&metricsEnabled=false&marketingEnabled=false&token=${token.address}`, }), ); }); diff --git a/ui/pages/confirmations/hooks/useConfirmationAlertActions.test.ts b/ui/pages/confirmations/hooks/useConfirmationAlertActions.test.ts index f13096b32e3a..add83f9d9feb 100644 --- a/ui/pages/confirmations/hooks/useConfirmationAlertActions.test.ts +++ b/ui/pages/confirmations/hooks/useConfirmationAlertActions.test.ts @@ -10,7 +10,7 @@ jest.mock('../../../contexts/transaction-modal', () => ({ })); const EXPECTED_BUY_URL = - 'https://portfolio.test/buy?metamaskEntry=ext_buy_sell_button&chainId=0x5'; + 'https://portfolio.test/buy?metamaskEntry=ext_buy_sell_button&chainId=0x5&metricsEnabled=false'; function processAlertActionKey(actionKey: string) { const { result } = renderHookWithProvider( From fbda63bc5a5459bd17bbd61d8f01fb90e786af0c Mon Sep 17 00:00:00 2001 From: Julia Collins Date: Fri, 19 Jul 2024 13:03:31 -0700 Subject: [PATCH 12/13] fix: bridge e2e --- test/e2e/tests/bridge/bridge-click-from-eth-overview.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/tests/bridge/bridge-click-from-eth-overview.spec.ts b/test/e2e/tests/bridge/bridge-click-from-eth-overview.spec.ts index 0a6098e01592..df4794ec8f22 100644 --- a/test/e2e/tests/bridge/bridge-click-from-eth-overview.spec.ts +++ b/test/e2e/tests/bridge/bridge-click-from-eth-overview.spec.ts @@ -19,7 +19,7 @@ describe('Click bridge button from wallet overview @no-mmi', function (this: Sui await logInWithBalanceValidation(driver, ganacheServer); await bridgePage.load(); await bridgePage.verifyPortfolioTab( - 'https://portfolio.metamask.io/bridge?metametricsId=null', + 'https://portfolio.metamask.io/bridge?metametricsId=null&metricsEnabled=false&marketingEnabled=false', ); }, ); From 8443abff344c815b29e50a2cb224017fe69de46b Mon Sep 17 00:00:00 2001 From: Julia Collins Date: Fri, 19 Jul 2024 13:27:33 -0700 Subject: [PATCH 13/13] chore: update expected url in e2e --- .../bridge/bridge-click-from-asset-overview.spec.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/test/e2e/tests/bridge/bridge-click-from-asset-overview.spec.ts b/test/e2e/tests/bridge/bridge-click-from-asset-overview.spec.ts index 766c4561fd56..9521b91cbb21 100644 --- a/test/e2e/tests/bridge/bridge-click-from-asset-overview.spec.ts +++ b/test/e2e/tests/bridge/bridge-click-from-asset-overview.spec.ts @@ -5,6 +5,9 @@ import GanacheContractAddressRegistry from '../../seeder/ganache-contract-addres import { Driver } from '../../webdriver/driver'; import { BridgePage, getBridgeFixtures } from './bridge-test-utils'; +const EXPECTED_PORTFOLIO_URL = + 'https://portfolio.metamask.io/bridge?metametricsId=null&metricsEnabled=false&marketingEnabled=false'; + describe('Click bridge button from asset page @no-mmi', function (this: Suite) { it('loads portfolio tab when flag is turned off', async function () { await withFixtures( @@ -25,18 +28,13 @@ describe('Click bridge button from asset page @no-mmi', function (this: Suite) { // ETH await bridgePage.loadAssetPage(contractRegistry); await bridgePage.load('coin-overview'); - await bridgePage.verifyPortfolioTab( - 'https://portfolio.metamask.io/bridge?metametricsId=null', - ); - + await bridgePage.verifyPortfolioTab(EXPECTED_PORTFOLIO_URL); await bridgePage.reloadHome(); // TST await bridgePage.loadAssetPage(contractRegistry, 'TST'); await bridgePage.load('token-overview'); - await bridgePage.verifyPortfolioTab( - 'https://portfolio.metamask.io/bridge?metametricsId=null', - ); + await bridgePage.verifyPortfolioTab(EXPECTED_PORTFOLIO_URL); }, ); });