Upgrade to Playwright 1.61.1#381
Conversation
Ports Frame#expect to the 1.61 expect protocol: the command now resolves on a successful match and rejects with FrameExpectErrorDetails on mismatch/timeout (upstream microsoft/playwright#40801). Carry errorDetails on Playwright::Error and translate it back into the assertion result hash.
Adds the 1.61 WebStorage API: page.local_storage / page.session_storage expose the current origin's localStorage / sessionStorage via items, get_item, set_item, remove_item and clear, backed by the page channel's webStorage* commands. Registers WebStorage with the API generator and ports the upstream page-localstorage spec.
Adds the 1.61 WebAuthn API: browser_context.credentials exposes a virtual authenticator scoped to the context, with install, create, get and delete backed by the context channel's credentials* commands. Lets tests seed passkeys and answer navigator.credentials ceremonies without real hardware. Registers Credentials with the API generator, maps the class doc examples, and ports the upstream browsercontext-webauthn spec.
Exposes the 1.61 APIResponse fields: security_details returns the TLS certificate details for HTTPS responses (nil for plain HTTP) and server_addr returns the resolved IP address and port, both read from the fetch response initializer. Ports the upstream global-fetch specs covering these methods.
|
@kruppel is attempting to deploy a commit to the Yusuke Iwaki's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
|
||
| def log=(log) | ||
| return unless log | ||
| @raw_log = log |
There was a problem hiding this comment.
Not well captured in the release notes, but this upstream PR #40801 "chore: throw on Frame.expect / Page.expectScreenshot failure" motivated the Error changes.
Here's the difference in the expect protocol across the two versions:
Playwright 1.60.0 — the command returns the result:
export type FrameExpectResult = {
matches: boolean,
received?: { value?: SerializedValue, ariaSnapshot?: string },
timedOut?: boolean,
errorMessage?: string,
log?: string[],
};
// (no FrameExpectErrorDetails type exists)Playwright 1.61.1 — the result is gone; failure info moved to a reject-path type:
export type FrameExpectResult = void; // ← resolves with NOTHING on a match
export type FrameExpectErrorDetails = { // ← NEW; sent on the error/reject path
received?: { value?: SerializedValue, ariaSnapshot?: string },
timedOut?: boolean,
customErrorMessage?: string,
};In 1.60, the Ruby client read result['matches'] / ['received'] / ['log'] off the return value. In 1.61, since the command returns void, assertions break as the expect call comes back as {"id":7} (no result), and raises undefined method 'key?' for nil at frame.rb:738.
To resolve the failing test:
detailscarries the newFrameExpectErrorDetails(received/timedOut/customErrorMessage), which now only exists on the error path.raw_logreplaces the oldFrameExpectResult.logfield (the call-log array), which likewise moved off the result and onto the error's wirelog.
Summary
Upgrade playwright-ruby to Playwright 1.61.1.
Client Changes
Page#local_storage/#session_storage: WebStorage APIBrowserContext#credentials: WebAuthn virtual authenticatorAPIResponse#security_details/#server_addr: TLS cert details and resolved IP/portDriver Changes
expectcommand now resolves on successful match and rejects withFrameExpectErrorDetailson mismatch/timeoutresult['received']to catching::Playwright::Errorexceptions{ 'matches' => !is_not }on success, extracts error details on failureisNotflag and error details from server