-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Chore/master sync 12.16.2 #32348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chore/master sync 12.16.2 #32348
Changes from all commits
27d28c4
f57f142
9000b66
f2e26fc
09ceb74
2ac078c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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: { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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: { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 () => { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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( | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 () => { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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: { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 = { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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; | ||
|
|
@@ -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(() => { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) { | ||
|
|
||
| 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'; | ||
|
|
@@ -36,20 +37,24 @@ export const createNewWalletOnboardingFlow = async ({ | |
| if (needNavigateToNewPage) { | ||
| await driver.navigate(); | ||
| } | ||
|
|
||
| if (process.env.SELENIUM_BROWSER === Browser.FIREFOX) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
|
|
@@ -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) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
|
|
@@ -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 | ||
| * | ||
|
|
@@ -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) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comes from hotfix: f57f142