Zum Inhalt springen
verdict:

Playwright 1.62.0

featured

note: die Zusammenfassung und die Release Notes sind auf Englisch

note: keine Zusammenfassung für dieses ältere Release

Wir fassen die neueren Releases zusammen. Die originalen Release Notes dieser Version stehen hier unten.

release-notesgithub.com/microsoft/playwright · 112 Zeilen
  1. ## 🧱 New component testing model
  2. [Component testing](https://playwright.dev/docs/test-components) moves to a **stories and galleries** model.
  3. 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.
  4. The new [fixtures.mount()](https://playwright.dev/docs/api/class-fixtures#fixtures-mount) fixture navigates to the gallery, mounts a story by id, and returns a [Locator](https://playwright.dev/docs/api/class-locator) scoped to the story's root element:
  5. ```js
  6. test('click should expand', async ({ mount }) => {
  7. const component = await mount('components/Expandable/Stateful');
  8. await component.getByRole('button').click();
  9. await expect(component.getByTestId('expanded')).toHaveValue('true');
  10. });
  11. ```
  12. 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.
  13. ## 🛑 Cancel operations with AbortSignal
  14. Most operations and web-first assertions now accept a `signal` option that takes an [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal), letting you cancel long-running actions, navigations, waits, and assertions:
  15. ```js
  16. const controller = new AbortController();
  17. setTimeout(() => controller.abort(), 1000);
  18. await page.getByRole('button', { name: 'Submit' }).click({ signal: controller.signal });
  19. await expect(page.getByText('Done')).toBeVisible({ signal: controller.signal });
  20. ```
  21. Providing a signal does not disable the default timeout; pass `timeout: 0` to disable it.
  22. ## 🖼️ WebP screenshots
  23. [expect(page).toHaveScreenshot()](https://playwright.dev/docs/api/class-pageassertions#page-assertions-to-have-screenshot-1) and [expect(locator).toHaveScreenshot()](https://playwright.dev/docs/api/class-locatorassertions#locator-assertions-to-have-screenshot-1) can now store snapshots in the WebP format — just give the snapshot a `.webp` name:
  24. ```js
  25. // Visual comparisons store the golden snapshot as lossless WebP.
  26. await expect(page).toHaveScreenshot('homepage.webp');
  27. // Standalone screenshots can trade quality for size with lossy WebP.
  28. await page.screenshot({ path: 'homepage.webp', quality: 50 });
  29. ```
  30. [page.screenshot()](https://playwright.dev/docs/api/class-page#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.
  31. ## 🧩 Custom test filtering with Reporter.preprocess()
  32. New [reporter.preprocess()](https://playwright.dev/docs/api/class-reporter#reporter-preprocess) hook runs after the configuration is resolved and before [reporter.onBegin()](https://playwright.dev/docs/api/class-reporter#reporter-on-begin), letting a reporter mark individual tests as skipped, excluded, fixed, or failing through a [TestRun](https://playwright.dev/docs/api/class-testrun) object:
  33. ```js
  34. class MyReporter {
  35. async preprocess({ config, suite, testRun }) {
  36. for (const test of suite.allTests()) {
  37. if (shouldSkip(test))
  38. testRun.skip(test);
  39. }
  40. }
  41. }
  42. ```
  43. ## 🔁 Isolated retries
  44. New [testConfig.retryStrategy](https://playwright.dev/docs/api/class-testconfig#test-config-retry-strategy) controls when failed tests are retried.
  45. 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:
  46. ```js
  47. // playwright.config.ts
  48. export default defineConfig({
  49. retries: 2,
  50. retryStrategy: 'isolated',
  51. });
  52. ```
  53. ## New APIs
  54. ### Browser and Context
  55. - New option [`credentials`](https://playwright.dev/docs/api/class-browsercontext#browser-context-storage-state-option-credentials) includes the context's virtual WebAuthn [Credentials](https://playwright.dev/docs/api/class-credentials) (passkeys) in the storage state, so they can be persisted and re-seeded into later contexts.
  56. ### Actions
  57. - New `scroll` option (`"auto"` | `"none"`) on actions to opt out of Playwright's automatic scroll-into-view.
  58. ### Network
  59. - New [apiResponse.timing()](https://playwright.dev/docs/api/class-apiresponse#api-response-timing) returns resource timing information for an API response.
  60. ### Evaluation
  61. - New [locator.waitForFunction()](https://playwright.dev/docs/api/class-locator#locator-wait-for-function) waits until a function — called with the matching element — returns a truthy value.
  62. - [page.evaluate()](https://playwright.dev/docs/api/class-page#page-evaluate) and related methods now accept functions as evaluate arguments.
  63. - [page.addInitScript()](https://playwright.dev/docs/api/class-page#page-add-init-script) / [browserContext.addInitScript()](https://playwright.dev/docs/api/class-browsercontext#browser-context-add-init-script) now accept functions as init-script arguments.
  64. ### Command line & MCP
  65. - Playwright now bundles the [Playwright MCP](https://playwright.dev/docs/getting-started-mcp) server and [`playwright-cli`](https://playwright.dev/docs/getting-started-cli), runnable via `npx playwright mcp` and `npx playwright cli`.
  66. ### Reporters
  67. - 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:
  68. ```js
  69. // playwright.config.ts
  70. export default defineConfig({
  71. reporter: [['html', { mergeFiles: true }]],
  72. });
  73. ```
  74. ## Announcements
  75. * ⚠️ Debian 11 is not supported anymore.
  76. ## Browser Versions
  77. - Chromium 151.0.7922.34
  78. - Mozilla Firefox 153.0
  79. - WebKit 26.5
  80. This version was also tested against the following stable channels:
  81. - Google Chrome 151
  82. - Microsoft Edge 151

auf github ansehenimported 2026-09-28 über npm