-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add e2e test for wallet created events during imported account …
…onboarding
- Loading branch information
Showing
1 changed file
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
}); | ||
}, | ||
); | ||
}); | ||
}); |