Skip to content

chore(playwright): upgrade to playwright v1.62.1 - #249

Open
ruifigueira wants to merge 3 commits into
mainfrom
rfigueira/upgrade-playwright-1.62.1
Open

ruifigueira wants to merge 3 commits into
mainfrom
rfigueira/upgrade-playwright-1.62.1

Conversation

@ruifigueira

@ruifigueira ruifigueira commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

What kind of change does this PR introduce?

Dependency upgrade: @cloudflare/playwright moves 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:

  • Upstream tests import playwright-core/lib/coreBundle. A small replacement in tests/src/server/coreBundle.ts gives the parts that the tests use.
  • New fixture: isFrozenWebkit.
  • Expect steps use zone.shortTitle, as upstream does, and the expect timeout is 10000 ms, as in the upstream library config.
  • The Worker test server skips the tests that use the new setContent and waitForWebSocketConnectionRequest methods.
  • New excluded files: heap.spec.ts (uses node:inspector), trace-viewer-scrub.spec.ts (trace viewer) and playwright-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:

  • Six tests that open file:// URLs, which Browser Run cannot open.
  • Three large file uploads, which make the Worker throw an exception.
  • tracing.spec.ts › should not flush console events, which reads the local artifacts folder.
  • Two WebP snapshot comparisons. The comparison loads a WASM codec from the file system. page.screenshot({ type: 'webp' }) works.
  • Two debugger.spec.ts tests, which need test source locations.
  • workers.spec.ts › should support extra http headers. The test server skips the test while page.waitForEvent('worker') is pending, and the pending wait fails during teardown. This test also fails on main.
  • page-emulate-media.spec.ts › should report hover and fine pointer for desktop and page-evaluate.spec.ts › promise collected. These new tests pass with wrangler dev (local Chromium), but fail against the deployed test Worker. The hover result needs the --blink-settings flags that Playwright gives when it launches a headless browser. The Browser Run team can examine this difference.
  • Tests that also fail on 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 twice and page-screenshot.spec.ts › should take fullPage screenshots during navigation. The published main report and a main run 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/utils and packages/isomorphic folders. The bundles/ folders are gone, and src/utilsBundle.ts now supplies the npm dependencies. Thus, the build changes are larger than the patch changes.

The PR has three commits:

  1. fix(playwright): the output path globs in vite.config.ts did not match dot directories. In a checkout under a path such as ~/.herdr/..., the lib/ layout was wrong and test:pack failed.
  2. chore(playwright): the submodule, patches/playwright.patch and the build changes. The commit message lists each patch change and each wrapper change.
  3. test(playwright): the worker test changes.

Patch changes:

  • Rebased hunks: chromium.ts (?persistent handling after the connectOverCDP split), crBrowser.ts, clientHelper.ts, channelOwner.ts, localUtils.ts and snapshotter.ts.
  • Moved hunks: createGuid and the zip write to packages/utils.
  • New hunks: static require paths for package.json and browsers.json, and a guard for the new require.resolve call in configLoader.ts.
  • Removed hunks, because upstream made them unnecessary: pageDispatcher (page.agent is gone), harRecorder, nodePlatform and util.ts.

Build changes:

  • packages/browser-test-runtime/utils/vite-playwright.js is new. Both vite configs use it for the new path aliases, for the vendored import rewrite from upstream utils/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.js builds utilsBundleImpl from upstream utilsBundle.ts. It also builds the jest helpers that the new inlined expect library uses.
  • submodules/jest moves from v30.2.0 to v30.4.1, the version that upstream pins. The v30.2.0 sources import micromatch, 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().
  • The handle option of exposeBinding.
  • The logger option of connect and connectOverCDP.
  • The videosPath and videoSize context options. Workers do not support video.

Other information

Local results:

  • check:patches, build, check:submodules, build:puppeteer, test:bundle, test:pack and test-types pass.
  • Smoke tests with wrangler dev and one worker: 80 passed, 30 skipped, 1 failed. The failed test is guardrails.spec.ts, which also fails on main (81 passed, 29 skipped, 1 failed). Upstream removed the six React and Vue selector smoke tests and tagged six browsercontext-events tests as smoke.
  • With six workers, wrangler dev gives "Test context not initialized" errors on main and on this branch. The test config notes that dev mode does not support parallel workers.

CI results:

  • The Playwright full suite passes.
  • On 2026-10-28, the full suites of both packages had one-off failures with Browser Run errors (410 unhealthy session, 500 and 503 on 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-🤖

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-🤖
@clanky-the-clanker

clanky-the-clanker Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

💬 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
  • packages/browser-test-runtime/package.json
  • packages/browser-test-runtime/src/index.ts
  • packages/browser-test-runtime/src/mocks/coreBundle.ts
  • packages/browser-test-runtime/src/mocks/transform.ts
  • packages/browser-test-runtime/src/state.ts
  • packages/browser-test-runtime/utils/build_bundles.js
  • packages/browser-test-runtime/vite.config.ts
  • packages/playwright-cloudflare/internal.d.ts
  • packages/playwright-cloudflare/src/cloudflare/wrapClientApis.ts
  • packages/playwright-cloudflare/src/index.ts
  • packages/playwright-cloudflare/src/internal.ts
  • packages/playwright-cloudflare/src/mocks/transform.ts
  • packages/playwright-cloudflare/tsconfig.json
  • packages/playwright-cloudflare/utils/generate_worker_tests.js
  • packages/playwright-cloudflare/vite.config.ts
  • patches/playwright.patch
  • submodules/jest
  • submodules/playwright

The decision is advisory: this comment never approves, blocks or requests changes on the pull request.


📖 AGENTS.md: 💬 1 suggestion

Optional: add a short root AGENTS.md.

Recommendation: 💬 Optional Nits

  • [SUGGESTION] Consider adding a short root AGENTS.md that lists the build and test commands and the steps for upgrading the Playwright submodule and patch.
View full review

The repository has no root AGENTS.md or CLAUDE.md. A short guide could list the build and test commands and explain how to rebase patches/playwright.patch onto a new upstream version. This is optional.


📋 Code Quality: 💬 1 info

The new skipTests entries are fine. One earlier INFO about the mock resolver remains.

Recommendation: 💬 Optional Nits

  • [INFO] playwrightModuleMocks only intercepts relative import specifiers, but its comment says mocks are matched by resolved file path. If a mocked module is imported through an alias or a bare specifier, the real module is bundled and no error is reported. (packages/browser-test-runtime/utils/vite-playwright.js:51)
View full review
  • packages/playwright-cloudflare/tests/src/skipTests.ts: every new skip entry has a comment that explains why the test cannot run against the remote browser or the bundled Worker. No defects.
  • Still open: playwrightModuleMocks in packages/browser-test-runtime/utils/vite-playwright.js:50-56 only intercepts relative import specifiers, but its comment says mocks are matched by resolved file path. If upstream imports a mocked module through an alias or a bare specifier, the build bundles the real module and reports no error. To fix it, resolve the import with this.resolve(source, importer, { skipSelf: true }) and compare the resolved id, or change the comment.

✅ All other checks passed

🚀 Release: ✅ LGTM

No release issues found. Risk: low.


🔒 Security: ✅ LGTM

No security issues found. The change since the last review only adds test skip entries.


⚡ Performance: ✅ LGTM

No performance issues found.


📝 Documentation: ✅ LGTM

No 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: 5d9068dc

@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

@cloudflare/puppeteer preview for commit 5d9068d

npm i https://pkg.pr.new/cloudflare/browser-run/@cloudflare/puppeteer@5d9068dcb52456311db43d6dcd9b71154c3da1a7

Published by this workflow run. New pushes and reruns update this comment.

@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

@cloudflare/playwright-mcp preview for commit 5d9068d

npm i https://pkg.pr.new/cloudflare/browser-run/@cloudflare/playwright-mcp@5d9068dcb52456311db43d6dcd9b71154c3da1a7

Published by this workflow run. New pushes and reruns update this comment.

@github-actions

github-actions Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

@cloudflare/playwright preview for commit 5d9068d

npm i https://pkg.pr.new/cloudflare/browser-run/@cloudflare/playwright@5d9068dcb52456311db43d6dcd9b71154c3da1a7

Published by this workflow run. New pushes and reruns update this comment.

@ruifigueira
ruifigueira force-pushed the rfigueira/upgrade-playwright-1.62.1 branch from b9151a0 to c905210 Compare October 28, 2026 12:13
- 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-🤖
@ruifigueira
ruifigueira force-pushed the rfigueira/upgrade-playwright-1.62.1 branch from c905210 to 5d9068d Compare October 28, 2026 22:19

This branch has not been deployed

No deployments
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.

1 participant