Skip to content

Commit 1bf0d47

Browse files
authored
Merge branch 'main' into vs/fix-cancel-button-gas-validation
2 parents 5f5a9cc + e27350d commit 1bf0d47

18 files changed

Lines changed: 172 additions & 118 deletions

File tree

test/e2e/tests/account/unlock-wallet.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ describe('Unlock wallet - ', function () {
107107

108108
if (process.env.SELENIUM_BROWSER === Browser.FIREFOX) {
109109
await onboardingMetricsFlow(driver, {
110-
participateInMetaMetrics: false,
110+
completedMetaMetricsOnboarding: true,
111+
optedIn: false,
111112
dataCollectionForMarketing: false,
112113
});
113114
}

test/e2e/tests/port-stream-chunking/port-stream-chunking.spec.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
import { getEventPayloads, withFixtures } from '../../helpers';
1010
import FixtureBuilderV2 from '../../fixtures/fixture-builder-v2';
1111
import HomePage from '../../page-objects/pages/home/homepage';
12-
import { MOCK_META_METRICS_ID } from '../../constants';
12+
import { MOCK_ANALYTICS_ID } from '../../constants';
1313
import { PAGES } from '../../webdriver/driver';
1414
import LoginPage from '../../page-objects/pages/login-page';
1515

@@ -63,8 +63,9 @@ describe('Port Stream Chunking', function () {
6363
fixtures: new FixtureBuilderV2()
6464
.withTransactionController({ transactions: largeTransactions })
6565
.withMetaMetricsController({
66-
metaMetricsId: MOCK_META_METRICS_ID,
67-
participateInMetaMetrics: true,
66+
analyticsId: MOCK_ANALYTICS_ID,
67+
completedMetaMetricsOnboarding: true,
68+
optedIn: true,
6869
})
6970
.build(),
7071
title: this.test?.fullTitle(),

test/e2e/tests/portfolio/portfolio-site.spec.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { MockttpServer } from 'mockttp';
22
import { withFixtures } from '../../helpers';
3-
import { MOCK_META_METRICS_ID } from '../../constants';
3+
import { MOCK_ANALYTICS_ID } from '../../constants';
44
import FixtureBuilderV2 from '../../fixtures/fixture-builder-v2';
55
import { emptyHtmlPage } from '../../mock-e2e';
66
import HomePage from '../../page-objects/pages/home/homepage';
@@ -13,7 +13,7 @@ describe('Portfolio site', function () {
1313
.forGet('https://app.metamask.io/explore/tokens')
1414
.withQuery({
1515
metamaskEntry: 'ext_portfolio_button',
16-
metametricsId: MOCK_META_METRICS_ID,
16+
metametricsId: MOCK_ANALYTICS_ID,
1717
metricsEnabled: 'true',
1818
marketingEnabled: 'false',
1919
})
@@ -31,8 +31,9 @@ describe('Portfolio site', function () {
3131
dappOptions: { numberOfTestDapps: 1 },
3232
fixtures: new FixtureBuilderV2()
3333
.withMetaMetricsController({
34-
metaMetricsId: MOCK_META_METRICS_ID,
35-
participateInMetaMetrics: true,
34+
analyticsId: MOCK_ANALYTICS_ID,
35+
completedMetaMetricsOnboarding: true,
36+
optedIn: true,
3637
})
3738
.build(),
3839
title: this.test?.fullTitle(),
@@ -45,7 +46,7 @@ describe('Portfolio site', function () {
4546

4647
// Verify site
4748
await driver.waitForUrl({
48-
url: `https://app.metamask.io/explore/tokens?metamaskEntry=ext_portfolio_button&metametricsId=${MOCK_META_METRICS_ID}&metricsEnabled=true&marketingEnabled=false`,
49+
url: `https://app.metamask.io/explore/tokens?metamaskEntry=ext_portfolio_button&metametricsId=${MOCK_ANALYTICS_ID}&metricsEnabled=true&marketingEnabled=false`,
4950
});
5051
await new MockedPage(driver).checkDisplayedMessage(
5152
'Empty page by MetaMask',

test/e2e/tests/profile-metrics/profile-metrics.spec.ts

Lines changed: 50 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ describe('Profile Metrics', function () {
134134
{
135135
fixtures: new FixtureBuilderV2()
136136
.withMetaMetricsController({
137-
participateInMetaMetrics: true,
137+
completedMetaMetricsOnboarding: true,
138+
optedIn: true,
138139
})
139140
.build(),
140141
testSpecificMock: async (server: Mockttp) => [
@@ -173,7 +174,8 @@ describe('Profile Metrics', function () {
173174
{
174175
fixtures: new FixtureBuilderV2()
175176
.withMetaMetricsController({
176-
participateInMetaMetrics: true,
177+
completedMetaMetricsOnboarding: true,
178+
optedIn: true,
177179
})
178180
.build(),
179181
testSpecificMock: async (server: Mockttp) => [
@@ -230,54 +232,59 @@ describe('Profile Metrics', function () {
230232
[
231233
{
232234
title: 'when MetaMetrics is disabled',
233-
participateInMetaMetrics: false,
235+
completedMetaMetricsOnboarding: true,
236+
optedIn: false,
234237
pna25Acknowledged: true,
235238
},
236239
{
237240
title: 'when the user has not acknowledged the privacy change',
238-
participateInMetaMetrics: true,
241+
completedMetaMetricsOnboarding: true,
242+
optedIn: true,
239243
pna25Acknowledged: false,
240244
},
241-
].forEach(({ title, participateInMetaMetrics, pna25Acknowledged }) => {
242-
describe(title, function () {
243-
it('does not send existing accounts to the API on wallet unlock', async function () {
244-
await withFixtures(
245-
{
246-
fixtures: new FixtureBuilderV2()
247-
.withMetaMetricsController({
248-
participateInMetaMetrics,
249-
})
250-
.withAppStateController({
251-
pna25Acknowledged,
252-
})
253-
.build(),
254-
testSpecificMock: async (server: Mockttp) => [
255-
await mockAuthService(server),
256-
await mockRemoteFeatureFlags()(server),
257-
],
258-
title: this.test?.fullTitle(),
259-
},
260-
async ({
261-
driver,
262-
mockedEndpoint,
263-
}: {
264-
driver: Driver;
265-
mockedEndpoint: MockedEndpoint[];
266-
}) => {
267-
await login(driver);
245+
].forEach(
246+
({ title, optedIn, completedMetaMetricsOnboarding, pna25Acknowledged }) => {
247+
describe(title, function () {
248+
it('does not send existing accounts to the API on wallet unlock', async function () {
249+
await withFixtures(
250+
{
251+
fixtures: new FixtureBuilderV2()
252+
.withMetaMetricsController({
253+
optedIn,
254+
completedMetaMetricsOnboarding,
255+
})
256+
.withAppStateController({
257+
pna25Acknowledged,
258+
})
259+
.build(),
260+
testSpecificMock: async (server: Mockttp) => [
261+
await mockAuthService(server),
262+
await mockRemoteFeatureFlags()(server),
263+
],
264+
title: this.test?.fullTitle(),
265+
},
266+
async ({
267+
driver,
268+
mockedEndpoint,
269+
}: {
270+
driver: Driver;
271+
mockedEndpoint: MockedEndpoint[];
272+
}) => {
273+
await login(driver);
268274

269-
await driver.delay(5000);
275+
await driver.delay(5000);
270276

271-
const [authCall] = mockedEndpoint;
272-
const requests = await authCall.getSeenRequests();
273-
assert.equal(
274-
requests.length,
275-
0,
276-
'Expected no requests to the auth API.',
277-
);
278-
},
279-
);
277+
const [authCall] = mockedEndpoint;
278+
const requests = await authCall.getSeenRequests();
279+
assert.equal(
280+
requests.length,
281+
0,
282+
'Expected no requests to the auth API.',
283+
);
284+
},
285+
);
286+
});
280287
});
281-
});
282-
});
288+
},
289+
);
283290
});

test/e2e/tests/remote-feature-flag/remote-feature-flag.spec.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import SettingsPage from '../../page-objects/pages/settings/settings-page';
99
import DeveloperOptionsPage from '../../page-objects/pages/debug-page';
1010
import {
1111
MOCK_CUSTOMIZED_REMOTE_FEATURE_FLAGS,
12-
MOCK_META_METRICS_ID,
12+
MOCK_ANALYTICS_ID,
1313
MOCK_REMOTE_FEATURE_FLAGS_RESPONSE,
1414
} from '../../constants';
1515
import { type MockedEndpoint, Mockttp } from '../../mock-e2e';
@@ -60,8 +60,9 @@ describe('Remote feature flag', function (this: Suite) {
6060
{
6161
fixtures: new FixtureBuilderV2()
6262
.withMetaMetricsController({
63-
metaMetricsId: MOCK_META_METRICS_ID,
64-
participateInMetaMetrics: true,
63+
analyticsId: MOCK_ANALYTICS_ID,
64+
completedMetaMetricsOnboarding: true,
65+
optedIn: true,
6566
})
6667
.build(),
6768
title: this.test?.fullTitle(),
@@ -110,8 +111,9 @@ describe('Remote feature flag', function (this: Suite) {
110111
{
111112
fixtures: new FixtureBuilderV2()
112113
.withMetaMetricsController({
113-
metaMetricsId: MOCK_META_METRICS_ID,
114-
participateInMetaMetrics: true,
114+
analyticsId: MOCK_ANALYTICS_ID,
115+
completedMetaMetricsOnboarding: true,
116+
optedIn: true,
115117
})
116118
.build(),
117119
manifestFlags: {

test/e2e/tests/survey/survey.spec.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { MockttpServer } from 'mockttp';
22
import { ACCOUNTS_PROD_API_BASE_URL } from '../../../../shared/constants/accounts';
3-
import { MOCK_META_METRICS_ID } from '../../constants';
3+
import { MOCK_ANALYTICS_ID } from '../../constants';
44
import { withFixtures } from '../../helpers';
55
import FixtureBuilderV2 from '../../fixtures/fixture-builder-v2';
66
import Homepage from '../../page-objects/pages/home/homepage';
@@ -9,7 +9,7 @@ import { login } from '../../page-objects/flows/login.flow';
99
async function mockSurveys(mockServer: MockttpServer) {
1010
await mockServer
1111
.forGet(
12-
`${ACCOUNTS_PROD_API_BASE_URL}/v1/users/${MOCK_META_METRICS_ID}/surveys`,
12+
`${ACCOUNTS_PROD_API_BASE_URL}/v1/users/${MOCK_ANALYTICS_ID}/surveys`,
1313
)
1414
// We need to mock this request twice because of a bug on the wallet side (#33604)
1515
.twice()
@@ -29,7 +29,7 @@ async function mockSurveys(mockServer: MockttpServer) {
2929
});
3030
await mockServer
3131
.forGet(
32-
`${ACCOUNTS_PROD_API_BASE_URL}/v1/users/${MOCK_META_METRICS_ID}/surveys`,
32+
`${ACCOUNTS_PROD_API_BASE_URL}/v1/users/${MOCK_ANALYTICS_ID}/surveys`,
3333
)
3434
.once()
3535
.thenCallback(() => {
@@ -55,8 +55,9 @@ describe('Test Survey', function () {
5555
dappOptions: { numberOfTestDapps: 1 },
5656
fixtures: new FixtureBuilderV2()
5757
.withMetaMetricsController({
58-
metaMetricsId: MOCK_META_METRICS_ID,
59-
participateInMetaMetrics: true,
58+
analyticsId: MOCK_ANALYTICS_ID,
59+
completedMetaMetricsOnboarding: true,
60+
optedIn: true,
6061
})
6162
.build(),
6263
testSpecificMock: mockSurveys,

test/e2e/tests/vault-corruption/vault-corruption.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ describe('Vault Corruption', function () {
160160
driver,
161161
breakPrimaryDatabaseOnlyScript,
162162
{
163-
participateInMetaMetrics: true,
163+
completedMetaMetricsOnboarding: true,
164+
optedIn: true,
164165
},
165166
);
166167

ui/components/app/modals/pna25-modal/pna25-modal.stories.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import Pna25Modal from './pna25-modal';
77
const storeMock = configureStore({
88
metamask: {
99
completedOnboarding: true,
10-
participateInMetaMetrics: true,
10+
optedIn: true,
11+
completedMetaMetricsOnboarding: true,
1112
pna25Acknowledged: false,
1213
},
1314
});

ui/components/app/wallet-overview/coin-overview.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ import {
2828
getIsTokenNetworkFilterEqualCurrentNetwork,
2929
getChainIdsToPoll,
3030
getDataCollectionForMarketing,
31-
getMetaMetricsId,
32-
getParticipateInMetaMetrics,
31+
getAnalyticsId,
32+
getCompletedMetaMetricsOnboarding,
33+
getOptedIn,
3334
getEnabledNetworksByNamespace,
3435
selectAnyEnabledNetworksAreAvailable,
3536
} from '../../../selectors';
@@ -187,8 +188,12 @@ export const CoinOverview = ({
187188

188189
const { trackEvent } = useContext(MetaMetricsContext);
189190

190-
const metaMetricsId = useSelector(getMetaMetricsId);
191-
const isMetaMetricsEnabled = useSelector(getParticipateInMetaMetrics);
191+
const analyticsId = useSelector(getAnalyticsId);
192+
const completedMetaMetricsOnboarding = useSelector(
193+
getCompletedMetaMetricsOnboarding,
194+
);
195+
const isOptedIn = useSelector(getOptedIn);
196+
const isMetaMetricsEnabled = completedMetaMetricsOnboarding && isOptedIn;
192197
const isMarketingEnabled = useSelector(getDataCollectionForMarketing);
193198

194199
const dispatch = useDispatch();
@@ -223,7 +228,7 @@ export const CoinOverview = ({
223228
const url = getPortfolioUrl(
224229
'explore/tokens',
225230
'ext_portfolio_button',
226-
metaMetricsId,
231+
analyticsId,
227232
isMetaMetricsEnabled === true,
228233
isMarketingEnabled === true,
229234
);
@@ -236,7 +241,7 @@ export const CoinOverview = ({
236241
text: 'Portfolio',
237242
},
238243
});
239-
}, [isMarketingEnabled, isMetaMetricsEnabled, metaMetricsId, trackEvent]);
244+
}, [isMarketingEnabled, isMetaMetricsEnabled, analyticsId, trackEvent]);
240245

241246
const handleReceiveOnClick = useCallback(() => {
242247
trace({ name: TraceName.ReceiveModal });

ui/components/app/wallet-overview/non-evm-overview.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ const BTC_OVERVIEW_SWAP = 'coin-overview-swap';
8181
const BTC_OVERVIEW_SEND = 'coin-overview-send';
8282
const BTC_OVERVIEW_PRIMARY_CURRENCY = 'coin-overview__primary-currency';
8383

84-
const mockMetaMetricsId = 'deadbeef';
84+
const mockAnalyticsId = 'deadbeef';
8585
const mockNonEvmBalance = '1';
8686
const mockNonEvmAccount = {
8787
address: 'bc1qwl8399fz829uqvqly9tcatgrgtwp3udnhxfq4k',
@@ -191,7 +191,7 @@ const mockMetamaskStore = {
191191
// selected account
192192
completedOnboarding: true,
193193
// Used when clicking on some buttons
194-
metaMetricsId: mockMetaMetricsId,
194+
analyticsId: mockAnalyticsId,
195195
// Override state if provided
196196
multichainNetworkConfigurationsByChainId:
197197
AVAILABLE_MULTICHAIN_NETWORK_CONFIGURATIONS,

0 commit comments

Comments
 (0)