Skip to content

fix(ci): Reduce flakiness of Replay integration tests #6823

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

Merged
merged 10 commits into from
Jan 18, 2023

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Jan 17, 2023

This PR replaces a bunch of page.waitForTimeout calls with page.waitForRequest waits which should make Replay integration tests more stable. I couldn't remove all timeout calls, as we're not always actually waiting for a request but the ones that failed mostly in CI are now gone.

When relying on outgoing http requests during a test, we should try to be as specific as possible in terms of which request we're actually expecting when. Therefore, I added a waitForReplayRequest, which ensures we're actually waiting for a replay request. Optionally, this helper takes a segmentId to wait for a replay request of a specific replay segment. This might be useful for more involved testing scenarios.

closes #6800

@Lms24 Lms24 requested a review from mydea January 17, 2023 14:35
@@ -24,7 +24,7 @@ sentryTest('sampling', async ({ getLocalTestPath, page }) => {
await page.goto(url);

await page.click('button');
await page.waitForTimeout(200);
await page.waitForTimeout(500);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just as a precaution, let's increase this timeout here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the timeout here waiting for?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm good point actually :D My first intention was to remove flakiness, hence increase the timeout but it seems as if locally I don't need any timeout here. Removed it, let's see if CI agrees 😅

@github-actions
Copy link
Contributor

github-actions bot commented Jan 17, 2023

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.82 KB (+0.01% 🔺)
@sentry/browser - ES5 CDN Bundle (minified) 61.47 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.5 KB (+0.02% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 54.77 KB (0%)
@sentry/browser - Webpack (gzipped + minified) 20.21 KB (0%)
@sentry/browser - Webpack (minified) 66.17 KB (0%)
@sentry/react - Webpack (gzipped + minified) 20.24 KB (0%)
@sentry/nextjs Client - Webpack (gzipped + minified) 47.48 KB (0%)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 26.74 KB (+0.01% 🔺)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 25.03 KB (+0.02% 🔺)
@sentry/replay ES6 CDN Bundle (gzipped + minified) 43.12 KB (-0.83% 🔽)
@sentry/replay - Webpack (gzipped + minified) 37.83 KB (-1.01% 🔽)
@sentry/browser + @sentry/tracing + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 60.37 KB (-0.6% 🔽)

@Lms24 Lms24 force-pushed the lms-fix-replay-flakes branch from e9dcc90 to f5f35ec Compare January 17, 2023 15:45
@Lms24 Lms24 force-pushed the lms-fix-replay-flakes branch from dd82301 to 8a2f4bc Compare January 18, 2023 11:06
@Lms24 Lms24 requested a review from billyvg January 18, 2023 11:34
Copy link
Member

@billyvg billyvg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me

@@ -24,7 +24,7 @@ sentryTest('sampling', async ({ getLocalTestPath, page }) => {
await page.goto(url);

await page.click('button');
await page.waitForTimeout(200);
await page.waitForTimeout(500);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the timeout here waiting for?

Comment on lines +31 to +32
// This waitForTimeout call should be okay, as we're not checking for any
// further network requests afterwards.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The below is DEFAULT_FLUSH_MAX_DELAY + 1?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the idea here is just to wait for a flush cycle to ensure that nothing is sent anymore after the 400 response. Can't really use the constant here as it is not exported from the replay package. But I can add another constant here

@Lms24 Lms24 merged commit 4b1bc47 into master Jan 18, 2023
@Lms24 Lms24 deleted the lms-fix-replay-flakes branch January 18, 2023 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Flaky CI]: Browser Integration Tests (Replay)
2 participants