Automation
Playwright 1.65 (1.65.0–1.65.2): Bun Runner, Node.js 22+ Floor, and Fixing All 10 Breaking CI Changes
Playwright 1.65 (1.65.0 through 1.65.2) introduces Bun test-runner execution, a Node.js 22+ floor, Chromium 158/159, and 10 breaking changes that surface hidden flakiness in page objects, inert elements, sharded runs, and ARIA snapshots. Here is every verified change and its CI fix.
8 min read
Playwright 1.65 (1.65.0–1.65.2): Bun Runner, Node.js 22+ Floor, and Fixing All 10 Breaking CI Changes
Executive Summary
- Runtime floor & Docker shift: Starting with Playwright 1.65 (
v1.65.0released November 5, 2026;v1.65.1on November 13;v1.65.2noted December 1–2 with Chromium 158/159, Firefox 159.0, and WebKit 27.2), Playwright no longer tests on Node.js 20—requiring Node.js 22, 24, or 26, and updating official Docker images from Node.js 24 to Node.js 26 (Playwright Release Notes; GitHub Releases; Anton Gulin). - Native Bun test-runner support: Playwright's test runner now executes under Bun (
bunx --bun playwright test, tested on Bun 1.4.3 on Linux), letting Bun transpile TypeScript directly without Babel or its compilation cache—though watch mode, UI auto-rerun, and async stack frames remain unsupported under Bun (Playwright Release Notes; GitHub Releases). - 10 breaking changes that surface hidden suite bugs: From TypeScript
useDefineForClassFieldsbreaking Page Object field initializers to strictinertelement checks, empty-shard failures, RFC-compliant cookie URL lookups, and hidden-text removal from ARIA snapshots, 1.65 is the highest-risk Playwright upgrade of 2026 (Anton Gulin; Pie). - Primary operational takeaway: Upgrade on a dedicated branch, verify TypeScript compilation (
tsc --noEmit), move Page Object locator initializers into constructors, and adopt the newfailuresreporter andonlyFailures: trueoptions to shrink CI log noise (Pie).
What Changed: Runtime Shifts, Bun Runner, and New APIs
Playwright 1.65 combines major runtime updates with stricter browser-accurate semantics and new CI diagnostics (Playwright Release Notes; GitHub Releases):
- Browser & Docker Matrix: Official builds target Chromium 158.0.8127.18 / 159.0.8154.6, Mozilla Firefox 159.0, and WebKit 27.2, while Docker images now bundle Node.js 26 instead of Node.js 24 (Playwright Release Notes; GitHub Releases).
- Bun Execution (
--bun): Passing--bun(bunx --bun playwright test) runs tests under Bun's native runtime and TypeScript transpiler (without--bun,bunxfalls back to Node.js) (Playwright Release Notes). Note that under Bun,tsconfig.jsonoptions (--tsconfig, JSX), custom ESM loaders, watch mode, and async stack frames are unavailable, and step titles omit class prefixes (e.g.,clickinstead oflocator.click) (Playwright Release Notes; GitHub Releases). - New Automation & AI-Testing APIs:
page.getByRef(): Locates elements byariaRef(such ase2) returned bypage.ariaSnapshot()in'ai'mode, tightening integration with agentic browser workflows (Playwright Release Notes).includeShadow: Added topage.content()andframe.content()to serialize open shadow roots as declarative shadow DOM (Playwright Release Notes).signCountfor Virtual Credentials: Configures and persists WebAuthn authenticator signature counters inside storage state viacredentials.create()andcredentials.get()(Playwright Release Notes).- CI Reporters & Config: Adds
failuresreporter (printing failures and successful retries in real time),onlyFailures: truefor HTML/JSON/JUnit reporters,--add-reporter,omitTags, andfullConfig.filteredProjects(Playwright Release Notes; Pie).
flowchart TD
A[Playwright 1.64 Suite on Node 20] --> B[Upgrade CI Runtime to Node 22/24/26]
B --> C[Run tsc --noEmit & Full Suite on Branch]
C --> D{Class Field Initializer Error?}
D -->|Yes| E[Move Locator Init Inside Constructor]
D -->|No| F{Inert / ARIA / Cookie / Shard Failures?}
E --> F
F -->|Inert Timeout| G[Dismiss Modal/Drawer Before Action]
F -->|Empty Shard| H[Fix Filter or Pass --pass-with-no-tests]
F -->|ARIA / Cookie / Proxy| I[Update Snapshots, Cookie URLs & httpCredentials]
G --> J[Enable failures Reporter & onlyFailures: true]
H --> J
I --> J
J --> K[Green Playwright 1.65+ CI Pipeline]Fixing the TypeScript useDefineForClassFields Page Object Breakage
The single most common failure when upgrading from 1.64 to 1.65 stems from TypeScript's useDefineForClassFields setting (enabled by default for ES2022+ targets or when no target is specified) (Pie; Anton Gulin). In 1.65, class field initializers execute before constructor parameter properties (private readonly page: Page) are assigned, throwing TypeError: Cannot read properties of undefined (reading 'getByRole') (Anton Gulin; Pie).
import type { Page, Locator } from '@playwright/test';
// BROKEN in Playwright 1.65 when useDefineForClassFields is true:
// field initializer runs before constructor assigns this.page
class BrokenLoginPage {
readonly submit = this.page.getByRole('button', { name: 'Submit' });
constructor(private readonly page: Page) {}
}
// FIXED: assign locators inside the constructor (recommended over tsconfig stopgap)
class FixedLoginPage {
readonly submit: Locator;
constructor(private readonly page: Page) {
this.submit = page.getByRole('button', { name: 'Submit' });
}
}
Note that v1.65.1 fixed a related regression (#43936) where decorated classes with static fields failed to load when useDefineForClassFields: false was set as a temporary tsconfig.json stopgap (GitHub Releases; Anton Gulin).
Reliability, Cost, and Breaking-Change Analysis
Independent verification across all 10 breaking changes in Playwright 1.65 shows that most failures expose real application or test-suite defects that 1.64 silently ignored (Anton Gulin):
| # | Breaking Change in 1.65 | Symptom in CI Logs | Root Cause & Verified Fix |
|---|---|---|---|
| 1 | TypeScript class fields | TypeError: Cannot read properties of undefined |
Field initializers run before constructor; move locator assignments into constructor() (Pie) |
| 2 | Inert elements | Action timeout (element is inert) |
Actions now wait until inert attributes clear; close blocking modals/drawers first (Anton Gulin) |
| 3 | Empty sharded runs | Error: No tests found on --shard |
A shard with zero matched tests now fails; fix filters or pass --pass-with-no-tests (Pie) |
| 4 | Cookie lookups by URL | Expected cookie missing from cookies(url) |
Follows browser RFC 6265 subdomain/path rules; query with the cookie's exact URL (Anton Gulin) |
| 5 | Proxy credentials | Target site returns HTTP 401 |
Proxy passwords stay isolated to the proxy; pass site auth via httpCredentials (Anton Gulin) |
| 6 | Hidden text in ARIA | Snapshot mismatch / getByRole misses |
Non-rendered text is stripped from accessible names and ariaSnapshot(); update baselines (Pie) |
| 7 | Request string params |
Duplicate query parameters sent | Passing string params alongside a URL query appends both; keep query params in one place (Anton Gulin) |
| 8 | Missing CSS imports | Cannot find module './price.css' |
Imported style files must exist on disk; create or remove dead imports (Anton Gulin) |
| 9 | Blob reporter directory | Earlier shard blob reports disappear | Blob reporter now empties its output folder; write each shard to a distinct directory (Anton Gulin) |
| 10 | CommonJS test locations | Error: No tests found in custom scripts |
Imported test() calls point to callee start (file:line:7 vs :11); match by file:line (Playwright Release Notes; Anton Gulin) |
CI Cost, Sharding, and Visual Baseline Trade-Offs
- Faster Failure Triage With
onlyFailures: true: Large CI matrices previously generated multi-megabyte HTML and JUnit reports dominated by passing specs. EnablingonlyFailures: trueand thefailuresreporter trims report artifacts and surfaces retry-flaky tests immediately (Pie). - Bun vs. Node.js 22/24/26 Trade-Off: Running
bunx --bun playwright testspeeds up local TypeScript startup by skipping Babel, but because Playwright's own CI runs Bun1.4.3on Linux without watch mode or async stack frames, Node.js 22/24/26 remains the safer choice for complex debugging and production CI shards (Playwright Release Notes; GitHub Releases). - Visual Snapshot Refresh: Because 1.65 bumps Chromium to
158/159, Firefox to159.0, and WebKit to27.2, font rendering and layout metrics can shift slightly—requiring visual regression baselines to be regenerated inside the matchingv1.65Docker container (GitHub Releases).
Practical Implementation & Upgrade Playbook
Follow this sequence to upgrade safely from Playwright 1.64 (or earlier) to 1.65+:
- Pin Node.js 22+ in CI: Update
.nvmrc,package.jsonengines, and GitHub Actionsactions/setup-nodeto22,24, or26(or switch Docker base images tov1.65.xwith Node.js 26) (Playwright Release Notes). - Audit TypeScript & Blob Reporter Paths: Run
npx tsc --noEmitfirst, refactor Page Object field initializers into constructors, and ensure sharded CI jobs write blob reports to unique subdirectories before merging (Anton Gulin; Pie). - Adopt
getByRef()andretryStrategy: 'isolated': If you combine Playwright with AI agents (page.ariaSnapshot({ mode: 'ai' })), replace brittle CSS selectors withpage.getByRef(), and leverageretryStrategy: 'isolated'(added in 1.62) and--shuffle(added in 1.64) to catch hidden test-order dependencies (Playwright Release Notes; Pie).
Production CI Configuration: Node.js 26 Docker, Sharded Blob Reports, and onlyFailures
To prevent blob report collisions and shrink CI artifacts in Playwright 1.65+, configure distinct per-shard output directories alongside the new onlyFailures: true option and failures reporter (Playwright Release Notes; Anton Gulin; Pie):
jobs:
e2e:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.65.0-noble # Ships Node.js 26
strategy:
matrix:
shard: [1, 2, 3, 4]
steps:
- uses: actions/checkout@v4
- run: npm ci
- name: Run Playwright shard with failures reporter
run: npx playwright test --shard=${{ matrix.shard }}/4 --reporter=blob,failures
env:
PLAYWRIGHT_BLOB_OUTPUT_DIR: blob-report-${{ matrix.shard }}
Frequently Asked Questions (FAQ)
Does Playwright 1.65 still support Node.js 20?
No. Playwright 1.65 no longer tests on Node.js 20 and requires Node.js 22, 24, or 26, while official Playwright Docker images now ship with Node.js 26 (Playwright Release Notes).
Why did my Page Object classes throw Cannot read properties of undefined after upgrading to 1.65?
Playwright 1.65 respects TypeScript's useDefineForClassFields setting, which runs class field initializers before constructor parameter properties (this.page) are assigned (Pie). Move locator initializers inside the constructor() to fix it cleanly (Pie).
Should I switch my CI pipeline from Node.js to Bun in Playwright 1.65?
Use Bun (bunx --bun playwright test) for fast local TypeScript runs if your team already uses Bun, but keep Node.js 22/24/26 for primary CI and debugging—since Bun mode currently lacks watch mode, UI auto-rerun, tsconfig.json path/JSX options, and async stack frames (Playwright Release Notes).
Why did my sharded Playwright 1.65 CI job fail with No tests found?
In Playwright 1.65, a --shard run that matches zero tests now fails with Error: No tests found instead of exiting silently (Anton Gulin; Pie). Adjust your shard filter or pass --pass-with-no-tests if empty shards are expected (Anton Gulin).
What is page.getByRef() in Playwright 1.65?
page.getByRef() is a new locator API that targets elements using the ariaRef identifier (e.g., e2) returned by page.ariaSnapshot() in 'ai' mode, making agent-driven browser automation more deterministic (Playwright Release Notes).
How does Playwright 1.65 handle inert elements differently from 1.64?
In Playwright 1.65, actions such as fill(), click(), or selectOption() wait until an element is no longer marked inert rather than interacting with blocked DOM regions (Anton Gulin). If a test previously passed while a modal or drawer rendered the underlying page inert, 1.65 surfaces a timeout—requiring the test to dismiss the overlay first, matching real user behavior (Anton Gulin).
Sources
- Playwright Official Documentation (2026) — Release Notes (v1.65) (Primary)
- GitHub (
microsoft/playwright) (Updated December 2, 2026) — Releases (v1.65.0–v1.65.2) (Primary) - Anton Gulin (November 19, 2026) — Playwright 1.65 breaking changes: each error and its fix (Secondary)
- Pie (November 30, 2026) — Playwright Best Practices: First Locator to Flaky List (Secondary)
- Skakarh (November 24, 2026) — Playwright Release Notes 2026: Best Guide to 5 Versions (Secondary)