-
-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(e2e): Converting cy to pw general.test.ts (#15882)
* feat(e2e): Converting cy to pw general.test.ts * fix(e2e): Adds retry mechanism for dropdown options in setting tests * feat(e2e): Start attaching electron traces to the report * feat(e2e): Electron test videos are not added to reports
- Loading branch information
Showing
9 changed files
with
237 additions
and
152 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
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 { Page } from '@playwright/test'; | ||
|
||
import { SuiteAnalyticsEvent } from '@trezor/suite-analytics'; | ||
import { Requests, EventPayload } from '@trezor/suite-web/e2e/support/types'; | ||
import { urlSearchParams } from '@trezor/suite/src/utils/suite/metadata'; | ||
|
||
export class AnalyticsFixture { | ||
private window: Page; | ||
requests: Requests = []; | ||
|
||
constructor(window: Page) { | ||
this.window = window; | ||
} | ||
|
||
//TODO: #15811 To be refactored | ||
findAnalyticsEventByType = <T extends SuiteAnalyticsEvent>(eventType: T['type']) => { | ||
const event = this.requests.find(req => req.c_type === eventType) as EventPayload<T>; | ||
|
||
if (!event) { | ||
throw new Error(`Event with type ${eventType} not found.`); | ||
} | ||
|
||
return event; | ||
}; | ||
|
||
//TODO: #15811 To be refactored | ||
async interceptAnalytics() { | ||
await this.window.route('**://data.trezor.io/suite/log/**', route => { | ||
const url = route.request().url(); | ||
const params = urlSearchParams(url); | ||
this.requests.push(params); | ||
route.continue(); | ||
}); | ||
} | ||
} |
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
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
Oops, something went wrong.