fix(expect): honor timeout when the page is unresponsive - #42881
Closed
Dmitry Munda (dimkin-eu) wants to merge 1 commit into
Closed
Dmitry Munda (dimkin-eu) wants to merge 1 commit into
Dmitry Munda (dimkin-eu) wants to merge 1 commit into
Conversation
The one-shot expect check is allowed to finish after the deadline, so that
`expect(locator).toBeVisible({ timeout: 1 })` passes when the element is
already visible. It was not bounded at all, though: when the page's event
loop was blocked, the call hung until the test timeout and reported
`Received: undefined` instead of a timeout. Give the one-shot a short grace
period after the call is aborted, then fail with the regular timeout error.
Fixes microsoft#42880
Contributor
Test results for "tests 1"5 flaky51208 passed, 1234 skipped Merge workflow run. |
Contributor
Test results for "MCP"8705 passed, 1474 skipped Merge workflow run. |
Collaborator
|
I am not sure we want this. The issue is a rare outlier, I'd prefer to keep things as is for now, until we see this is a common enough usecase. Thank you for the PR. |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The one-shot expect check runs without a timeout so that
expect(locator).toBeVisible({ timeout: 1 })still passes when the element is already visible. It was not bounded at all, so when the page's event loop was blocked the call hung until the test timeout and reportedReceived: undefined.This races the one-shot against the call's abort signal with a short grace period (1s): tiny timeouts keep working on responsive pages, and an unresponsive page now fails with the regular timeout error. Same class of fix as #40901 for screenshots.
Fixes #42880