Change8

v1.52.0

Breaking Changes
📦 playwrightView on GitHub →
4 breaking7 features1 deprecations🔧 10 symbols

Summary

Playwright introduces new assertions, test runner options, and API enhancements while breaking glob pattern handling in routing and removing Cookie header overrides.

⚠️ Breaking Changes

  • `page.route()` glob URL patterns no longer support `?` wildcard; it now matches a literal question‑mark character.
  • `page.route()` glob URL patterns no longer support range/set syntax `[]`; use regular expressions instead.
  • `route.continue()` can no longer override the `Cookie` header; the header is ignored and cookies are taken from the browser’s cookie store. Use `browserContext.addCookies()` to set custom cookies.
  • macOS 13 is deprecated and will no longer receive WebKit updates; upgrade the OS to a newer version to continue receiving updates.

Migration Steps

  1. Replace any `?` wildcards or `[]` range/set patterns in `page.route()` calls with equivalent regular expressions.
  2. Remove attempts to set a `Cookie` header in `route.continue()`; instead call `browserContext.addCookies()` with the desired cookies before navigation.
  3. If your CI runs on macOS 13, upgrade the operating system to a newer macOS version to continue receiving WebKit updates.

✨ New Features

  • Added `expect(locator).toContainClass()` method to assert individual class names on an element.
  • Aria Snapshots now include `/children` property for strict matching and `/url` property for link URLs.
  • Introduced `testProject.workers` property to configure the number of concurrent worker processes per test project.
  • Added `testConfig.failOnFlakyTests` option to fail a test run when flaky tests are detected.
  • Added `testResult.annotations` property containing annotations for each test retry.
  • Added `maxRedirects` option to `apiRequest.newContext()` to control the maximum number of redirects.
  • HTML reporter now supports negated filtering using syntax like `!@my-tag`, `!my-file.spec.ts`, or `!p:my-project`.

🔧 Affected Symbols

LocatorAssertions.toContainClassAriaSnapshot (properties /children, /url)TestProject.workersTestConfig.failOnFlakyTestsTestResult.annotationsAPIRequest.newContext (maxRedirects)HTMLReporter filteringPage.routeRoute.continueBrowserContext.addCookies

⚡ Deprecations

  • Support for macOS 13 is deprecated; it will no longer receive WebKit updates.