Aller au contenu
verdict:

Playwright 1.64.0

featured

note: la synthèse et les notes de version sont en anglais

warning: action requise

4 breaking changes5 points clés

Adds WebMCP tool testing, custom video frame rates, and Locator.within(), with a few breaking changes to review.

synthèse · uniquement d’après les notes de version · claude-haiku-5-5 · prompt v7

breaking changestous cités, chacun avec un correctif

breaking[1]: Device descriptors now forward screen, so window.screen and media queries see the emulated screen size.

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:

help: Set screen: undefined in use to opt out of the forwarded screen size.

breaking[2]: JSX in test files now follows the jsx and related options in tsconfig.json, defaulting to the automatic runtime from react/jsx-runtime.

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.

help: Check the jsx, jsxFactory, jsxFragmentFactory and jsxImportSource options in your tsconfig.json.

breaking[3]: --update-snapshots=missing now passes the test run when tests only create missing snapshots, and the unspecified mode is renamed 'default'.

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

help: Use the 'missing' mode in CI when you want new snapshots generated and existing ones verified in one run; the 'default' mode writes missing snapshots and fails the test as before.

breaking[4]: Elements inside an iframe that is not visible are now considered hidden by actions, locator.isVisible() and toBeVisible().

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().

help: Check tests that interact with elements inside hidden iframes, since those actions and assertions now treat them as hidden.

points clés

release-notesgithub.com/microsoft/playwright · 171 lignes
  1. ## 🧰 WebMCP
  2. New [page.webmcp](https://playwright.dev/docs/api/class-page#page-webmcp) and [frame.webmcp](https://playwright.dev/docs/api/class-frame#frame-webmcp) give access to the tools that a page registers through the experimental [WebMCP](https://playwright.dev/docs/api/class-webmcp) browser API, so you can test them like any other part of your app:
  3. ```js
  4. const browser = await chromium.launch({ args: ['--enable-features=WebMCP'] });
  5. const page = await browser.newPage();
  6. await page.goto('https://example.com');
  7. for (const tool of await page.webmcp.tools())
  8. console.log(tool.name, tool.description);
  9. const result = await page.webmcp.callTool('add', { a: 2, b: 40 });
  10. console.log(result.content[0].text); // "42"
  11. ```
  12. [Playwright MCP](https://playwright.dev/docs/getting-started-mcp) also supports WebMCP by default, with page-defined tools offered to the agent as `webmcp_<tool>`. Pass `--no-webmcp` to opt out.
  13. [`playwright-cli`](https://playwright.dev/docs/getting-started-cli) exposes them as well:
  14. ```bash
  15. playwright-cli webmcp-list
  16. playwright-cli webmcp-call search_catalog --params '{"query":"cats"}'
  17. ```
  18. ## 🎬 Better videos
  19. Videos can now be recorded at a custom frame rate, and the decorations for actions are styled with plain CSS:
  20. ```js
  21. // playwright.config.ts
  22. import { defineConfig } from '@playwright/test';
  23. export default defineConfig({
  24. use: {
  25. video: {
  26. mode: 'on',
  27. size: { width: 1920, height: 1080 },
  28. fps: 60,
  29. show: {
  30. actions: {
  31. style: {
  32. point: 'width: 20px; height: 20px; border-radius: 50%; background: red',
  33. highlight: 'outline: 2px solid #333; background: rgba(0, 128, 255, .15)',
  34. title: 'font-size: 16px',
  35. },
  36. },
  37. },
  38. },
  39. },
  40. });
  41. ```
  42. - New `fps` option in [testOptions.video](https://playwright.dev/docs/api/class-testoptions#test-options-video), [`recordVideo`](https://playwright.dev/docs/api/class-browser#browser-new-context-option-record-video) and
  43. [screencast.start()](https://playwright.dev/docs/api/class-screencast#screencast-start). Firefox and WebKit currently capture up to 25 frames per second.
  44. - New [`style`](https://playwright.dev/docs/api/class-screencast#screencast-show-actions-option-style) option takes CSS declarations for the `point` marker, the target
  45. `highlight` and the action `title`. It replaces the `fontSize` option, which is now deprecated.
  46. - The cursor stays visible at the last action point, survives navigations and travels along a natural, eased path.
  47. - Videos are encoded with VP9 instead of VP8, which takes less CPU and produces smaller files of the same or better
  48. quality.
  49. - All video options are also available in [Playwright MCP](https://playwright.dev/docs/getting-started-mcp) and [`playwright-cli`](https://playwright.dev/docs/getting-started-cli).
  50. ## 🎯 Test runner
  51. - New [testProject.default](https://playwright.dev/docs/api/class-testproject#test-project-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:
  52. ```js
  53. // playwright.config.ts
  54. import { defineConfig, devices } from '@playwright/test';
  55. export default defineConfig({
  56. projects: [
  57. { name: 'chromium', use: devices['Desktop Chrome'] },
  58. { name: 'firefox', use: devices['Desktop Firefox'], default: false },
  59. { name: 'webkit', use: devices['Desktop Safari'], default: false },
  60. ],
  61. });
  62. ```
  63. ```bash
  64. npx playwright test # runs chromium only
  65. npx playwright test --project=firefox # runs firefox
  66. npx playwright test --project="*" # runs all three, for example on CI
  67. ```
  68. - New `--shuffle` command line option schedules tests in a random order, which helps to find tests that accidentally depend on each other.
  69. ```bash
  70. npx playwright test --shuffle
  71. # Running 42 tests using 4 workers, shuffle seed 271828182
  72. # ...
  73. # Pass the seed to reproduce the same order.
  74. npx playwright test --shuffle 271828182
  75. ```
  76. - New `lock` option in [test.describe.configure()](https://playwright.dev/docs/api/class-test#test-describe-configure) adds [test locks](https://playwright.dev/docs/test-parallel#test-locks) to all tests in a file or a group:
  77. ```js
  78. test.describe.configure({ lock: 'user-settings' });
  79. ```
  80. - New `type` option of `toHaveScreenshot` in [testConfig.expect](https://playwright.dev/docs/api/class-testconfig#test-config-expect) stores all unnamed screenshots as WebP:
  81. ```js
  82. // playwright.config.ts
  83. export default defineConfig({
  84. expect: {
  85. toHaveScreenshot: { type: 'webp' },
  86. },
  87. });
  88. ```
  89. ## 🪆 Locator.within()
  90. New [locator.within()](https://playwright.dev/docs/api/class-locator#locator-within) combines two locators that you already have, reading in the natural order —
  91. "this button, within that dialog":
  92. ```js
  93. const saveButton = page.getByRole('button', { name: 'Save' });
  94. const dialog = page.getByTestId('settings-dialog');
  95. await saveButton.within(dialog).click();
  96. ```
  97. Relative locators such as [locator.nth()](https://playwright.dev/docs/api/class-locator#locator-nth) or [locator.first()](https://playwright.dev/docs/api/class-locator#locator-first) are resolved inside each parent
  98. separately, which makes column-like queries straightforward:
  99. ```js
  100. // The third cell of every row, not the third cell in the table.
  101. const thirdColumn = page.getByRole('cell').nth(2).within(page.getByRole('row'));
  102. await expect(thirdColumn).toHaveText(['Apple', 'Banana', 'Cherry']);
  103. ```
  104. ## New APIs
  105. - New [page.getByRef()](https://playwright.dev/docs/api/class-page#page-get-by-ref) locates an element by its aria ref, such as `e2`, reported by [page.ariaSnapshot()](https://playwright.dev/docs/api/class-page#page-aria-snapshot) in the `'ai'` mode.
  106. - New option [`includeShadow`](https://playwright.dev/docs/api/class-page#page-content-option-include-shadow) in [page.content()](https://playwright.dev/docs/api/class-page#page-content) and [frame.content()](https://playwright.dev/docs/api/class-frame#frame-content) serializes open shadow roots as [declarative shadow DOM](https://developer.mozilla.org/en-US/docs/Web/API/Web_components/Using_shadow_DOM#declaratively_with_html).
  107. - New option [`signCount`](https://playwright.dev/docs/api/class-credentials#credentials-create-option-sign-count) sets the initial signature counter of a virtual credential. [credentials.create()](https://playwright.dev/docs/api/class-credentials#credentials-create) and [credentials.get()](https://playwright.dev/docs/api/class-credentials#credentials-get) return the current `signCount`, and it is saved and restored together with the credentials in the storage state.
  108. - New [fullConfig.filteredProjects](https://playwright.dev/docs/api/class-fullconfig#full-config-filtered-projects) lists the projects that were selected to run after applying the `--project` filter. It is available in global setup and reporters.
  109. - New [apiRequestContext.addCookies()](https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-add-cookies), [apiRequestContext.cookies()](https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-cookies) and [apiRequestContext.clearCookies()](https://playwright.dev/docs/api/class-apirequestcontext#api-request-context-clear-cookies) manage cookies of a request context, mirroring the [BrowserContext](https://playwright.dev/docs/api/class-browsercontext) methods:
  110. ```js
  111. await request.addCookies([{ name: 'session-id', value: '42', url: 'https://example.com' }]);
  112. console.log(await request.cookies('https://example.com'));
  113. await request.clearCookies({ name: 'session-id' });
  114. ```
  115. ## Breaking changes ⚠️
  116. - `screen` property is now forwarded from the [device descriptors](https://playwright.dev/docs/emulation#devices). 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`:
  117. ```js
  118. // playwright.config.ts
  119. export default defineConfig({
  120. use: {
  121. ...devices['Desktop Chrome'],
  122. screen: undefined,
  123. },
  124. });
  125. ```
  126. - 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](https://playwright.dev/docs/test-typescript#tsconfig-jsx-options), and defaults to the automatic runtime from `react/jsx-runtime`.
  127. - `--update-snapshots=missing` now passes the test run. Tests that only create missing snapshots now pass in the `'missing'` mode of [testConfig.updateSnapshots](https://playwright.dev/docs/api/class-testconfig#test-config-update-snapshots), 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.
  128. - 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()](https://playwright.dev/docs/api/class-locator#locator-is-visible) and [expect(locator).toBeVisible()](https://playwright.dev/docs/api/class-locatorassertions#locator-assertions-to-be-visible).
  129. ## Browser Versions
  130. - Chromium 156.0.8078.4
  131. - Mozilla Firefox 157.0
  132. - WebKit 27.2
  133. This version was also tested against the following stable channels:
  134. - Google Chrome 155
  135. - Microsoft Edge 155

voir sur githubdetected 2026-10-08 via npm