Repository navigation
chore(playwright): upgrade to playwright v1.62.1 - #249
ruifigueira wants to merge 3 commits into
Conversation
The output path globs in vite.config.ts use `**`, which picomatch does not match against dot directories by default. In a checkout under a path such as ~/.herdr/worktrees/..., no glob matched, every module kept its source path (lib/submodules/..., lib/packages/...), and test:pack failed because lib/playwright-cloudflare/package.json.js did not exist. Set `dot: true`. beep-boop-🤖
Move submodules/playwright from v1.58.2 to v1.62.1 (Chromium 145 -> 151).
v1.63.0 ships Chromium 153, which is ahead of Browser Run's Chrome 152.
Patch updates:
- Upstream moved server/utils to packages/utils. Move the createGuid and
SerializedFS zip hunks to utils/crypto.ts and utils/serializedFS.ts.
- chromium: connectOverCDP is now split into _connectOverCDPInternal and
_connectOverCDPImpl. Read ?persistent from the endpoint URL in the first
and pass it to the second. Keep the new noDefaults download option.
- crBrowser: close all pages after the new download cancel step.
- clientHelper: also wrap the new initScriptSourceWithExposedFunctions
output with the __name shim.
- channelOwner, localUtils, snapshotter: rebase onto the new zones and
progress APIs.
- package.ts (playwright-core and playwright) and registry: upstream now
requires package.json and browsers.json with a dynamic path. Make the
paths static, so the bundle includes the files.
- configLoader: skip the new require.resolve('playwright') call when
require.resolve does not exist (Workers).
- Drop the hunks that upstream made unnecessary: pageDispatcher (page.agent
is gone), harRecorder (HAR export now uses SerializedFS.zip), nodePlatform
(file removed) and util.ts (stack path constants removed).
Wrapper updates:
- browser-test-runtime: upstream removed the bundles/ folders and vendors
its npm dependencies through src/utilsBundle.ts. build_bundles.js now
builds utilsBundleImpl from that file, and builds jest-matcher-utils,
jest-message-util and @jest/expect-utils from jest sources for the new
inlined expect library.
- Add utils/vite-playwright.js for both vite configs: aliases for
@isomorphic, @utils, @protocol and @testIsomorphic, the vendored import
rewrite from upstream utils/build/build.js, a small coreBundle
replacement, and mocks matched by resolved file path. The build fails if
a mocked file no longer exists upstream.
- Move submodules/jest from v30.2.0 to v30.4.1, the version upstream pins.
The v30.2.0 sources import micromatch, which upstream no longer installs.
- Mock fsevents (chokidar) and keep readline external in the bundles.
- Define __dirname in the browser-test-runtime build. package.ts reads it
at module scope.
- Follow moved modules: inProcessFactory -> inprocess (use its playwright
instance), client/api -> one module per class, common/globals ->
globals, utils -> @isomorphic and @utils, zipBundle -> utilsBundle and
@utils/third_party/extractZip.
- TestWorker: replace recoverFromStepErrors with pauseOnError and
pauseAtEnd, and send empty planAnnotations to runTestGroup.
- wrapClientApis: add the new async APIs (page.ariaSnapshot,
locator.drop, tracing.startHar, browser.bind and others).
- internal.d.ts: declare isUnderTest instead of importing
playwright-core/lib/utils, which no longer exists.
- Remove the esmLoaderHost mock. Upstream removed the module.
beep-boop-🤖
|
💬 Approved with comments — The only change since the last review is a set of new test skips, each with its reason, and it adds no defects. One INFO and one SUGGESTION remain, and neither blocks merging. Findings: 1 info · 1 suggestion Not opened by the correctness review: 18 changed files it was meant to read
The decision is advisory: this comment never approves, blocks or requests changes on the pull request. 📖 AGENTS.md: 💬 1 suggestionOptional: add a short root AGENTS.md. Recommendation: 💬 Optional Nits
View full reviewThe repository has no root AGENTS.md or CLAUDE.md. A short guide could list the build and test commands and explain how to rebase 📋 Code Quality: 💬 1 infoThe new skipTests entries are fine. One earlier INFO about the mock resolver remains. Recommendation: 💬 Optional Nits
View full review
✅ All other checks passed🚀 Release: ✅ LGTMNo release issues found. Risk: low. 🔒 Security: ✅ LGTMNo security issues found. The change since the last review only adds test skip entries. ⚡ Performance: ✅ LGTMNo performance issues found. 📝 Documentation: ✅ LGTMNo documentation issues found in the changed files. The description of this pull request does not match the change; see the note in the summary. Reviewed commit: |
|
npm i https://pkg.pr.new/cloudflare/browser-run/@cloudflare/puppeteer@5d9068dcb52456311db43d6dcd9b71154c3da1a7Published by this workflow run. New pushes and reruns update this comment. |
|
npm i https://pkg.pr.new/cloudflare/browser-run/@cloudflare/playwright-mcp@5d9068dcb52456311db43d6dcd9b71154c3da1a7Published by this workflow run. New pushes and reruns update this comment. |
|
npm i https://pkg.pr.new/cloudflare/browser-run/@cloudflare/playwright@5d9068dcb52456311db43d6dcd9b71154c3da1a7Published by this workflow run. New pushes and reruns update this comment. |
b9151a0 to
c905210
Compare
- Upstream tests now import playwright-core through lib/coreBundle. Replace it with tests/src/server/coreBundle.ts, which provides the parts the tests use (iso, utils, server.deviceDescriptors, server.nullProgress, the trace helpers in tools) and a registry stub that reports that ffmpeg is not available. - Rewrite the npm imports of upstream sources to the utilsBundle exports of @cloudflare/playwright/internal. Export getPlaywrightVersion and getUserAgent from it, because the sources read package.json relative to __dirname. - Point @isomorphic and the other path aliases at their new location. - Add the new isFrozenWebkit fixture. - Expect steps: use zone.shortTitle like upstream (playwright/src/index.ts) and set the action group. The call log of an aborted expect now matches "Expect "toBeVisible" with timeout ...". - Use an expect timeout of 10000 ms, the same as the upstream library tests config. The aria snapshot error tests compare the call log. - TestServer: skip the tests that use the new setContent and waitForWebSocketConnectionRequest methods, like the other server methods that the Worker fixture does not support. Upstream v1.62 adds tests and removes about 40 service-mode skips, so tests that never ran before run now. New excluded files: - library/heap.spec.ts (uses node:inspector). - library/trace-viewer-scrub.spec.ts (trace viewer, like trace-viewer.spec.ts). - library/playwright-client.spec.ts (tests the Node.js client bundle and reads __dirname at module scope). New skipped tests, each with its reason in skipTests.ts: - file:// URLs, which Browser Run cannot open (6 tests, including the two capabilities video tests). - Large file uploads, which make the Worker throw (3 tests). - tracing "should not flush console events" (local artifacts folder). - WebP snapshot comparisons (WASM codec loaded from the file system). - debugger.spec.ts (needs test source locations). - workers "should support extra http headers" (pending waitForEvent rejects during teardown after server.waitForRequest skips the test). - emulate-media hover/pointer and page-evaluate "promise collected": new tests that pass with wrangler dev but fail against the deployed Worker. - Tests that also fail on main (v1.58) in the full suite: geolocation "should use context options for popup", page-add-locator-handler "should work", page-route "route.fulfill/continue should throw if called twice" and page-screenshot "should take fullPage screenshots during navigation". beep-boop-🤖
c905210 to
5d9068d
Compare
What kind of change does this PR introduce?
Dependency upgrade:
@cloudflare/playwrightmoves from upstream Playwright v1.58.2 to v1.62.1 (Chromium 145 to Chromium 151). Browser Run moves to Chrome 152. v1.62.1 is the latest Playwright release that does not go past Chrome 152. v1.63.0 ships Chromium 153.Did you add tests for your changes?
The upstream test suite runs in a Worker, and this PR updates that setup for v1.62.1:
playwright-core/lib/coreBundle. A small replacement intests/src/server/coreBundle.tsgives the parts that the tests use.isFrozenWebkit.zone.shortTitle, as upstream does, and the expect timeout is 10000 ms, as in the upstream library config.setContentandwaitForWebSocketConnectionRequestmethods.heap.spec.ts(usesnode:inspector),trace-viewer-scrub.spec.ts(trace viewer) andplaywright-client.spec.ts(Node.js client bundle).Upstream v1.62 adds tests and removes about 40 service-mode skips. Thus, tests that did not run before run with this upgrade. New skipped tests, each with its reason in
skipTests.ts:file://URLs, which Browser Run cannot open.tracing.spec.ts › should not flush console events, which reads the local artifacts folder.page.screenshot({ type: 'webp' })works.debugger.spec.tstests, which need test source locations.workers.spec.ts › should support extra http headers. The test server skips the test whilepage.waitForEvent('worker')is pending, and the pending wait fails during teardown. This test also fails onmain.page-emulate-media.spec.ts › should report hover and fine pointer for desktopandpage-evaluate.spec.ts › promise collected. These new tests pass withwrangler dev(local Chromium), but fail against the deployed test Worker. The hover result needs the--blink-settingsflags that Playwright gives when it launches a headless browser. The Browser Run team can examine this difference.main(v1.58) in the full suite:geolocation.spec.ts › should use context options for popup,page-add-locator-handler.spec.ts › should work,page-route.spec.ts › route.fulfill/route.continue should throw if called twiceandpage-screenshot.spec.ts › should take fullPage screenshots during navigation. The published main report and amainrun on 2026-10-28 show these failures.If relevant, did you update the documentation?
No. The documentation does not give the upstream version.
Summary
Upstream changed its source layout between v1.58 and v1.62. Utility code moved to the new
packages/utilsandpackages/isomorphicfolders. Thebundles/folders are gone, andsrc/utilsBundle.tsnow supplies the npm dependencies. Thus, the build changes are larger than the patch changes.The PR has three commits:
fix(playwright): the output path globs invite.config.tsdid not match dot directories. In a checkout under a path such as~/.herdr/..., thelib/layout was wrong andtest:packfailed.chore(playwright): the submodule,patches/playwright.patchand the build changes. The commit message lists each patch change and each wrapper change.test(playwright): the worker test changes.Patch changes:
chromium.ts(?persistenthandling after theconnectOverCDPsplit),crBrowser.ts,clientHelper.ts,channelOwner.ts,localUtils.tsandsnapshotter.ts.createGuidand the zip write topackages/utils.requirepaths forpackage.jsonandbrowsers.json, and a guard for the newrequire.resolvecall inconfigLoader.ts.pageDispatcher(page.agentis gone),harRecorder,nodePlatformandutil.ts.Build changes:
packages/browser-test-runtime/utils/vite-playwright.jsis new. Both vite configs use it for the new path aliases, for the vendored import rewrite from upstreamutils/build/build.js, and for module mocks. A mock now matches on the resolved file path. The build fails if upstream removes a mocked file.build_bundles.jsbuildsutilsBundleImplfrom upstreamutilsBundle.ts. It also builds the jest helpers that the new inlined expect library uses.submodules/jestmoves from v30.2.0 to v30.4.1, the version that upstream pins. The v30.2.0 sources importmicromatch, which upstream does not install.Does this PR introduce a breaking change?
The Cloudflare API does not change. Upstream v1.60 removed these deprecated APIs:
Locator.ariaRef().handleoption ofexposeBinding.loggeroption ofconnectandconnectOverCDP.videosPathandvideoSizecontext options. Workers do not support video.Other information
Local results:
check:patches,build,check:submodules,build:puppeteer,test:bundle,test:packandtest-typespass.wrangler devand one worker: 80 passed, 30 skipped, 1 failed. The failed test isguardrails.spec.ts, which also fails onmain(81 passed, 29 skipped, 1 failed). Upstream removed the six React and Vue selector smoke tests and tagged sixbrowsercontext-eventstests as smoke.wrangler devgives "Test context not initialized" errors onmainand on this branch. The test config notes that dev mode does not support parallel workers.CI results:
410unhealthy session,500and503on connect). A different set of tests failed in each run. A re-run of the failed job passes.The package version does not change. The release version is a separate decision. This PR recommends
1.4.0.Jira: BRAPI-1862
beep-boop-🤖