chore: throw on Frame.expect / Page.expectScreenshot failure#40801
Open
dgozman wants to merge 3 commits into
Open
chore: throw on Frame.expect / Page.expectScreenshot failure#40801dgozman wants to merge 3 commits into
dgozman wants to merge 3 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
pavelfeldman
approved these changes
May 14, 2026
Frame.expect and Page.expectScreenshot now throw on mismatch with strongly-typed errorDetails on the wire instead of returning a result object. Frame.expect no longer carries a protocol return value; failure details (received, timedOut, customErrorMessage) travel in a FrameExpectErrorDetails payload next to the response error, and the client rebuilds the matcher's ExpectResult from the rejected PlaywrightError.
Page.expectScreenshot throws a fixed 'Expect failed' placeholder and puts the human-readable text in errorDetails.customErrorMessage, so the matcher's errorMessage no longer picks up the apiName prefix and call log from the wire error.
2859430 to
e181e0f
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Validate ErrorDetails unconditionally on the client (with {} fallback)
and wrap expectScreenshot pre-check failures so they surface as typed
matcher errors instead of escaping as raw rejections.
Contributor
Test results for "tests 1"2 flaky42017 passed, 850 skipped Merge workflow run. |
Contributor
Test results for "MCP"1 failed 7115 passed, 1113 skipped Merge workflow run. |
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.
Summary
Frame.expectandPage.expectScreenshotthrow on failure instead of returning the diff payload. Failure details ride on a new per-methoderrorDetails:block in protocol.yml; the dispatcher always sendserrorDetails(validated against the schema, defaulting to{}) for any method that defines one, so its presence on the wire is the matcher-error discriminator.noAutoWaitingoption onFrame.expectis gone, which lets the one-shot/retry blocks stop threading the wrapper error through internal catches.Error:when surfacing them aserrorMessage. YAML parse errors and JS-error/strict-mode messages now end up with the same shape inside the matcher's failure header.