Playwright 1.65.0 shipped on November 5, 2026, and 1.65.1 followed on November 13. The headline features are running the test runner under Bun and a reporter that prints only failures. The release notes also list ten notable changes, and a few of them break suites that passed the day before.
This guide upgrades a small suite from 1.64.1 to 1.65.1 and fixes each failure. Every error message below is copied from a real run.
Before you upgrade
Playwright no longer tests on Node.js 20. The system requirements now list the latest 22.x, 24.x or 26.x. Check your machine and your CI image:
node --versionv22.22.3The official Docker images now ship Node.js 26 instead of 24. If you build on top of them, your CI changes Node version with the upgrade.
1. Run the suite on 1.64.1
The example project uses a page object, the pattern most Playwright suites are built on:
import type { Page } from '@playwright/test';
export class LoginPage {
readonly email = this.page.getByLabel('Email');
readonly password = this.page.getByLabel('Password');
readonly submit = this.page.getByRole('button', { name: 'Sign in' });
constructor(private readonly page: Page) {}
async login(email: string, password: string) {
await this.email.fill(email);
await this.password.fill(password);
await this.submit.click();
}
}import { test, expect } from '@playwright/test';
import { LoginPage } from '../pages/login-page';
test('signs in', async ({ page }) => {
await page.setContent(`
<form onsubmit="event.preventDefault(); this.querySelector('output').value = 'Welcome, ' + this.email.value">
<label>Email <input name="email" type="email"></label>
<label>Password <input name="password" type="password"></label>
<button>Sign in</button>
<output></output>
</form>`);
await new LoginPage(page).login('[email protected]', 'secret');
await expect(page.getByText('Welcome, [email protected]')).toBeVisible();
});A second test checks a session cookie:
import { test, expect } from '@playwright/test';
test('session cookie reaches the app subdomain', async ({ context }) => {
await context.addCookies([
{ name: 'session', value: 'abc123', url: 'https://example.com' },
]);
const cookies = await context.cookies('https://app.example.com');
expect(cookies.map((c) => c.name)).toContain('session');
});The tsconfig.json sets "target": "ES2022", which is a common choice. Both tests pass:
npx playwright test tests/login.spec.ts tests/cookies.spec.tsRunning 2 tests using 2 workers
✓ 1 tests/cookies.spec.ts:3:1 › session cookie reaches the app subdomain (48ms)
✓ 2 tests/login.spec.ts:4:1 › signs in (367ms)
2 passed (1.2s)2. Upgrade and read only the failures
Install 1.65.1 and the matching browser:
npm install -D @playwright/[email protected]
npx playwright install chromiumchanged 3 packages, and audited 4 packages in 1s
found 0 vulnerabilities
Downloading Chrome for Testing 159.0.8154.6 (playwright chromium v1255) from https://cdn.playwright.dev/builds/cft/159.0.8154.6/mac-arm64/chrome-mac-arm64.zip
Chrome for Testing 159.0.8154.6 (playwright chromium v1255) downloaded to …/chromium-1255Run the same tests with the new failures reporter. It skips the progress lines and prints each failure as it happens, which is what you want while working through an upgrade:
npx playwright test tests/login.spec.ts tests/cookies.spec.ts --reporter=failures 1) tests/cookies.spec.ts:3:1 › session cookie reaches the app subdomain ──────────────────────────
Error: expect(received).toContain(expected) // indexOf
Expected value: "session"
Received array: []
2) tests/login.spec.ts:4:1 › signs in ────────────────────────────────────────────────────────────
TypeError: Cannot read properties of undefined (reading 'getByLabel')
at ../pages/login-page.ts:4
2 |
3 | export class LoginPage {
> 4 | readonly email = this.page.getByLabel('Email');
| ^
5 | readonly password = this.page.getByLabel('Password');
2 failed
tests/cookies.spec.ts:3:1 › session cookie reaches the app subdomain ───────────────────────────
tests/login.spec.ts:4:1 › signs in ─────────────────────────────────────────────────────────────Both tests now fail, though no test code changed.
3. Move page object fields into the constructor
TypeScript can compile class fields in two ways. With useDefineForClassFields on, fields follow standard JavaScript rules: initializers run before the constructor body. The parameter property private readonly page is assigned in the constructor body, so this.page is still undefined when email is initialized.
tsc turns the option on for ES2022 and later targets, and when target is missing. Playwright 1.64 ignored that and used the old TypeScript behaviour. 1.65 follows your tsconfig the way tsc does. A project with no tsconfig.json at all fails the same way, because no target means the option is on.
The fix is to assign the locators in the constructor:
import type { Locator, Page } from '@playwright/test';
export class LoginPage {
readonly email: Locator;
readonly password: Locator;
readonly submit: Locator;
constructor(private readonly page: Page) {
this.email = page.getByLabel('Email');
this.password = page.getByLabel('Password');
this.submit = page.getByRole('button', { name: 'Sign in' });
}
async login(email: string, password: string) {
await this.email.fill(email);
await this.password.fill(password);
await this.submit.click();
}
}If you have hundreds of page objects, you can keep the old behaviour while you refactor:
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"useDefineForClassFields": false
}
}The unchanged page object passes again with this setting. Treat it as a stopgap, though. The constructor version works under any compiler setting, while the flag ties your tests to legacy TypeScript behaviour.
4. Fix cookie checks that relied on loose matching
A cookie added with url is host-only. Under RFC 6265, the browser sends it to that exact host and never to subdomains. Playwright 1.64 still returned it from context.cookies() for subdomains. 1.65 follows the RFC.
This check shows what the browser actually sends to the subdomain, next to what cookies() reports:
import { test } from '@playwright/test';
test('which cookies reach app.example.com', async ({ context, page }) => {
await context.addCookies([
{ name: 'hostOnly', value: '1', url: 'https://example.com' },
{ name: 'shared', value: '1', domain: '.example.com', path: '/' },
]);
await page.route('https://app.example.com/**', async (route) => {
console.log('sent:', await route.request().headerValue('cookie'));
await route.fulfill({ body: 'ok' });
});
await page.goto('https://app.example.com/');
const cookies = await context.cookies('https://app.example.com');
console.log('cookies():', cookies.map((c) => c.name));
});npx playwright test tests/cookie-check.spec.tsOn 1.64.1:
sent: shared=1
cookies(): [ 'hostOnly', 'shared' ]On 1.65.1:
sent: shared=1
cookies(): [ 'shared' ]The browser never sent hostOnly, even on 1.64.1. The old test was asserting something your app never saw. If the cookie should reach subdomains, give it a domain:
await context.addCookies([
{ name: 'session', value: 'abc123', domain: '.example.com', path: '/' },
]);If it really is host-only, ask cookies() about the exact host instead. Path matching also got stricter: a Path=/api cookie no longer matches /apiv2, and Path=/foo/ no longer matches /foo.
5. Let actions wait for inert elements
Actions such as fill(), click(), check() and selectOption() now wait until the element is not inert. An element is inert when it, or one of its ancestors, has the inert attribute. Inert elements can't be focused or clicked.
This change mostly removes flaky tests. Here the app keeps a form inert until its data loads:
import { test, expect } from '@playwright/test';
// The app keeps the form inert until its data has loaded.
test('fills the form once it is ready', async ({ page }) => {
await page.setContent(`
<form inert>
<label>City <input name="city"></label>
</form>
<script>setTimeout(() => document.querySelector('form').inert = false, 500)</script>`);
await page.getByLabel('City').fill('Lisbon');
await expect(page.getByLabel('City')).toHaveValue('Lisbon');
});npx playwright test tests/delayed.spec.tsOn 1.64.1, fill() returned without typing anything, and the test failed one line later:
1) tests/delayed.spec.ts:4:1 › fills the form once it is ready ───────────────────────────────────
Error: expect(locator).toHaveValue(expected) failed
Locator: getByLabel('City')
Expected: "Lisbon"
Received: ""
Timeout: 5000msOn 1.65.1, fill() waits for the form to stop being inert:
✓ 1 tests/delayed.spec.ts:4:1 › fills the form once it is ready (972ms)
1 passed (1.4s)The flip side: if the element stays inert, the action now waits until it times out. A common cause is a cookie banner that makes <main> inert until the visitor accepts it:
import { test, expect } from '@playwright/test';
// The cookie banner makes <main> inert until the visitor accepts.
const html = `
<aside>
We use cookies.
<button onclick="document.querySelector('main').inert = false; this.parentElement.remove()">Accept</button>
</aside>
<main inert>
<label>Search <input type="search"></label>
</main>`;
test('searches', async ({ page }) => {
await page.setContent(html);
await page.getByLabel('Search').fill('shoes');
await expect(page.getByLabel('Search')).toHaveValue('shoes');
});On 1.65.1 the call log names the cause:
Error: locator.fill: Test timeout of 30000ms exceeded.
Call log:
- waiting for getByLabel('Search')
- locator resolved to <input type="search"/>
- fill("shoes")
- attempting fill action
2 × waiting for element to be visible, enabled and editable
- element is inert
- retrying fill action
58 × waiting for element to be visible, enabled and editable
- element is inertDo what a visitor would do and accept the banner first:
test('searches', async ({ page }) => {
await page.setContent(html);
await page.getByRole('button', { name: 'Accept' }).click();
await page.getByLabel('Search').fill('shoes');
await expect(page.getByLabel('Search')).toHaveValue('shoes');
});6. Allow empty shards on purpose
CI pipelines often run a filtered subset across shards. When nothing matches, 1.64.1 printed nothing and exited with 0:
npx playwright test --shard=1/2 --grep @smoke; echo "exit=$?"exit=01.65.1 fails the run:
Error: No tests found
exit=1This catches a typo in a tag that would otherwise make CI green while testing nothing. If an empty run is expected, say so:
npx playwright test --shard=1/2 --grep @smoke --pass-with-no-tests; echo "exit=$?"exit=0A single empty shard still passes when other shards have tests. The error only fires when no shard has any.
7. Keep CI output to the failures
Once the suite is green, the new reporters are worth keeping in CI. The onlyFailures option of the HTML, JSON and JUnit reporters keeps only unexpected, flaky and interrupted tests:
import { defineConfig } from '@playwright/test';
export default defineConfig({
testDir: './tests',
reporter: process.env.CI
? [['failures'], ['html', { onlyFailures: true, open: 'never' }]]
: 'list',
});With one deliberately broken test added to the four passing ones, the CI log shows only that test:
CI=1 npx playwright test 1) tests/broken.spec.ts:2:1 › shows the cart total ───────────────────────────────────────────────
Error: expect(locator).toBeVisible() failed
Locator: getByText('Total: 42')
Expected: visible
Timeout: 1000ms
Error: element(s) not found
1 failed
tests/broken.spec.ts:2:1 › shows the cart total ────────────────────────────────────────────────
4 passed (2.4s)The HTML report from that run contains one test, not five, so it only holds what needs attention.
8. Try the test runner under Bun
The test runner can now run under Bun. Pass --bun, because plain bunx playwright test still runs on Node.js:
bunx --bun playwright testRunning 4 tests using 4 workers
✓ 1 tests/cookies.spec.ts:3:1 › session cookie reaches the app subdomain (89ms)
✓ 2 tests/login.spec.ts:4:1 › signs in (538ms)
✓ 4 tests/search.spec.ts:13:1 › searches (505ms)
✓ 3 tests/delayed.spec.ts:4:1 › fills the form once it is ready (1.2s)
4 passed (2.1s)That run used Bun 1.4.4. The old page object from step 1 fails under Bun too, with TypeError: undefined is not an object, so the constructor fix is needed on both runtimes.
Don't switch if you depend on any of these. Under Bun there is no watch mode, and UI mode doesn't re-run tests when files change. Bun loads modules itself, so --tsconfig and the JSX options in tsconfig.json have no effect, and custom ESM loaders aren't supported. Stack traces lose async frames, and API names drop the class name (click instead of locator.click), which changes some step titles and error messages. A test's console output doesn't reach the trace. Playwright's own CI runs these tests on Linux with Bun 1.4.3, and 1.65.1 fixed test locations that were one column off under Bun 1.4.4 and later.
Other changes to check
These changes didn't affect the example suite, but they can affect yours. The release notes have the details.
| Change | What to look for |
|---|---|
| Text the browser doesn't render is left out of accessible names | getByRole() with a name, and aria snapshots, around closed <details> or unslotted shadow DOM text |
String and URLSearchParams values of params are appended to the URL's query | API tests whose URL already has a query string |
.css, .less and .scss imports load as empty modules | Test files that import style files that don't exist |
| Proxy credentials only answer proxy challenges | Sites you authenticated to through the proxy option; use httpCredentials |
| The blob reporter clears its output directory again | Pipelines that keep several blob reports in one folder |
| CommonJS test locations point to the start of the callee | Tooling that parses file:line:column |
Next steps
- Inside a test,
test.skip('Not implemented yet')now takes just a description and records it as an annotation.test.fixme(),test.fail()andtest.slow()work the same way. - Use the new built-in
-exclusive-test lock for tests that must run alone, such as one that restarts a shared server. - Read the full release notes for the new
cdpSession.send()options andtestRun.mode().