Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(extension): lw-4700 analytics interception spike
- Loading branch information
Showing
7 changed files
with
81 additions
and
3 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
33 changes: 33 additions & 0 deletions
33
packages/e2e-tests/src/features/analytics/AnalyticsSendTransactionGoal.feature
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,33 @@ | ||
@SendSimpleTransaction-Extended-E2E @Testnet | ||
Feature: Analytics | ||
|
||
Background: | ||
Given Wallet is synced | ||
|
||
@wip | ||
Scenario: Extended View - Send transaction goal event analytics | ||
And I set up request interception for 5 matomo analytics request(s) | ||
And I click "Send" button on page header | ||
And I validate latest analytics request(s) information: | ||
| Event Category | Event Action | Event Name | | ||
| send-transaction | click-event | send-tx-button-browser | | ||
And I fill bundle 1 with "WalletReceiveSimpleTransactionE2E" address with following assets: | ||
| type | assetName | ticker | amount | | ||
| ADA | Cardano | tADA | 1.1234 | | ||
And I click "Review transaction" button on "Send" page | ||
And I validate latest analytics request(s) information: | ||
| Event Category | Event Action | Event Name | | ||
| send-transaction | click-event | review-tx-details-browser | | ||
And I click "Confirm" button on "Transaction summary" page | ||
And I validate latest analytics request(s) information: | ||
| Event Category | Event Action | Event Name | | ||
| send-transaction | click-event | confirm-tx-details-browser | | ||
And I fill correct password and confirm | ||
And I validate latest analytics request(s) information: | ||
| Event Category | Event Action | Event Name | | ||
| send-transaction | click-event | input-tx-password-browser | | ||
| send-transaction | click-event | tx-success-browser | | ||
Then I validate existence and number of expected analytics request(s) | ||
|
||
|
||
|
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
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,35 @@ | ||
import { DataTable, When } from '@cucumber/cucumber'; | ||
import { URLSearchParams } from 'url'; | ||
import { expect } from 'chai'; | ||
import { browser } from '@wdio/globals'; | ||
|
||
export const getRequestInLatestOrderParams = async (requestIndexInLatestOrder: number): Promise<URLSearchParams> => { | ||
const requests = await browser.getRequests({ includePending: true, orderBy: 'START' }); | ||
const decodedLatestRequestUrl = decodeURIComponent(requests[requests.length - 1 - requestIndexInLatestOrder].url); | ||
return new URLSearchParams(decodedLatestRequestUrl.split('?')[1]); | ||
}; | ||
|
||
When(/^I set up request interception for (\d) matomo analytics request\(s\)$/, async (numberOfRequest: number) => { | ||
await browser.setupInterceptor(); | ||
await browser.excludeUrls([new RegExp('^(?!https://matomo).*')]); | ||
for (let i = 0; i < numberOfRequest; i++) { | ||
await browser.expectRequest('GET', new RegExp('^https://matomo.*'), 200); | ||
} | ||
}); | ||
|
||
When(/^I validate latest analytics request\(s\) information:$/, async (eventInfo: DataTable) => { | ||
await browser.pause(1000); | ||
for (let i = 0; i < eventInfo.rows().length; i++) { | ||
const requestIndexInLatestOrder = eventInfo.rows().length - 1 - i; | ||
const actualEventInfo = await getRequestInLatestOrderParams(requestIndexInLatestOrder); | ||
const [expectedEventCategory, expectedEventAction, expectedEventName] = eventInfo.rows()[i]; | ||
expect(actualEventInfo.get('e_c')).to.equal(expectedEventCategory); | ||
expect(actualEventInfo.get('e_a')).to.equal(expectedEventAction); | ||
expect(actualEventInfo.get('e_n')).to.equal(expectedEventName); | ||
} | ||
}); | ||
|
||
When(/^I validate existence and number of expected analytics request\(s\)$/, async () => { | ||
await browser.assertRequests(); | ||
await browser.disableInterceptor(); | ||
}); |
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
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
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