Skip to content

Commit f07e0f7

Browse files
authored
cherry-pick(#41940): docs: release notes for v1.62 (#41967)
Release notes for the upcoming **v1.62** release. ### Highlights - **New component testing model** — stories & galleries with the new `mount` fixture - **AbortSignal** support on operations and web-first assertions (`signal` option) - **WebP screenshots** — store `toHaveScreenshot()` snapshots as `.webp` - **`Reporter.preprocess()`** hook for custom test filtering - **Isolated retries** via `retryStrategy: 'isolated'` ### Also includes - New APIs: WebAuthn passkeys in storage state (`storageState.credentials`), `APIResponse.timing()`, `Locator.waitForFunction()`, functions as `evaluate`/`addInitScript` args, `scroll` action option - CLI/MCP: Playwright now bundles the MCP server and `playwright-cli` (`npx playwright mcp` / `npx playwright cli`) - HTML reporter `mergeFiles` config option - Announcement: Debian 11 is no longer supported - Browser versions: Chromium 151.0.7922.34, Firefox 153.0, WebKit 26.5 Validated locally with `npm run doc`.
1 parent 05a306c commit f07e0f7

1 file changed

Lines changed: 132 additions & 0 deletions

File tree

‎docs/src/release-notes-js.md‎

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,138 @@ toc_max_heading_level: 2
66

77
import LiteYouTube from '@site/src/components/LiteYouTube';
88

9+
## Version 1.62
10+
11+
### 🧱 New component testing model
12+
13+
[Component testing](./test-components.md) moves to a **stories and galleries** model.
14+
A **story** wraps your component in one specific scenario — hard-coded props, mock data, providers — and a
15+
**gallery** page that you serve renders stories on demand. The new [`method: Fixtures.mount`] fixture navigates
16+
to the gallery, mounts a story by id, and returns a [Locator] scoped to the story's root element:
17+
18+
```js
19+
test('click should expand', async ({ mount }) => {
20+
const component = await mount('components/Expandable/Stateful');
21+
await component.getByRole('button').click();
22+
await expect(component.getByTestId('expanded')).toHaveValue('true');
23+
});
24+
```
25+
26+
Pass a story type as a template argument to type-check its props, and use `update(props)` /
27+
`unmount()` on the returned locator to re-render or tear down within a test.
28+
29+
### 🛑 Cancel operations with AbortSignal
30+
31+
Most operations and web-first assertions now accept a `signal` option that takes an
32+
[`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal), letting you
33+
cancel long-running actions, navigations, waits, and assertions:
34+
35+
```js
36+
const controller = new AbortController();
37+
setTimeout(() => controller.abort(), 1000);
38+
39+
await page.getByRole('button', { name: 'Submit' }).click({ signal: controller.signal });
40+
await expect(page.getByText('Done')).toBeVisible({ signal: controller.signal });
41+
```
42+
43+
Providing a signal does not disable the default timeout; pass `timeout: 0` to disable it.
44+
45+
### 🖼️ WebP screenshots
46+
47+
[`method: PageAssertions.toHaveScreenshot#1`] and [`method: LocatorAssertions.toHaveScreenshot#1`]
48+
can now store snapshots in the WebP format — just give the snapshot a `.webp` name:
49+
50+
```js
51+
// Visual comparisons store the golden snapshot as lossless WebP.
52+
await expect(page).toHaveScreenshot('homepage.webp');
53+
54+
// Standalone screenshots can trade quality for size with lossy WebP.
55+
await page.screenshot({ path: 'homepage.webp', quality: 50 });
56+
```
57+
58+
[`method: Page.screenshot`] and [`method: Locator.screenshot`] also accept `webp` as a `type`,
59+
where quality `100` (the default) is lossless and lower values use lossy compression.
60+
61+
### 🧩 Custom test filtering with Reporter.preprocess()
62+
63+
New [`method: Reporter.preprocess`] hook runs after the configuration is resolved and before
64+
[`method: Reporter.onBegin`], letting a reporter mark individual tests as skipped, excluded,
65+
fixed, or failing through a [TestRun] object:
66+
67+
```js
68+
class MyReporter {
69+
async preprocess({ config, suite, testRun }) {
70+
for (const test of suite.allTests()) {
71+
if (shouldSkip(test))
72+
testRun.skip(test);
73+
}
74+
}
75+
}
76+
```
77+
78+
### 🔁 Isolated retries
79+
80+
New [`property: TestConfig.retryStrategy`] controls when failed tests are retried. The default
81+
`'immediate'` retries as soon as a worker is free; `'isolated'` runs all retries at the end,
82+
one by one in a single worker, to minimize interference with the rest of the suite:
83+
84+
```js title="playwright.config.ts"
85+
export default defineConfig({
86+
retries: 2,
87+
retryStrategy: 'isolated',
88+
});
89+
```
90+
91+
### New APIs
92+
93+
#### Browser and Context
94+
95+
- New option [`option: BrowserContext.storageState.credentials`] includes the context's virtual WebAuthn [Credentials] (passkeys) in the storage state, so they can be persisted and re-seeded into later contexts.
96+
97+
#### Actions
98+
99+
- New `scroll` option (`"auto"` | `"none"`) on actions to opt out of Playwright's automatic scroll-into-view.
100+
101+
#### Network
102+
103+
- New [`method: APIResponse.timing`] returns resource timing information for an API response.
104+
105+
#### Evaluation
106+
107+
- New [`method: Locator.waitForFunction`] waits until a function — called with the matching element — returns a truthy value.
108+
- [`method: Page.evaluate`] and related methods now accept functions as evaluate arguments.
109+
- [`method: Page.addInitScript`] / [`method: BrowserContext.addInitScript`] now accept functions as init-script arguments.
110+
111+
#### Command line & MCP
112+
113+
- Playwright now bundles the [Playwright MCP](./getting-started-mcp.md) server and [`playwright-cli`](./getting-started-cli.md), runnable via `npx playwright mcp` and `npx playwright cli`.
114+
115+
#### Reporters
116+
117+
- The HTML report's **Merge files** grouping — previously only a UI toggle — can now be enabled from the config with the new `mergeFiles` reporter option:
118+
119+
```js title="playwright.config.ts"
120+
export default defineConfig({
121+
reporter: [['html', { mergeFiles: true }]],
122+
});
123+
```
124+
125+
### Announcements
126+
127+
* ⚠️ Debian 11 is not supported anymore.
128+
129+
### Browser Versions
130+
131+
- Chromium 151.0.7922.34
132+
- Mozilla Firefox 153.0
133+
- WebKit 26.5
134+
135+
This version was also tested against the following stable channels:
136+
137+
- Google Chrome 151
138+
- Microsoft Edge 151
139+
140+
9141
## Version 1.61
10142

11143
### 🔑 WebAuthn passkeys

0 commit comments

Comments
 (0)