Skip to content

chore: throw on Frame.expect / Page.expectScreenshot failure#40801

Open
dgozman wants to merge 3 commits into
microsoft:mainfrom
dgozman:chore-expect-throws
Open

chore: throw on Frame.expect / Page.expectScreenshot failure#40801
dgozman wants to merge 3 commits into
microsoft:mainfrom
dgozman:chore-expect-throws

Conversation

@dgozman
Copy link
Copy Markdown
Collaborator

@dgozman dgozman commented May 12, 2026

Summary

  • Frame.expect and Page.expectScreenshot throw on failure instead of returning the diff payload. Failure details ride on a new per-method errorDetails: block in protocol.yml; the dispatcher always sends errorDetails (validated against the schema, defaulting to {}) for any method that defines one, so its presence on the wire is the matcher-error discriminator.
  • The unused noAutoWaiting option on Frame.expect is gone, which lets the one-shot/retry blocks stop threading the wrapper error through internal catches.
  • Server emits bare messages; the client uniformly prefixes Error: when surfacing them as errorMessage. YAML parse errors and JS-error/strict-mode messages now end up with the same shape inside the matcher's failure header.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Comment thread packages/playwright-core/src/client/frame.ts
Comment thread packages/playwright-core/src/client/frame.ts
Comment thread packages/playwright-core/src/client/page.ts
Comment thread packages/protocol/spec/frame.yml Outdated
dgozman added 2 commits May 18, 2026 15:11
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.
@dgozman dgozman force-pushed the chore-expect-throws branch from 2859430 to e181e0f Compare May 18, 2026 15:07
@github-actions

This comment has been minimized.

@github-actions

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.
@github-actions
Copy link
Copy Markdown
Contributor

Test results for "tests 1"

2 flaky ⚠️ [chromium-library] › library/popup.spec.ts:261 › should not throw when click closes popup `@chromium-ubuntu-22.04-node24`
⚠️ [firefox-library] › library/inspector/cli-codegen-3.spec.ts:224 › cli codegen › should generate frame locators (4) `@firefox-ubuntu-22.04-node20`

42017 passed, 850 skipped


Merge workflow run.

@github-actions
Copy link
Copy Markdown
Contributor

Test results for "MCP"

1 failed
❌ [msedge] › mcp/annotate.spec.ts:273 › should enter annotate mode on fresh dashboard.tsx mount with -s --annotate @mcp-windows-latest-msedge

7115 passed, 1113 skipped


Merge workflow run.

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.

2 participants