v1.52.0
microsoft/playwrightv1.52.0Apr 17, 2025by mxschmitt
AI Summary
Adds new assertions like toContainClass, expands Aria Snapshot properties, introduces worker configuration and flaky test handling options, and updates glob URL patterns. Deprecates macOS 13.
Key Highlights
- New expect(locator).toContainClass() assertion
- New Aria Snapshot properties: /children and /url
- New testProject.workers property for concurrent workers
- New failOnFlakyTests config option
- HTML reporter now supports NOT filtering
Breaking Changes
- Glob URL patterns: '?' wildcard no longer supported, '[]' ranges no longer supported
- route.continue() no longer allows overriding Cookie header
- macOS 13 is deprecated and will no longer receive WebKit updates
New Features
- Class name assertions
- Enhanced Aria snapshots
- Worker configuration
- Flaky test detection
- API redirect limit control
Full Release Notes
## Highlights
- New method [expect(locator).toContainClass()](https://playwright.dev/docs/api/class-locatorassertions#locator-assertions-to-contain-class) to ergonomically assert individual class names on the element.
```ts
await expect(page.getByRole('listitem', { name: 'Ship v1.52' })).toContainClass('done');
```
- [Aria Snapshots](https://playwright.dev/docs/aria-snapshots) got two new properties: [`/children`](https://playwright.dev/docs/aria-snapshots#strict-matching) for strict matching and `/url` for links.
```ts
await expect(locator).toMatchAriaSnapshot(`
- list
- /children: equal
- listitem: Feature A
- listitem:
- link "Feature B":
- /url: "https://playwright.dev"
`);
```
## Test Runner
- New property [testProject.workers](https://playwright.dev/docs/api/class-testproject#test-project-workers) allows to specify the number of concurrent worker processes to use for a test project. The global limit of property [testConfig.workers](https://playwright.dev/docs/api/class-testconfig#test-config-workers) still applies.
- New [testConfig.failOnFlakyTests](https://playwright.dev/docs/api/class-testconfig#test-config-fail-on-flaky-tests) option to fail the test run if any flaky tests are detected, similarly to `--fail-on-flaky-tests`. This is useful for CI/CD environments where you want to ensure that all tests are stable before deploying.
- New property [testResult.annotations](https://playwright.dev/docs/api/class-testresult#test-result-annotations) contains annotations for each test retry.
## Miscellaneous
- New option [`maxRedirects`](https://playwright.dev/docs/api/class-apirequest#api-request-new-context-option-max-redirects) in [apiRequest.newContext()](https://playwright.dev/docs/api/class-apirequest#api-request-new-context) to control the maximum number of redirects.
- HTML reporter now supports *NOT filtering* via `!@my-tag` or `!my-file.spec.ts` or `!p:my-project`.
## Breaking Changes
- Changes to glob URL patterns in methods like [page.route()](https://playwright.dev/docs/api/class-page#page-route):
- `?` wildcard is not supported any more, it will always match question mark `?` character.
- Ranges/sets `[]` are not supported anymore. We recommend using regular expressions instead.
- Method [route.continue()](https://playwright.dev/docs/api/class-route#route-continue) does not allow to override the `Cookie` header anymore. If a `Cookie` header is provided, it will be ignored, and the cookie will be loaded from the browser's cookie store. To set custom cookies, use [browserContext.addCookies()](https://playwright.dev/docs/api/class-browsercontext#browser-context-add-cookies).
- macOS 13 is now deprecated and will no longer receive WebKit updates. Please upgrade to a more recent macOS version to continue benefiting from the latest WebKit improvements.
## Browser Versions
- Chromium 136.0.7103.25
- Mozilla Firefox 137.0
- WebKit 18.4
This version was also tested against the following stable channels:
- Google Chrome 135
- Microsoft Edge 135