Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix: Ensure no duplicate accounts are persisted ([#32287](https://github.com/MetaMask/metamask-extension/pull/32287))
- Fix: provide better native token names when bridging and swapping removed networks([#32293](https://github.com/MetaMask/metamask-extension/pull/32293))

## [12.16.2]
### Changed
- Update onboarding flow for Firefox ([#32179](https://github.com/MetaMask/metamask-extension/pull/32179))
- Make "Dapp Viewed" event exclude metametrics id data ([#32207](https://github.com/MetaMask/metamask-extension/pull/32207))

## [12.16.1]
### Added
- Add support for version 2.0.0 of EIP-5792 ([#31913](https://github.com/MetaMask/metamask-extension/pull/31913))
Expand Down Expand Up @@ -6075,7 +6080,8 @@ Update styles and spacing on the critical error page ([#20350](https://github.c


[Unreleased]: https://github.com/MetaMask/metamask-extension/compare/v12.17.0...HEAD
[12.17.0]: https://github.com/MetaMask/metamask-extension/compare/v12.16.1...v12.17.0
[12.17.0]: https://github.com/MetaMask/metamask-extension/compare/v12.16.2...v12.17.0
[12.16.2]: https://github.com/MetaMask/metamask-extension/compare/v12.16.1...v12.16.2
[12.16.1]: https://github.com/MetaMask/metamask-extension/compare/v12.16.0...v12.16.1
[12.16.0]: https://github.com/MetaMask/metamask-extension/compare/v12.15.2...v12.16.0
[12.15.2]: https://github.com/MetaMask/metamask-extension/compare/v12.15.1...v12.15.2
Expand Down
25 changes: 15 additions & 10 deletions app/scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -675,18 +675,23 @@ function emitDappViewedMetricEvent(origin) {
);
const numberOfTotalAccounts = Object.keys(preferencesState.identities).length;

controller.metaMetricsController.trackEvent({
event: MetaMetricsEventName.DappViewed,
category: MetaMetricsEventCategory.InpageProvider,
referrer: {
url: origin,
controller.metaMetricsController.trackEvent(
Copy link
Contributor Author

@DDDDDanica DDDDDanica Apr 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comes from hotfix: f57f142

{
event: MetaMetricsEventName.DappViewed,
category: MetaMetricsEventCategory.InpageProvider,
referrer: {
url: origin,
},
properties: {
is_first_visit: false,
number_of_accounts: numberOfTotalAccounts,
number_of_accounts_connected: numberOfConnectedAccounts,
},
},
properties: {
is_first_visit: false,
number_of_accounts: numberOfTotalAccounts,
number_of_accounts_connected: numberOfConnectedAccounts,
{
excludeMetaMetricsId: true,
},
});
);
}

/**
Expand Down
25 changes: 15 additions & 10 deletions app/scripts/lib/rpc-method-middleware/handlers/request-accounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,23 @@ async function requestEthereumAccountsHandler(
const isFirstVisit = !Object.keys(metamaskState.permissionHistory).includes(
origin,
);
sendMetrics({
event: MetaMetricsEventName.DappViewed,
category: MetaMetricsEventCategory.InpageProvider,
referrer: {
url: origin,
sendMetrics(
{
event: MetaMetricsEventName.DappViewed,
category: MetaMetricsEventCategory.InpageProvider,
referrer: {
url: origin,
},
properties: {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comes from hotfix: f57f142

is_first_visit: isFirstVisit,
number_of_accounts: Object.keys(metamaskState.accounts).length,
number_of_accounts_connected: ethAccounts.length,
},
},
properties: {
is_first_visit: isFirstVisit,
number_of_accounts: Object.keys(metamaskState.accounts).length,
number_of_accounts_connected: ethAccounts.length,
{
excludeMetaMetricsId: true,
},
});
);
}

res.result = ethAccounts;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,18 +187,23 @@ describe('requestEthereumAccountsHandler', () => {
MockUtil.shouldEmitDappViewedEvent.mockReturnValue(true);

await handler(baseRequest);
expect(sendMetrics).toHaveBeenCalledWith({
category: 'inpage_provider',
event: 'Dapp Viewed',
properties: {
is_first_visit: true,
number_of_accounts: 3,
number_of_accounts_connected: 2,
expect(sendMetrics).toHaveBeenCalledWith(
{
category: 'inpage_provider',
event: 'Dapp Viewed',
properties: {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comes from hotfix: f57f142

is_first_visit: true,
number_of_accounts: 3,
number_of_accounts_connected: 2,
},
referrer: {
url: 'http://test.com',
},
},
referrer: {
url: 'http://test.com',
{
excludeMetaMetricsId: true,
},
});
);
});

it('does not emit the dapp viewed metrics event when shouldEmitDappViewedEvent returns false', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,18 +511,23 @@ describe('wallet_createSession', () => {
const { handler, sendMetrics } = createMockedHandler();
await handler(baseRequest);

expect(sendMetrics).toHaveBeenCalledWith({
category: 'inpage_provider',
event: 'Dapp Viewed',
properties: {
is_first_visit: true,
number_of_accounts: 3,
number_of_accounts_connected: 4,
expect(sendMetrics).toHaveBeenCalledWith(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comes from hotfix: f57f142

{
category: 'inpage_provider',
event: 'Dapp Viewed',
properties: {
is_first_visit: true,
number_of_accounts: 3,
number_of_accounts_connected: 4,
},
referrer: {
url: 'http://test.com',
},
},
referrer: {
url: 'http://test.com',
{
excludeMetaMetricsId: true,
},
});
);
});

it('returns the known sessionProperties and approved session scopes', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,18 +297,24 @@ async function walletCreateSessionHandler(

const approvedEthAccounts = getEthAccounts(approvedCaip25CaveatValue);

hooks.sendMetrics({
event: MetaMetricsEventName.DappViewed,
category: MetaMetricsEventCategory.InpageProvider,
referrer: {
url: origin,
hooks.sendMetrics(
{
event: MetaMetricsEventName.DappViewed,
category: MetaMetricsEventCategory.InpageProvider,
referrer: {
url: origin,
},
properties: {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comes from hotfix: f57f142

is_first_visit: isFirstVisit,
number_of_accounts: Object.keys(hooks.metamaskState.accounts)
.length,
number_of_accounts_connected: approvedEthAccounts.length,
},
},
properties: {
is_first_visit: isFirstVisit,
number_of_accounts: Object.keys(hooks.metamaskState.accounts).length,
number_of_accounts_connected: approvedEthAccounts.length,
{
excludeMetaMetricsId: true,
},
});
);
}

res.result = {
Expand Down
14 changes: 4 additions & 10 deletions test/e2e/flask/solana/common-solana.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ACCOUNT_TYPE } from '../../constants';
import { loginWithoutBalanceValidation } from '../../page-objects/flows/login.flow';

const SOLANA_URL_REGEX_MAINNET =
/^https:\/\/solana-mainnet\.infura\.io\/v3\/.*/u;
/^https:\/\/solana-(mainnet|devnet)\.infura\.io\/v3\/.*/u;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comes from flaky flask e2e test fix: f2e26fc

const SOLANA_URL_REGEX_DEVNET = /^https:\/\/solana-devnet\.infura\.io\/v3\/.*/u;
const SOLANA_SPOT_PRICE_API =
/^https:\/\/price\.(uat-api|api)\.cx\.metamask\.io\/v[1-9]\/spot-prices/u;
Expand Down Expand Up @@ -550,15 +550,9 @@ export async function mockTokenApiMainnet(mockServer: Mockttp) {
},
],
};
return await mockServer
.forGet(SOLANA_TOKEN_API)
.withQuery({
assetIds:
'solana%5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp%2Fslip44%3A501%2Csolana%5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp%2Ftoken%3A2RBko3xoz56aH69isQMUpzZd9NYHahhwC23A5F3Spkin',
})
.thenCallback(() => {
return response;
});
return await mockServer.forGet(SOLANA_TOKEN_API).thenCallback(() => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comes from flaky flask e2e test fix: f2e26fc

return response;
});
}

export async function mockTokenApiMainnet2(mockServer: Mockttp) {
Expand Down
90 changes: 63 additions & 27 deletions test/e2e/page-objects/flows/onboarding.flow.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Browser } from 'selenium-webdriver';
import { Driver } from '../../webdriver/driver';
import OnboardingMetricsPage from '../pages/onboarding/onboarding-metrics-page';
import OnboardingPasswordPage from '../pages/onboarding/onboarding-password-page';
Expand Down Expand Up @@ -36,20 +37,24 @@ export const createNewWalletOnboardingFlow = async ({
if (needNavigateToNewPage) {
await driver.navigate();
}

if (process.env.SELENIUM_BROWSER === Browser.FIREFOX) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comes from hotfix f57f142

await onboardingMetricsFlow(driver, {
participateInMetaMetrics,
dataCollectionForMarketing,
});
}

const startOnboardingPage = new StartOnboardingPage(driver);
await startOnboardingPage.check_pageIsLoaded();
await startOnboardingPage.checkTermsCheckbox();
await startOnboardingPage.clickCreateWalletButton();

const onboardingMetricsPage = new OnboardingMetricsPage(driver);
await onboardingMetricsPage.check_pageIsLoaded();
if (dataCollectionForMarketing) {
await onboardingMetricsPage.clickDataCollectionForMarketingCheckbox();
}
if (participateInMetaMetrics) {
await onboardingMetricsPage.clickIAgreeButton();
} else {
await onboardingMetricsPage.clickNoThanksButton();
if (process.env.SELENIUM_BROWSER !== Browser.FIREFOX) {
await onboardingMetricsFlow(driver, {
participateInMetaMetrics,
dataCollectionForMarketing,
});
}

const onboardingPasswordPage = new OnboardingPasswordPage(driver);
Expand Down Expand Up @@ -88,20 +93,24 @@ export const incompleteCreateNewWalletOnboardingFlow = async ({
if (needNavigateToNewPage) {
await driver.navigate();
}

if (process.env.SELENIUM_BROWSER === Browser.FIREFOX) {
await onboardingMetricsFlow(driver, {
participateInMetaMetrics,
dataCollectionForMarketing,
});
}

const startOnboardingPage = new StartOnboardingPage(driver);
await startOnboardingPage.check_pageIsLoaded();
await startOnboardingPage.checkTermsCheckbox();
await startOnboardingPage.clickCreateWalletButton();

const onboardingMetricsPage = new OnboardingMetricsPage(driver);
await onboardingMetricsPage.check_pageIsLoaded();
if (dataCollectionForMarketing) {
await onboardingMetricsPage.clickDataCollectionForMarketingCheckbox();
}
if (participateInMetaMetrics) {
await onboardingMetricsPage.clickIAgreeButton();
} else {
await onboardingMetricsPage.clickNoThanksButton();
if (process.env.SELENIUM_BROWSER !== Browser.FIREFOX) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comes from hotfix f57f142

await onboardingMetricsFlow(driver, {
participateInMetaMetrics,
dataCollectionForMarketing,
});
}

const onboardingPasswordPage = new OnboardingPasswordPage(driver);
Expand All @@ -113,6 +122,30 @@ export const incompleteCreateNewWalletOnboardingFlow = async ({
await secureWalletPage.revealAndDoNotConfirmSRP();
};

/**
* Handle the onboarding metrics page flow
*
* @param driver - The WebDriver instance to control the browser
* @param options - The options object
* @param [options.participateInMetaMetrics] - Whether to participate in MetaMetrics. Defaults to false
* @param [options.dataCollectionForMarketing] - Whether to opt in to data collection for marketing. Defaults to false
*/
export async function onboardingMetricsFlow(
driver: Driver,
{ participateInMetaMetrics = false, dataCollectionForMarketing = false } = {},
) {
const onboardingMetricsPage = new OnboardingMetricsPage(driver);
await onboardingMetricsPage.check_pageIsLoaded();
if (dataCollectionForMarketing) {
await onboardingMetricsPage.clickDataCollectionForMarketingCheckbox();
}
if (participateInMetaMetrics) {
await onboardingMetricsPage.clickIAgreeButton();
} else {
await onboardingMetricsPage.clickNoThanksButton();
}
}

/**
* Import SRP onboarding flow
*
Expand Down Expand Up @@ -143,20 +176,23 @@ export const importSRPOnboardingFlow = async ({
console.log('Starting the import of SRP onboarding flow');
await driver.navigate();

if (process.env.SELENIUM_BROWSER === Browser.FIREFOX) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comes from hotfix f57f142

await onboardingMetricsFlow(driver, {
participateInMetaMetrics,
dataCollectionForMarketing,
});
}

const startOnboardingPage = new StartOnboardingPage(driver);
await startOnboardingPage.check_pageIsLoaded();
await startOnboardingPage.checkTermsCheckbox();
await startOnboardingPage.clickImportWalletButton();

const onboardingMetricsPage = new OnboardingMetricsPage(driver);
await onboardingMetricsPage.check_pageIsLoaded();
if (dataCollectionForMarketing) {
await onboardingMetricsPage.clickDataCollectionForMarketingCheckbox();
}
if (participateInMetaMetrics) {
await onboardingMetricsPage.clickIAgreeButton();
} else {
await onboardingMetricsPage.clickNoThanksButton();
if (process.env.SELENIUM_BROWSER !== Browser.FIREFOX) {
await onboardingMetricsFlow(driver, {
participateInMetaMetrics,
dataCollectionForMarketing,
});
}

const onboardingSrpPage = new OnboardingSrpPage(driver);
Expand Down
4 changes: 4 additions & 0 deletions test/e2e/page-objects/pages/header-navbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ class HeaderNavbar {
console.log('Header navbar is loaded');
}

async clickAddressCopyButton(): Promise<void> {
await this.driver.clickElement(this.copyAddressButton);
}

async lockMetaMask(): Promise<void> {
await this.openThreeDotMenu();
await this.driver.clickElement(this.lockMetaMaskButton);
Expand Down
Loading
Loading