Skip to content

Commit d64c6b5

Browse files
authored
test(extension): fix tests for analytics (#1446)
1 parent d38eff3 commit d64c6b5

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

packages/e2e-tests/src/elements/onboarding/walletSetupPage.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ class WalletSetupPage extends CommonOnboardingElements {
119119
fillValues = false
120120
): Promise<void> {
121121
await recoveryPhrasePage.goToMnemonicVerificationPage(flowType, mnemonicWords, true);
122+
await recoveryPhrasePage.nextButton.waitForClickable();
122123
await recoveryPhrasePage.nextButton.click();
123124
if (fillValues) {
124125
await this.setWalletNameInput('TestAutomationWallet');

packages/e2e-tests/src/steps/analyticsSteps.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const validateEventProperty = async (event: string, property: string, pro
2626
When(/^I set up request interception for posthog analytics request\(s\)$/, async () => {
2727
await browser.pause(1000);
2828
await browser.setupInterceptor();
29-
await browser.excludeUrls([new RegExp('^(?!https://e.lw.iog.io).*')]);
29+
await browser.excludeUrls([new RegExp('^(?!https://e.lw.iog.io).*'), new RegExp('https://e.lw.iog.io/decide/')]);
3030
});
3131

3232
When(/^I validate latest analytics multiple events:$/, async (eventActionNames: DataTable) => {
@@ -76,23 +76,26 @@ When(/^I validate that alias event has assigned same user id "([^"]*)" in postho
7676
Then(/^I validate that event has correct properties$/, async () => {
7777
await browser.pause(2000);
7878
const actualEventPayload = await getLatestEventPayload();
79+
expect(actualEventPayload).to.haveOwnProperty('timestamp');
80+
expect(actualEventPayload).to.haveOwnProperty('uuid');
81+
expect(actualEventPayload).to.haveOwnProperty('event');
7982
const expectedProperties = [
8083
'$current_url',
8184
'$window_id',
8285
'$browser',
8386
'$browser_language',
8487
'$browser_version',
8588
'$device_type',
89+
'distinct_id',
8690
'$host',
8791
'$insert_id',
8892
'$lib',
8993
'$lib_version',
90-
'$lib_version',
9194
'$os',
9295
// '$os_version', it is not working for all os right now
93-
'$pageview_id',
9496
'posthog_project_id',
9597
'$pathname',
98+
'$raw_user_agent',
9699
'$referrer',
97100
'$referring_domain',
98101
'$screen_height',
@@ -101,12 +104,15 @@ Then(/^I validate that event has correct properties$/, async () => {
101104
'$viewport_height',
102105
'$viewport_width',
103106
'sent_at_local',
104-
'view'
107+
'view',
108+
'$active_feature_flags',
109+
'$initial_person_info',
110+
'title',
111+
'$prev_pageview_pathname'
105112
];
106113
for (const expectedProperty of expectedProperties) {
107-
expect(Object.prototype.hasOwnProperty.call(actualEventPayload.properties, expectedProperty)).to.be.true;
114+
expect(actualEventPayload.properties).to.haveOwnProperty(expectedProperty);
108115
}
109-
expect(Object.prototype.hasOwnProperty.call(actualEventPayload, 'timestamp')).to.be.true;
110116
});
111117

112118
Then(/^I validate that the event includes "([^"]*)" property$/, async (property: string) => {

0 commit comments

Comments
 (0)