diff --git a/docs/src/api/class-locatorassertions.md b/docs/src/api/class-locatorassertions.md index 3102ef085eb267..e070bbc60741fe 100644 --- a/docs/src/api/class-locatorassertions.md +++ b/docs/src/api/class-locatorassertions.md @@ -2122,7 +2122,7 @@ await expect(page.locator('body')).toMatchAriaSnapshot(` ``` ```python async -await page.goto('https://demo.playwright.dev/todomvc/') +await page.goto("https://demo.playwright.dev/todomvc/") await expect(page.locator('body')).to_match_aria_snapshot(''' - heading "todos" - textbox "What needs to be done?" @@ -2130,7 +2130,7 @@ await expect(page.locator('body')).to_match_aria_snapshot(''' ``` ```python sync -page.goto('https://demo.playwright.dev/todomvc/') +page.goto("https://demo.playwright.dev/todomvc/") expect(page.locator('body')).to_match_aria_snapshot(''' - heading "todos" - textbox "What needs to be done?" diff --git a/docs/src/aria-snapshots.md b/docs/src/aria-snapshots.md index 0b4673abefef9e..c26178bbe8e50a 100644 --- a/docs/src/aria-snapshots.md +++ b/docs/src/aria-snapshots.md @@ -67,19 +67,19 @@ await expect(page.locator('body')).toMatchAriaSnapshot(` ``` ```python sync -page.locator("body").to_match_aria_snapshot(""" +expect(page.locator("body")).to_match_aria_snapshot(""" - heading "title" """) ``` ```python async -await page.locator("body").to_match_aria_snapshot(""" +await expect(page.locator("body")).to_match_aria_snapshot(""" - heading "title" """) ``` ```java -page.locator("body").expect().toMatchAriaSnapshot(""" +assertThat(page.locator("body")).matchesAriaSnapshot(""" - heading "title" """); ``` @@ -185,7 +185,7 @@ interactive interface: - **"Assert snapshot" Action**: In the code generator, you can use the "Assert snapshot" action to automatically create a snapshot assertion for the selected elements. This is a quick way to capture the aria snapshot as part of your recorded test flow. - + - **"Aria snapshot" Tab**: The "Aria snapshot" tab within the code generator interface visually represents the aria snapshot for a selected locator, letting you explore, inspect, and verify element roles, attributes, and accessible names to aid snapshot creation and review. diff --git a/docs/src/release-notes-csharp.md b/docs/src/release-notes-csharp.md index c39e454ebcbd8e..89e813f08a35c2 100644 --- a/docs/src/release-notes-csharp.md +++ b/docs/src/release-notes-csharp.md @@ -5,6 +5,91 @@ toc_max_heading_level: 2 --- +## Version 1.49 + +### Aria snapshots + +New assertion [`method: LocatorAssertions.toMatchAriaSnapshot`] verifies page structure by comparing to an expected accessibility tree, represented as YAML. + +```csharp +await page.GotoAsync("https://playwright.dev"); +await Expect(page.Locator("body")).ToMatchAriaSnapshotAsync(@" + - banner: + - heading /Playwright enables reliable/ [level=1] + - link ""Get started"" + - link ""Star microsoft/playwright on GitHub"" + - main: + - img ""Browsers (Chromium, Firefox, WebKit)"" + - heading ""Any browser • Any platform • One API"" +"); +``` + +You can generate this assertion with [Test Generator](./codegen) or by calling [`method: Locator.ariaSnapshot`]. + +Learn more in the [aria snapshots guide](./aria-snapshots). + +### Tracing groups + +New method [`method: Tracing.group`] allows you to visually group actions in the trace viewer. + +```csharp +// All actions between GroupAsync and GroupEndAsync +// will be shown in the trace viewer as a group. +await Page.Context().Tracing.GroupAsync("Open Playwright.dev > API"); +await Page.GotoAsync("https://playwright.dev/"); +await Page.GetByRole(AriaRole.Link, new() { Name = "API" }).ClickAsync(); +await Page.Context().Tracing.GroupEndAsync(); +``` + +### Breaking: `chrome` and `msedge` channels switch to new headless mode + +This change affects you if you're using one of the following channels in your `playwright.config.ts`: +- `chrome`, `chrome-dev`, `chrome-beta`, or `chrome-canary` +- `msedge`, `msedge-dev`, `msedge-beta`, or `msedge-canary` + +After updating to Playwright v1.49, run your test suite. If it still passes, you're good to go. If not, you will probably need to update your snapshots, and adapt some of your test code around PDF viewers and extensions. See [issue #33566](https://github.com/microsoft/playwright/issues/33566) for more details. + +### Try new Chromium headless + +You can opt into the new headless mode by using `'chromium'` channel. As [official Chrome documentation puts it](https://developer.chrome.com/blog/chrome-headless-shell): + +> New Headless on the other hand is the real Chrome browser, and is thus more authentic, reliable, and offers more features. This makes it more suitable for high-accuracy end-to-end web app testing or browser extension testing. + +See [issue #33566](https://github.com/microsoft/playwright/issues/33566) for the list of possible breakages you could encounter and more details on Chromium headless. Please file an issue if you see any problems after opting in. + +```xml csharp title="runsettings.xml" + + + + chromium + + chromium + + + +``` + +```bash csharp +dotnet test -- Playwright.BrowserName=chromium Playwright.LaunchOptions.Channel=chromium +``` + +### Miscellaneous + +- There will be no more updates for WebKit on Ubuntu 20.04 and Debian 11. We recommend updating your OS to a later version. +- `` elements inside a snapshot now draw a preview. + +### Browser Versions + +- Chromium 131.0.6778.33 +- Mozilla Firefox 132.0 +- WebKit 18.2 + +This version was also tested against the following stable channels: + +- Google Chrome 130 +- Microsoft Edge 130 + + ## Version 1.48 ### WebSocket routing diff --git a/docs/src/release-notes-java.md b/docs/src/release-notes-java.md index a5d01668def386..ad63d6be563a2c 100644 --- a/docs/src/release-notes-java.md +++ b/docs/src/release-notes-java.md @@ -4,6 +4,79 @@ title: "Release notes" toc_max_heading_level: 2 --- +## Version 1.49 + +### Aria snapshots + +New assertion [`method: LocatorAssertions.toMatchAriaSnapshot`] verifies page structure by comparing to an expected accessibility tree, represented as YAML. + +```java +page.navigate("https://playwright.dev"); +assertThat(page.locator("body")).matchesAriaSnapshot(""" + - banner: + - heading /Playwright enables reliable/ [level=1] + - link "Get started" + - link "Star microsoft/playwright on GitHub" + - main: + - img "Browsers (Chromium, Firefox, WebKit)" + - heading "Any browser • Any platform • One API" +"""); +``` + +You can generate this assertion with [Test Generator](./codegen) or by calling [`method: Locator.ariaSnapshot`]. + +Learn more in the [aria snapshots guide](./aria-snapshots). + +### Tracing groups + +New method [`method: Tracing.group`] allows you to visually group actions in the trace viewer. + +```java +// All actions between group and groupEnd +// will be shown in the trace viewer as a group. +page.context().tracing.group("Open Playwright.dev > API"); +page.navigate("https://playwright.dev/"); +page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName("API")).click(); +page.context().tracing.groupEnd(); +``` + +### Breaking: `chrome` and `msedge` channels switch to new headless mode + +This change affects you if you're using one of the following channels in your `playwright.config.ts`: +- `chrome`, `chrome-dev`, `chrome-beta`, or `chrome-canary` +- `msedge`, `msedge-dev`, `msedge-beta`, or `msedge-canary` + +After updating to Playwright v1.49, run your test suite. If it still passes, you're good to go. If not, you will probably need to update your snapshots, and adapt some of your test code around PDF viewers and extensions. See [issue #33566](https://github.com/microsoft/playwright/issues/33566) for more details. + +### Try new Chromium headless + +You can opt into the new headless mode by using `'chromium'` channel. As [official Chrome documentation puts it](https://developer.chrome.com/blog/chrome-headless-shell): + +> New Headless on the other hand is the real Chrome browser, and is thus more authentic, reliable, and offers more features. This makes it more suitable for high-accuracy end-to-end web app testing or browser extension testing. + +See [issue #33566](https://github.com/microsoft/playwright/issues/33566) for the list of possible breakages you could encounter and more details on Chromium headless. Please file an issue if you see any problems after opting in. + +```java +Browser browser = playwright.chromium().launch(new BrowserType.LaunchOptions().setChannel("chromium")); +``` + +### Miscellaneous + +- There will be no more updates for WebKit on Ubuntu 20.04 and Debian 11. We recommend updating your OS to a later version. +- `` elements inside a snapshot now draw a preview. + +### Browser Versions + +- Chromium 131.0.6778.33 +- Mozilla Firefox 132.0 +- WebKit 18.2 + +This version was also tested against the following stable channels: + +- Google Chrome 130 +- Microsoft Edge 130 + + ## Version 1.48 ### WebSocket routing diff --git a/docs/src/release-notes-python.md b/docs/src/release-notes-python.md index 211e0ad5c2af84..5629bf10a740e0 100644 --- a/docs/src/release-notes-python.md +++ b/docs/src/release-notes-python.md @@ -4,6 +4,79 @@ title: "Release notes" toc_max_heading_level: 2 --- +## Version 1.49 + +### Aria snapshots + +New assertion [`method: LocatorAssertions.toMatchAriaSnapshot`] verifies page structure by comparing to an expected accessibility tree, represented as YAML. + +```python +page.goto("https://playwright.dev") +expect(page.locator('body')).to_match_aria_snapshot(''' + - banner: + - heading /Playwright enables reliable/ [level=1] + - link "Get started" + - link "Star microsoft/playwright on GitHub" + - main: + - img "Browsers (Chromium, Firefox, WebKit)" + - heading "Any browser • Any platform • One API" +''') +``` + +You can generate this assertion with [Test Generator](./codegen) or by calling [`method: Locator.ariaSnapshot`]. + +Learn more in the [aria snapshots guide](./aria-snapshots). + +### Tracing groups + +New method [`method: Tracing.group`] allows you to visually group actions in the trace viewer. + +```python +# All actions between group and group_end +# will be shown in the trace viewer as a group. +page.context.tracing.group("Open Playwright.dev > API") +page.goto("https://playwright.dev/") +page.get_by_role("link", name="API").click() +page.context.tracing.group_end() +``` + +### Breaking: `chrome` and `msedge` channels switch to new headless mode + +This change affects you if you're using one of the following channels in your `playwright.config.ts`: +- `chrome`, `chrome-dev`, `chrome-beta`, or `chrome-canary` +- `msedge`, `msedge-dev`, `msedge-beta`, or `msedge-canary` + +After updating to Playwright v1.49, run your test suite. If it still passes, you're good to go. If not, you will probably need to update your snapshots, and adapt some of your test code around PDF viewers and extensions. See [issue #33566](https://github.com/microsoft/playwright/issues/33566) for more details. + +### Try new Chromium headless + +You can opt into the new headless mode by using `'chromium'` channel. As [official Chrome documentation puts it](https://developer.chrome.com/blog/chrome-headless-shell): + +> New Headless on the other hand is the real Chrome browser, and is thus more authentic, reliable, and offers more features. This makes it more suitable for high-accuracy end-to-end web app testing or browser extension testing. + +See [issue #33566](https://github.com/microsoft/playwright/issues/33566) for the list of possible breakages you could encounter and more details on Chromium headless. Please file an issue if you see any problems after opting in. + +```bash python +pytest test_login.py --browser-channel chromium +``` + +### Miscellaneous + +- There will be no more updates for WebKit on Ubuntu 20.04 and Debian 11. We recommend updating your OS to a later version. +- `` elements inside a snapshot now draw a preview. + +### Browser Versions + +- Chromium 131.0.6778.33 +- Mozilla Firefox 132.0 +- WebKit 18.2 + +This version was also tested against the following stable channels: + +- Google Chrome 130 +- Microsoft Edge 130 + + ## Version 1.48 ### WebSocket routing