Roll to Playwright v1.60.0#1
Open
nczz wants to merge 14 commits into
Open
Conversation
- Update Playwright driver to v1.59.1 - Chromium 147.0.7727.15, Firefox 148.0.2, WebKit 26.4 - Add Browser.Bind/Unbind (startServer/stopServer protocol) - Add BrowserContext.Debugger, IsClosed, SetStorageState - Add Page.AriaSnapshot, Screencast, ClearConsoleMessages, ClearPageErrors, PageErrors - Add CDPSession.OnClose, ConsoleMessage.Timestamp, Response.HttpVersion - Add Request.ExistingResponse, Locator.Normalize, Locator.Description - Add Debugger class (event-based PausedDetails) - Add Screencast class (client-side wrapper for screencast commands) - Add Disposable to objectFactory (driver sends but Go doesn't expose) - Fix Connect protocol: wsEndpoint -> endpoint - Fix video: artifact from page initializer (no longer event-based) - Fix skipFieldSerialization: handle nil Func types - Patch fixes: add Go to route.url, unroute.url, routeWebSocket.url, waitForURL, pageErrors, Description langs - Generator fixes: Disposable->void, Promise->void in func returns, FilePayload union->any, void event handler BREAKING CHANGE: RecordVideo.Dir changed from string to *string (generated from protocol, dir is now optional in PW 1.59)
The BrowserContext channel does not emit pageclose/frameattached/ framedetached/framenavigated/pageload/weberror/download events, so the handlers registered on bt.channel for those names never fired and the new OnDownload/OnPageClose/OnPageLoad/OnFrameAttached/OnFrameDetached/ OnFrameNavigated accessors were dead (verified: context.OnDownload never fired while page.OnDownload did). Mirror the upstream Playwright client, which derives these context-level events from the owning Page/Frame, and forward them to the context from page.go/frame.go. weberror is already emitted by the existing pageError handler (which also avoids the unguarded *pageImpl assertion panic on a nil page), so the duplicate weberror channel handler is removed. Align OnPageLoad with the upstream 'pageload' event name. Add ported tests from upstream browsercontext-events.spec.ts covering pageload, framenavigated, pageclose, frameattached, framedetached and download context events.
The previous implementation called the non-existent protocol methods Tracing.tracingStartHar / Tracing.tracingStopHar, which failed at runtime with 'Unknown scheme for Params: Tracing.tracingStartHar'. Reimplement to mirror the upstream client's _recordIntoHAR/_exportHAR: StartHar sends harStart (with embed/attach defaults based on the .zip extension) and records the harId; StopHar exports via harExport, zipping locally or saving+unzipping the artifact for remote connections, matching the existing BrowserContext HAR export logic. Add ported tests from upstream har.spec.ts (HAR with minimal mode + urlFilter, zipped HAR, and the not-started guard). Also switch the new context-event tests off deprecated page.Click / page.WaitForSelector to satisfy the staticcheck lint gate.
…t.ExistingResponse
Three runtime bugs in newly-added v1.60 APIs, each verified with a test:
- Locator.Drop sent raw 'files'/'data' fields. The protocol expects
files converted to payloads/localPaths/streams (via convertInputFiles)
and data as an array of {mimeType, value} entries, plus a required
timeout. Without this the call failed with 'data: expected array, got
object' / 'timeout: expected float, got undefined'.
- PageAssertions.ToMatchAriaSnapshot used the expect expression
'to.match.aria.snapshot'; the server expects 'to.match.aria' (matching
the existing Locator variant). Every assertion failed regardless of
input.
- Request.ExistingResponse relied on a 'hasResponse' initializer field
that the protocol never sends, so it always returned nil. Mirror
upstream by caching the Response on its Request when the Response is
constructed.
Add ported/targeted tests: TestLocatorDrop, TestPageAssertionsToMatchAriaSnapshot,
TestRequestExistingResponse.
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.
Roll playwright-go to Playwright v1.60.0.
Runtime alignment
artifactvsentriesresults and local.zipexport compression.recordHarOptionsserialization with the v1.60 protocol field name.WebSocketRouteclose/connect forwarding behavior with upstream Playwright client semantics.Test alignment and stabilization
TestMouseWheelto move the mouse before wheel input, matching upstream Playwright 1.60page/wheel.spec.ts.Verification
Local verification run before the latest push:
BROWSER=webkit go test -run '^(TestBrowserContextWindowOpenshouldUseParentTabContext|TestPageEventShouldHaveURL|TestBrowserContextEventsRequest|TestBrowserContextEventsResponse|TestDialogEventShouldWorkInImmdiatelyClosedPopup|TestDialogShouldWorkInPopup|TestPageExpectPopup|TestPageOpener|TestPageClockPopup|TestMouseWheel)$' -count=1 -race -timeout 120s -v ./testsBROWSER=webkit go test -timeout 15m -v -coverprofile=covprofile -coverpkg="github.com/playwright-community/playwright-go" --race ./...go test -count=1 -timeout 15m -v -coverprofile=covprofile -coverpkg="github.com/playwright-community/playwright-go" --race ./...Known limitation
WebKit on GitHub macOS currently closes the browser while opening several popup cases, which can cascade into unrelated failures. The PR isolates only those popup tests behind
isWebKit && runtime.GOOS == "darwin"; non-WebKit and non-macOS coverage still runs.