Skip to content

test(network): wait for network idle before checking a failed XHR's error - #678

Merged
route merged 1 commit into
mainfrom
fix/flaky-response-error-spec
Oct 23, 2026
Merged

route merged 1 commit into
mainfrom
fix/flaky-response-error-spec

Conversation

@route

@route route commented Oct 23, 2026

Copy link
Copy Markdown
Member

`Network::Response#error captures errors` failed on main (run).

The page fires an XHR to `/unexist.png` and its `complete` callback changes the heading to "Done". An XHR doesn't delay the load event, so `go_to` can return while the request is still pending. The CDP log from the failed run shows exactly that: `frameStoppedLoading` came 4 ms after the XHR started, `at_xpath` returned `null`, and only then did the 404 headers arrive.

The spec now waits for the network to go idle and asserts on the exchange error directly. The "Done" heading check was only there to sync on the request, and it still raced with the JS callback, so it's removed.

@route
route merged commit 080587c into main Oct 23, 2026
6 checks passed
@route
route deleted the fix/flaky-response-error-spec branch October 23, 2026 18:31
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.

1 participant