✅ improve E2E test reliability on BrowserStack#4494
Merged
BenoitZugmeyer merged 3 commits intomainfrom Apr 16, 2026
Merged
Conversation
In BrowserStack, the browser runs remotely and the round-trip latency to the test server can be significant. A fixed idle wait duration may not be sufficient to catch all in-flight requests. We now measure the latency once per worker before tests run and use `Math.max(500, latency * 1.5)` as the idle wait duration.
…avicon requests - waitForServersIdle() now waits idleWaitDuration ms before checking idle state, so in-flight browser requests have time to reach the server before idle is declared - replace /ok?duration=200 with a dedicated /flush route that delays 200ms and returns HTML with an empty favicon, preventing spurious favicon requests during event flushing - skip teardown flushEvents() when already on /flush to avoid redundant work - add empty favicon link to all test pages to suppress /favicon.ico requests
Bundles Sizes Evolution
🚀 CPU Performance
🧠 Memory Performance
|
🎉 All green!❄️ No new flaky tests detected 🎯 Code Coverage (details) 🔗 Commit SHA: 6ad6464 | Docs | Datadog PR Page | Was this helpful? React with 👍/👎 or give us feedback! |
e2e:bs reliability
thomas-lebeau
approved these changes
Apr 16, 2026
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
E2E tests running on BrowserStack have been flaky due to high network latency between the remote browser and the local test server. Several issues compounded this:
waitForServersIdle()to return before all requests had arrivedwaitForServersIdle()was called, making it return immediately despite pending network activity/favicon.icorequests that added noise to server idle trackingChanges
Math.max(500, latency * 1.5)as the idle wait durationwaitForServersIdle()now waitsidleWaitDurationms upfront to let in-flight requests arrive before checking idle state/flushroute (replaces/ok?duration=200) that delays 200ms and returns HTML — used when navigating away to flush SDK events, including session replay Web Worker segments/favicon.icorequests by embedding an empty favicon in all test pagesflushEvents()in teardown when the page is already on/flushTest instructions
Run the E2E tests on BrowserStack and verify that previously flaky tests pass consistently.
Checklist