diff --git a/docs/src/aria-snapshots.md b/docs/src/aria-snapshots.md index a46c19198634a..00321151aadb1 100644 --- a/docs/src/aria-snapshots.md +++ b/docs/src/aria-snapshots.md @@ -13,8 +13,10 @@ await page.goto('https://playwright.dev/'); await expect(page.getByRole('banner')).toMatchAriaSnapshot(` - banner: - heading /Playwright enables reliable end-to-end/ [level=1] - - link "Get started" - - link "Star microsoft/playwright on GitHub" + - link "Get started": + - /url: /docs/intro + - link "Star microsoft/playwright on GitHub": + - /url: https://github.com/microsoft/playwright - link /[\\d]+k\\+ stargazers on GitHub/ `); ``` @@ -24,8 +26,10 @@ page.goto('https://playwright.dev/') expect(page.query_selector('banner')).to_match_aria_snapshot(""" - banner: - heading /Playwright enables reliable end-to-end/ [level=1] - - link "Get started" - - link "Star microsoft/playwright on GitHub" + - link "Get started": + - /url: /docs/intro + - link "Star microsoft/playwright on GitHub": + - /url: https://github.com/microsoft/playwright - link /[\\d]+k\\+ stargazers on GitHub/ """) ``` @@ -35,8 +39,10 @@ await page.goto('https://playwright.dev/') await expect(page.query_selector('banner')).to_match_aria_snapshot(""" - banner: - heading /Playwright enables reliable end-to-end/ [level=1] - - link "Get started" - - link "Star microsoft/playwright on GitHub" + - link "Get started": + - /url: /docs/intro + - link "Star microsoft/playwright on GitHub": + - /url: https://github.com/microsoft/playwright - link /[\\d]+k\\+ stargazers on GitHub/ """) ``` @@ -46,8 +52,10 @@ page.navigate("https://playwright.dev/"); assertThat(page.locator("banner")).matchesAriaSnapshot(""" - banner: - heading /Playwright enables reliable end-to-end/ [level=1] - - link "Get started" - - link "Star microsoft/playwright on GitHub" + - link "Get started": + - /url: /docs/intro + - link "Star microsoft/playwright on GitHub": + - /url: https://github.com/microsoft/playwright - link /[\\d]+k\\+ stargazers on GitHub/ """); ``` @@ -57,8 +65,10 @@ await page.GotoAsync("https://playwright.dev/"); await Expect(page.Locator("banner")).ToMatchAriaSnapshotAsync(@" - banner: - heading ""Playwright enables reliable end-to-end testing for modern web apps."" [level=1] - - link ""Get started"" - - link ""Star microsoft/playwright on GitHub"" + - link ""Get started"": + - /url: /docs/intro + - link ""Star microsoft/playwright on GitHub"": + - /url: https://github.com/microsoft/playwright - link /[\\d]+k\\+ stargazers on GitHub/ "); ``` @@ -215,9 +225,7 @@ attributes. ``` -*aria snapshot* - -```yaml +```yaml title="aria snapshot" - button ``` @@ -233,9 +241,7 @@ focusing solely on role and hierarchy. ``` -*aria snapshot for partial match* - -```yaml +```yaml title="aria snapshot (partial match)" - checkbox ``` @@ -253,9 +259,7 @@ Similarly, you can partially match children in lists or groups by omitting speci ``` -*aria snapshot for partial match* - -```yaml +```yaml title="aria snapshot (partial match)" - list - listitem: Feature B ``` @@ -275,9 +279,7 @@ By default, a template containing the subset of children will be matched: ``` -*aria snapshot for partial match* - -```yaml +```yaml title="aria snapshot (partial match)" - list - listitem: Feature B ``` @@ -296,9 +298,9 @@ The `/children` property can be used to control how child elements are matched: ``` -*aria snapshot will fail due to Feature C not being in the template* +Following snapshot will fail due to Feature C not being in the template: -```yaml +```yaml title="aria snapshot" - list - /children: equal - listitem: Feature A @@ -314,9 +316,7 @@ support regex patterns.

Issues 12

``` -*aria snapshot with regular expression* - -```yaml +```yaml title="aria snapshot" - heading /Issues \d+/ ``` @@ -445,9 +445,7 @@ Headings can include a `level` attribute indicating their heading level.

Subtitle

``` -*aria snapshot* - -```yaml +```yaml title="aria snapshot" - heading "Title" [level=1] - heading "Subtitle" [level=2] ``` @@ -460,9 +458,7 @@ Standalone or descriptive text elements appear as text nodes.
Sample accessible name
``` -*aria snapshot* - -```yaml +```yaml title="aria snapshot" - text: Sample accessible name ``` @@ -474,24 +470,33 @@ Multiline text, such as paragraphs, is normalized in the aria snapshot.

Line 1
Line 2

``` -*aria snapshot* - -```yaml +```yaml title="aria snapshot" - paragraph: Line 1 Line 2 ``` ### Links -Links display their text or composed content from pseudo-elements. +Links display their text or composed content from pseudo-elements. The link’s destination may be matched using the +`/url` property. ```html Read more about Accessibility ``` -*aria snapshot* +```yaml title="aria snapshot" +- link "Read more about Accessibility": + - /url: "#more-info" +``` -```yaml -- link "Read more about Accessibility" +The value of `/url` may also be a regular expression: + +```html +YouTube channel +``` + +```yaml title="aria snapshot" +- link: + - /url: /https://www.youtube.com/channel/.*/ ``` ### Text boxes @@ -502,9 +507,7 @@ Input elements of type `text` show their `value` attribute content. ``` -*aria snapshot* - -```yaml +```yaml title="aria snapshot" - textbox: Enter your name ``` @@ -519,9 +522,7 @@ Ordered and unordered lists include their list items. ``` -*aria snapshot* - -```yaml +```yaml title="aria snapshot" - list "Main Features": - listitem: Feature 1 - listitem: Feature 2 @@ -538,9 +539,7 @@ Groups capture nested elements, such as `
` elements with summary conten
``` -*aria snapshot* - -```yaml +```yaml title="aria snapshot" - group: Summary ``` @@ -555,9 +554,7 @@ control states. ``` -*aria snapshot* - -```yaml +```yaml title="aria snapshot" - checkbox [checked] ``` @@ -567,8 +564,6 @@ control states. ``` -*aria snapshot* - -```yaml +```yaml title="aria snapshot" - button "Toggle" [pressed=true] ``` diff --git a/docs/src/release-notes-csharp.md b/docs/src/release-notes-csharp.md index 269b4cdcac7b6..23a4750116e96 100644 --- a/docs/src/release-notes-csharp.md +++ b/docs/src/release-notes-csharp.md @@ -177,7 +177,7 @@ This version was also tested against the following stable channels: await Expect(Page.GetByRole(AriaRole.Listitem, new() { Name = "Ship v1.52" })).ToContainClassAsync("done"); ``` -- [Aria Snapshots](./aria-snapshots.md) got two new properties: [`/children`](./aria-snapshots.md#strict-matching) for strict matching and `/url` for links. +- [Aria Snapshots](./aria-snapshots.md) got two new properties: [`/children`](./aria-snapshots.md#strict-matching) for strict matching and [`/url`](./aria-snapshots.md#links) for links. ```csharp await Expect(locator).ToMatchAriaSnapshotAsync(@" diff --git a/docs/src/release-notes-java.md b/docs/src/release-notes-java.md index b6a18c2c2b61e..f907564084806 100644 --- a/docs/src/release-notes-java.md +++ b/docs/src/release-notes-java.md @@ -175,7 +175,7 @@ This version was also tested against the following stable channels: assertThat(page.getByRole(AriaRole.LISTITEM, new Page.GetByRoleOptions().setName("Ship v1.52"))).containsClass("done"); ``` -- [Aria Snapshots](./aria-snapshots.md) got two new properties: [`/children`](./aria-snapshots.md#strict-matching) for strict matching and `/url` for links. +- [Aria Snapshots](./aria-snapshots.md) got two new properties: [`/children`](./aria-snapshots.md#strict-matching) for strict matching and [`/url`](./aria-snapshots.md#links) for links. ```java assertThat(locator).toMatchAriaSnapshot(""" diff --git a/docs/src/release-notes-js.md b/docs/src/release-notes-js.md index 8ee02008a8fc4..5218a69edd399 100644 --- a/docs/src/release-notes-js.md +++ b/docs/src/release-notes-js.md @@ -301,7 +301,7 @@ This version was also tested against the following stable channels: await expect(page.getByRole('listitem', { name: 'Ship v1.52' })).toContainClass('done'); ``` -- [Aria Snapshots](./aria-snapshots.md) got two new properties: [`/children`](./aria-snapshots.md#strict-matching) for strict matching and `/url` for links. +- [Aria Snapshots](./aria-snapshots.md) got two new properties: [`/children`](./aria-snapshots.md#strict-matching) for strict matching and [`/url`](./aria-snapshots.md#links) for links. ```ts await expect(locator).toMatchAriaSnapshot(` diff --git a/docs/src/release-notes-python.md b/docs/src/release-notes-python.md index 663a604173784..da3b69fa866a0 100644 --- a/docs/src/release-notes-python.md +++ b/docs/src/release-notes-python.md @@ -177,7 +177,7 @@ This version was also tested against the following stable channels: expect(page.get_by_role('listitem', name='Ship v1.52')).to_contain_class('done') ``` -- [Aria Snapshots](./aria-snapshots.md) got two new properties: [`/children`](./aria-snapshots.md#strict-matching) for strict matching and `/url` for links. +- [Aria Snapshots](./aria-snapshots.md) got two new properties: [`/children`](./aria-snapshots.md#strict-matching) for strict matching and [`/url`](./aria-snapshots.md#links) for links. ```python expect(locator).to_match_aria_snapshot("""