-
-
Notifications
You must be signed in to change notification settings - Fork 359
fix(ci): Fix Sample Application E2E test flakiness #5755
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
eeeb420
564e323
85ece95
19770a2
2101a2c
73bdf0c
9112cb8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,12 @@ | ||
| import { spawn } from 'node:child_process'; | ||
| import path from 'node:path'; | ||
|
|
||
| const MAX_RETRIES = 3; | ||
|
|
||
| /** | ||
| * Run a Maestro test and return a promise that resolves when the test is finished. | ||
| * | ||
| * @param test - The path to the Maestro test file relative to the `e2e` directory. | ||
| * @returns A promise that resolves when the test is finished. | ||
| * Run a single Maestro test attempt. | ||
| */ | ||
| export const maestro = async (test: string) => { | ||
| const runMaestro = (test: string): Promise<void> => { | ||
| return new Promise((resolve, reject) => { | ||
| const process = spawn('maestro', ['test', test, '--format', 'junit'], { | ||
| cwd: path.join(__dirname, '..'), | ||
|
|
@@ -22,3 +21,29 @@ export const maestro = async (test: string) => { | |
| }); | ||
| }); | ||
| }; | ||
|
|
||
| /** | ||
| * Run a Maestro test with retries to handle transient app crashes on slow CI VMs. | ||
| * | ||
| * Note: Retries happen at the Maestro flow level. If a failed attempt sends partial | ||
| * envelopes to the mock server before crashing, they will accumulate across retries. | ||
| * In practice, crashes occur on app launch before any SDK transactions are sent, | ||
| * so this does not cause issues with test assertions. | ||
| * | ||
| * @param test - The path to the Maestro test file relative to the `e2e` directory. | ||
| * @returns A promise that resolves when the test passes. | ||
| */ | ||
| export const maestro = async (test: string) => { | ||
| for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) { | ||
| try { | ||
| await runMaestro(test); | ||
| return; | ||
| } catch (error) { | ||
| if (attempt < MAX_RETRIES) { | ||
| console.warn(`Maestro attempt ${attempt}/${MAX_RETRIES} failed, retrying...`); | ||
| } else { | ||
| throw error; | ||
| } | ||
| } | ||
| } | ||
| }; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Retry mechanism causes envelope contamination across attemptsMedium Severity The new Additional Locations (1) |
||


Uh oh!
There was an error while loading. Please reload this page.