GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||
GeezerVison is showing github.com — Update dependency @playwright/test to v1.64.1 by renovate[bot] · Pull Request #79 · developing-today/code Conversation
|
| Package | Change | Age | Confidence |
|---|---|---|---|
| @playwright/test (source) | 1.28.0 → 1.64.1 |
||
| @playwright/test (source) | 1.63.0 → 1.64.1 |
v1.64.1v1.64.0New page.webmcp and frame.webmcp give access to the tools that a page registers through the experimental WebMCP browser API, so you can test them like any other part of your app:
const browser = await chromium.launch({ args: ['--enable-features=WebMCP'] }); const page = await browser.newPage(); await page.goto('https://example.com'); for (const tool of await page.webmcp.tools()) console.log(tool.name, tool.description); const result = await page.webmcp.callTool('add', { a: 2, b: 40 }); console.log(result.content[0].text); // "42"
Playwright MCP also supports WebMCP by default, with page-defined tools offered to the agent as webmcp_<tool>. Pass --no-webmcp to opt out.
playwright-cli exposes them as well:
playwright-cli webmcp-list
playwright-cli webmcp-call search_catalog --params '{"query":"cats"}'Videos can now be recorded at a custom frame rate, and the decorations for actions are styled with plain CSS:
// playwright.config.ts import { defineConfig } from '@playwright/test'; export default defineConfig({ use: { video: { mode: 'on', size: { width: 1920, height: 1080 }, fps: 60, show: { actions: { style: { point: 'width: 20px; height: 20px; border-radius: 50%; background: red', highlight: 'outline: 2px solid #​333; background: rgba(0, 128, 255, .15)', title: 'font-size: 16px', }, }, }, }, }, });
fps option in testOptions.video, recordVideo andstyle option takes CSS declarations for the point marker, the targethighlight and the action title. It replaces the fontSize option, which is now deprecated.playwright-cli.New testProject.default option keeps a project in the config without running it by default. You can configure every browser you care about, and let a plain npx playwright test run just your favourite one:
// playwright.config.ts import { defineConfig, devices } from '@playwright/test'; export default defineConfig({ projects: [ { name: 'chromium', use: devices['Desktop Chrome'] }, { name: 'firefox', use: devices['Desktop Firefox'], default: false }, { name: 'webkit', use: devices['Desktop Safari'], default: false }, ], });
npx playwright test # runs chromium only npx playwright test --project=firefox # runs firefox npx playwright test --project="*" # runs all three, for example on CI
New --shuffle command line option schedules tests in a random order, which helps to find tests that accidentally depend on each other.
npx playwright test --shuffle # Running 42 tests using 4 workers, shuffle seed 271828182 # ... # Pass the seed to reproduce the same order. npx playwright test --shuffle 271828182
New lock option in test.describe.configure() adds test locks to all tests in a file or a group:
test.describe.configure({ lock: 'user-settings' });
New type option of toHaveScreenshot in testConfig.expect stores all unnamed screenshots as WebP:
// playwright.config.ts export default defineConfig({ expect: { toHaveScreenshot: { type: 'webp' }, }, });
New locator.within() combines two locators that you already have, reading in the natural order —
"this button, within that dialog":
const saveButton = page.getByRole('button', { name: 'Save' }); const dialog = page.getByTestId('settings-dialog'); await saveButton.within(dialog).click();
Relative locators such as locator.nth() or locator.first() are resolved inside each parent
separately, which makes column-like queries straightforward:
// The third cell of every row, not the third cell in the table. const thirdColumn = page.getByRole('cell').nth(2).within(page.getByRole('row')); await expect(thirdColumn).toHaveText(['Apple', 'Banana', 'Cherry']);
New page.getByRef() locates an element by its aria ref, such as e2, reported by page.ariaSnapshot() in the 'ai' mode.
New option includeShadow in page.content() and frame.content() serializes open shadow roots as declarative shadow DOM.
New option signCount sets the initial signature counter of a virtual credential. credentials.create() and credentials.get() return the current signCount, and it is saved and restored together with the credentials in the storage state.
New fullConfig.filteredProjects lists the projects that were selected to run after applying the --project filter. It is available in global setup and reporters.
New apiRequestContext.addCookies(), apiRequestContext.cookies() and apiRequestContext.clearCookies() manage cookies of a request context, mirroring the BrowserContext methods:
await request.addCookies([{ name: 'session-id', value: '42', url: 'https://example.com' }]); console.log(await request.cookies('https://example.com')); await request.clearCookies({ name: 'session-id' });
screen property is now forwarded from the device descriptors. If you use ...devices['Desktop Chrome'] and alike, window.screen and media queries now see the emulated screen size. You can opt-out by explicitly setting screen to undefined:
// playwright.config.ts export default defineConfig({ use: { ...devices['Desktop Chrome'], screen: undefined, }, });
JSX in your test files now follows your tsconfig.json. Playwright compiles JSX in test files according to the jsx, jsxFactory, jsxFragmentFactory and jsxImportSource tsconfig options, and defaults to the automatic runtime from react/jsx-runtime.
--update-snapshots=missing now passes the test run. Tests that only create missing snapshots now pass in the 'missing' mode of testConfig.updateSnapshots, so that CI can generate new snapshots and verify the existing ones in a single run. The mode used when the option is not specified is now called 'default' and behaves as before: missing snapshots are written and the test fails.
Elements inside hidden iframes are considered hidden. Elements inside an iframe that is not visible, for example with visibility: hidden, are now considered hidden by actions, locator.isVisible() and expect(locator).toBeVisible().
This version was also tested against the following stable channels:
v1.63.0Tests that access a shared resource — an external service, a global account setting — can now declare a named lock.
Tests that share a lock name never run concurrently, across files, workers and projects, while
everything else keeps running in parallel:
test('update user settings', { lock: 'user-settings' }, async ({ page }) => { // never runs at the same time as other tests holding 'user-settings' });
A test can hold multiple locks, and test.describe() accepts a lock for the whole group.
Learn more about test locks.
page.frameLocator() and frame.frameLocator() called without a selector search in any frame of the
subtree, so you no longer need to locate the iframe first:
// Finds the button in any frame on the page. await page.frameLocator().getByRole('button').click();
The rest of the locator resolves inside a single frame, just like a regular locator, and an error is thrown when it
matches elements in several frames.
New locator.visible() returns a locator that matches only visible elements. It is the recommended
replacement for the :visible CSS pseudo-class:
await page.locator('button').visible().click();
Steps now carry structured data for reporters. Playwright API steps report the target locator and call arguments,
and test.step() accepts subtitle and params options for your own steps:
await test.step('Login', async () => { // ... }, { subtitle: 'as admin', params: { user: 'admin' } });
Reporters receive them via testStep.subtitle and testStep.params. For Playwright API
steps, the subtitle is the locator or the navigation url — for example, Click with subtitle getByRole('button').
Both are rendered next to the step title in the trace viewer and the HTML report.
The snapshots option of tracing.start() and the testOptions.trace fixture option now accept an
object selecting what to capture on every action:
// playwright.config.ts export default defineConfig({ use: { trace: { mode: 'on', snapshots: { dom: true, aria: true, screen: true } }, }, });
With aria and screen snapshots recorded, the new Display Aria mode in the trace viewer shows the action screenshot
side by side with the aria snapshot, and hovering an aria node highlights it on the screenshot.
httpCredentials now also accepts an array of credentials. The first entry matching the request origin is used, and entries without an origin match any request.opfs includes the origin private file system in the storage state, so it can be persisted and restored into later contexts.mode, depth and boxes options.json():const response = await request.get<User>('/api/users/42'); const user = await response.json(); // typed as User
--add-reporter command line option appends a reporter on top of the ones configured in playwright.config, instead of replacing them like --reporter does.omitTags option for the list, line, dot, github and junit reporters suppresses the tags that are automatically appended to test titles.npx playwright install --no-remove keeps the browsers of other Playwright installations instead of removing them.npx playwright codegen --http-credentials records against pages behind HTTP authentication.perfetto reporter writes a Trace Event Format file for the Perfetto UI or chrome://tracing, rendering the test run as a timeline with a lane per worker.@playwright/experimental-ct-react, @playwright/experimental-ct-react17 and @playwright/experimental-ct-vue packages will no longer be updated. Follow the migration guide to move to the stories model introduced in 1.62. Story ids passed to fixtures.mount() can now be typed through the generated Stories registry.This version was also tested against the following stable channels:
v1.62.1v1.62.0Component testing moves to a stories and galleries model.
A story wraps your component in one specific scenario — hard-coded props, mock data, providers — and a gallery page that you serve renders stories on demand.
The new fixtures.mount() fixture navigates to the gallery, mounts a story by id, and returns a Locator scoped to the story's root element:
test('click should expand', async ({ mount }) => { const component = await mount('components/Expandable/Stateful'); await component.getByRole('button').click(); await expect(component.getByTestId('expanded')).toHaveValue('true'); });
Pass a story type as a template argument to type-check its props, and use update(props) / unmount() on the returned locator to re-render or tear down within a test.
Most operations and web-first assertions now accept a signal option that takes an AbortSignal, letting you cancel long-running actions, navigations, waits, and assertions:
const controller = new AbortController(); setTimeout(() => controller.abort(), 1000); await page.getByRole('button', { name: 'Submit' }).click({ signal: controller.signal }); await expect(page.getByText('Done')).toBeVisible({ signal: controller.signal });
Providing a signal does not disable the default timeout; pass timeout: 0 to disable it.
expect(page).toHaveScreenshot() and expect(locator).toHaveScreenshot() can now store snapshots in the WebP format — just give the snapshot a .webp name:
// Visual comparisons store the golden snapshot as lossless WebP. await expect(page).toHaveScreenshot('homepage.webp'); // Standalone screenshots can trade quality for size with lossy WebP. await page.screenshot({ path: 'homepage.webp', quality: 50 });
page.screenshot() and [locator.screenshot() (https://playwright.dev/docs/api/class-locator#locator-screenshot) also accept webp as a type, where quality 100 (the default) is lossless and lower values use lossy compression.
New reporter.preprocess() hook runs after the configuration is resolved and before reporter.onBegin(), letting a reporter mark individual tests as skipped, excluded, fixed, or failing through a TestRun object:
class MyReporter { async preprocess({ config, suite, testRun }) { for (const test of suite.allTests()) { if (shouldSkip(test)) testRun.skip(test); } } }
New testConfig.retryStrategy controls when failed tests are retried.
The default 'immediate' retries as soon as a worker is free; 'isolated' runs all retries at the end, one by one in a single worker, to minimize interference with the rest of the suite:
// playwright.config.ts export default defineConfig({ retries: 2, retryStrategy: 'isolated', });
credentials includes the context's virtual WebAuthn Credentials (passkeys) in the storage state, so they can be persisted and re-seeded into later contexts.scroll option ("auto" | "none") on actions to opt out of Playwright's automatic scroll-into-view.playwright-cli, runnable via npx playwright mcp and npx playwright cli.mergeFiles reporter option:// playwright.config.ts export default defineConfig({ reporter: [['html', { mergeFiles: true }]], });
This version was also tested against the following stable channels:
v1.61.1v1.61.0New Credentials virtual authenticator, available via browserContext.credentials, lets tests register passkeys and answer navigator.credentials.create() / navigator.credentials.get() ceremonies in the page — no real hardware key required, works in all browsers:
const context = await browser.newContext(); // Seed a passkey your backend provisioned for a test user. await context.credentials.create('example.com', { id: credentialId, userHandle, privateKey, publicKey, }); await context.credentials.install(); const page = await context.newPage(); await page.goto('https://example.com/login'); // The page's navigator.credentials.get() is answered with the seeded passkey.
You can also let the app register a passkey once in a setup test, read it back with credentials.get(), and seed it into later tests — see Credentials for details.
New WebStorage API, available via page.localStorage and page.sessionStorage, reads and writes the page's storage for the current origin:
await page.localStorage.setItem('token', 'abc'); const token = await page.localStorage.getItem('token'); const items = await page.sessionStorage.items();
artifactsDir in browserType.connectOverCDP() controls where artifacts such as traces and downloads are stored when attached to an existing browser.cursor in screencast.showActions() controls the cursor decoration rendered for pointer actions.onFrame callback in screencast.start() now receives a timestamp of when the frame was presented by the browser.trace: new 'on-all-retries', 'retain-on-first-failure' and 'retain-on-failure-and-retries' values. See the video modes table for which runs are recorded and kept in each mode.expect.soft.poll(...).process.argv from the runner process, handy for reading custom arguments passed after the -- separator.AggregateError as a separate entry.-G command line shorthand for --grep-invert.This version was also tested against the following stable channels:
v1.60.0tracing.startHar() / tracing.stopHar() expose HAR recording as a first-class tracing API, with the same content, mode and urlFilter options as recordHar. The returned Disposable makes it easy to scope a recording with await using:
await using har = await context.tracing.startHar('trace.har'); const page = await context.newPage(); await page.goto('https://playwright.dev'); // HAR is finalized when `har` goes out of scope.
New locator.drop() simulates an external drag-and-drop of files or clipboard-like data onto an element. Playwright dispatches dragenter, dragover, and drop with a synthetic [DataTransfer] in the page context — works cross-browser and is great for testing upload zones:
await page.locator('#dropzone').drop({ files: { name: 'note.txt', mimeType: 'text/plain', buffer: Buffer.from('hello') }, }); await page.locator('#dropzone').drop({ data: { 'text/plain': 'hello world', 'text/uri-list': 'https://example.com', }, });
page.locator('body').boxes option on locator.ariaSnapshot() / page.ariaSnapshot() appends each element's bounding box as [box=x,y,width,height], useful for AI consumption.New test.abort() aborts the currently running test from a fixture, hook, or route handler with an optional message. Use it when you have detected an unrecoverable misuse and want to fail the test right away:
test('does not publish to the shared page', async ({ page }) => { await page.route('**/publish', route => { test.abort('Tests must not publish to the shared page. Use the `clone` option.'); return route.abort(); }); // ... });
description in page.getByRole() / locator.getByRole() / frame.getByRole() / frameLocator.getByRole() for matching the accessible description.pseudo in expect(locator).toHaveCSS() reads computed styles from ::before or ::after.style in locator.highlight() applies extra inline CSS to the highlight overlay, plus new page.hideHighlight() to clear all highlights.noDefaults in browserType.connectOverCDP() disables Playwright's default overrides on the default context (download behavior, focus emulation, media emulation), so attaching to a user's daily-driver browser doesn't disturb its state.line / column properties (lineNumber / columnNumber are deprecated).expect(...) matcher failure.workerInfo argument with details about the worker for fixture teardown errors.{testFileBaseName} token in testProject.snapshotPathTemplate — file name without extension.workers: 0 or negative values.npx playwright show-report accepts .zip files directly — no need to unzip first.repeatEachIndex is shown in the test header when non-zero.Locator.ariaRef() — use the standard locator.ariaSnapshot() pipeline.handle option on BrowserContext.exposeBinding and Page.exposeBinding.logger option on BrowserType.connect and BrowserType.connectOverCDP — use tracing instead.videosPath / videoSize — use recordVideo instead.This version was also tested against the following stable channels:
v1.59.1codegen, --ui and show commands (#39990)v1.59.0New page.screencast API provides a unified interface for capturing page content with:
Screencast recording — record video with precise start/stop control, as an alternative to the recordVideo option:
await page.screencast.start({ path: 'video.webm' }); // ... perform actions ... await page.screencast.stop();
Action annotations — enable built-in visual annotations that highlight interacted elements and display action titles during recording:
await page.screencast.showActions({ position: 'top-right' });
screencast.showActions() accepts position ('top-left', 'top', 'top-right', 'bottom-left', 'bottom', 'bottom-right'), duration (ms per annotation), and fontSize (px). Returns a disposable to stop showing actions.
Action annotations can also be enabled in test fixtures via the video option:
// playwright.config.ts export default defineConfig({ use: { video: { mode: 'on', show: { actions: { position: 'top-left' }, test: { position: 'top-right' }, }, }, }, });
Visual overlays — add chapter titles and custom HTML overlays on top of the page for richer narration:
await page.screencast.showChapter('Adding TODOs', { description: 'Type and press enter for each TODO', duration: 1000, }); await page.screencast.showOverlay('<div style="color: red">Recording</div>');
Real-time frame capture — stream JPEG-encoded frames for custom processing like thumbnails, live previews, AI vision, and more:
await page.screencast.start({ onFrame: ({ data }) => sendToVisionModel(data), size: { width: 800, height: 600 }, });
Agentic video receipts — coding agents can produce video evidence of their work. After completing a task, an agent can record a walkthrough video with rich annotations for human review:
await page.screencast.start({ path: 'receipt.webm' }); await page.screencast.showActions({ position: 'top-right' }); await page.screencast.showChapter('Verifying checkout flow', { description: 'Added coupon code support per ticket #​1234', }); // Agent performs the verification steps... await page.locator('#coupon').fill('SAVE20'); await page.locator('#apply-coupon').click(); await expect(page.locator('.discount')).toContainText('20%'); await page.screencast.showChapter('Done', { description: 'Coupon applied, discount reflected in total', }); await page.screencast.stop();
The resulting video serves as a receipt: chapter titles provide context, action annotations highlight each interaction, and the visual walkthrough is faster to review than text logs.
New browser.bind() API makes a launched browser available for playwright-cli, @playwright/mcp, and other clients to connect to.
Bind a browser — start a browser and bind it so others can connect:
const { endpoint } = await browser.bind('my-session', { workspaceDir: '/my/project', });
Connect from playwright-cli — connect to the running browser from your favorite coding agent.
playwright-cli attach my-session playwright-cli -s my-session snapshot
Connect from @playwright/mcp — or point your MCP server to the running browser.
@playwright/mcp --endpoint=my-session
Connect from a Playwright client — use API to connect to the browser. Multiple clients at a time are supported!
const browser = await chromium.connect(endpoint);
Pass host and port options to bind over WebSocket instead of a named pipe:
const { endpoint } = await browser.bind('my-session', { host: 'localhost', port: 0, }); // endpoint is a ws:// URL
Call browser.unbind() to stop accepting new connections.
Run playwright-cli show to open the Dashboard that lists all the bound browsers, their statuses, and allows interacting with them:
- `playwright-cli` binds all of its browsers automatically, so you can see what your agents are doing.
- Pass `PLAYWRIGHT_DASHBOARD=1` env variable to see all `@playwright/test` browsers in the dashboard.
Coding agents can now run npx playwright test --debug=cli to attach and debug tests over playwright-cli — perfect for automatically fixing tests in agentic workflows:
$ npx playwright test --debug=cli ### Debugging Instructions - Run "playwright-cli attach tw-87b59e" to attach to this test $ playwright-cli attach tw-87b59e ### Session `tw-87b59e` created, attached to `tw-87b59e`. Run commands with: playwright-cli --session=tw-87b59e <command> ### Paused - Navigate to "/" at output/tests/example.spec.ts:4 $ playwright-cli --session tw-87b59e step-over ### Page - Page URL: https://playwright.dev/ - Page Title: Fast and reliable end-to-end testing for modern web apps | Playwright ### Paused - Expect "toHaveTitle" at output/tests/example.spec.ts:7
Coding agents can run npx playwright trace to explore Playwright Trace and understand failing or flaky tests from the command line:
$ npx playwright trace open test-results/example-has-title-chromium/trace.zip Title: example.spec.ts:3 › has title $ npx playwright trace actions --grep="expect" # Time Action Duration ──── ───────── ─────────────────────────────────────────────────────── ──────── 9. 0:00.859 Expect "toHaveTitle" 5.1s ✗ $ npx playwright trace action 9 Expect "toHaveTitle" Error: expect(page).toHaveTitle(expected) failed Expected pattern: /Wrong Title/ Received string: "Fast and reliable end-to-end testing for modern web apps | Playwright" Timeout: 5000ms Snapshots available: before, after usage: npx playwright trace snapshot 9 --name <before|after> $ npx playwright trace snapshot 9 --name after ### Page - Page Title: Fast and reliable end-to-end testing for modern web apps | Playwright $ npx playwright trace close
await usingMany APIs now return async disposables, enabling the await using syntax for automatic cleanup:
await using page = await context.newPage(); { await using route = await page.route('**/*', route => route.continue()); await using script = await page.addInitScript('console.log("init script here")'); await page.goto('https://playwright.dev'); // do something } // route and init script have been removed at this point
page.locator('body').ariaSnapshot().depth and mode in locator.ariaSnapshot().filter in page.consoleMessages() and page.pageErrors() controls which messages are returned.live in tracing.start() for real-time trace updates.artifactsDir in browserType.launch() to configure the artifacts directory.'retain-on-failure-and-retries' records a trace for each test run and retains all traces when an attempt fails — great for comparing a passing trace with a failing one from a flaky test.navigator.platform emulation can cause Ctrl or Meta dispatching errors (#40009). Pass PLAYWRIGHT_NO_UA_PLATFORM = '1' environment variable while we are issuing a patch release. Let us know in the issue how it affected you.@playwright/experimental-ct-svelte package.junit test reporter now differentiates between types of errors, so some of the previous <failure>s are now reported as <error>s.This version was also tested against the following stable channels:
v1.58.2#39121 fix(trace viewer): make paths via stdin work
#39129 fix: do not force swiftshader on chromium mac
v1.58.1#39036 fix(msedge): fix local network permissions
#39037 chore: update cft download location
#38995 chore(webkit): disable frame sessions on fronzen builds
v1.58.0We are adding a new token-efficient CLI mode of operation to Playwright with the skills located at playwright-cli. This brings the long-awaited official SKILL-focused CLI mode to our story and makes it more coding agent-friendly.
It is the first snapshot with the essential command set (which is already larger than the original MCP!), but we expect it to grow rapidly. Unlike the token use, that one we expect to go down since snapshots are no longer forced into the LLM!
If you're using merged reports, the HTML report Speedboard tab now shows the Timeline:
Thanks to @cpAdm for contributing these improvements!
browserType.connectOverCDP() now accepts an isLocal option. When set to true, it tells Playwright that it runs on the same host as the CDP server, enabling file system optimizations.
_react and _vue selectors. See locators guide for alternatives.:light selector engine suffix. Use standard CSS selectors instead.devtools from browserType.launch() has been removed. Use args: ['--auto-open-devtools-for-tabs'] instead.This version was also tested against the following stable channels:
v1.57.0In HTML reporter, there's a new tab we call "Speedboard":
It shows you all your executed tests sorted by slowness,
and can help you understand where your test suite is taking longer than expected.
Take a look at yours - maybe you'll find some tests that are spending a longer time waiting than they should!
[!IMPORTANT]
✂ PR body was truncated to here.
📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about these updates again.
This PR was generated by Mend Renovate. View the repository job log.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
73f1432 to
120f328
Compare
120f328 to
e2a265c
Compare
e2a265c to
6a46c43
Compare
6a46c43 to
c3e9a0c
Compare
c3e9a0c to
152baaf
Compare
152baaf to
cc35648
Compare
cc35648 to
f2145a7
Compare
45140e9 to
ebc70a6
Compare
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.