Skip to content

Commit

Permalink
feat: add e2e test for wallet created events during imported account …
Browse files Browse the repository at this point in the history
…onboarding
  • Loading branch information
cmd-ob committed Feb 17, 2025
1 parent b24058e commit 121c24e
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions test/e2e/tests/metrics/wallet-imported.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { strict as assert } from 'assert';
import { Mockttp } from 'mockttp';
import { getEventPayloads, withFixtures } from '../../helpers';
import FixtureBuilder from '../../fixture-builder';
import { completeImportSRPOnboardingFlow } from '../../page-objects/flows/onboarding.flow';
import { mockSegment } from './mocks/segment';

describe('Wallet Created Events - Imported Account', function () {
it('are sent when onboarding user who chooses to opt in metrics', async function () {
await withFixtures(
{
fixtures: new FixtureBuilder({ onboarding: true })
.withMetaMetricsController({
participateInMetaMetrics: true,
})
.build(),
title: this.test?.fullTitle(),
testSpecificMock: async (server: Mockttp) => {
return await mockSegment(server, [
'Wallet Setup Selected',
'Wallet Setup Complete',
'Wallet Created',
]);
},
},
async ({ driver, mockedEndpoint: mockedEndpoints }) => {
await completeImportSRPOnboardingFlow({
driver,
participateInMetaMetrics: true,
});

const events = await getEventPayloads(driver, mockedEndpoints);

assert.equal(events.length, 3);

assert.deepStrictEqual(events[0].properties, {
account_type: 'imported',
category: 'Onboarding',
locale: 'en',
chain_id: '0x539',
environment_type: 'fullscreen',
});

assert.deepStrictEqual(events[1].properties, {
wallet_setup_type: 'import',
new_wallet: false,
category: 'Onboarding',
locale: 'en',
chain_id: '0x539',
environment_type: 'fullscreen',
});

assert.deepStrictEqual(events[2].properties, {
method: 'import',
is_profile_syncing_enabled: true,
category: 'Onboarding',
locale: 'en',
chain_id: '0x539',
environment_type: 'fullscreen',
});
},
);
});
});

0 comments on commit 121c24e

Please sign in to comment.