Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
docs: improve aria overload docs (#34319)
Pavel Feldmanb0f0a2951a1d
diff --git a/docs/src/api/class-locator.md b/docs/src/api/class-locator.mdindex 26b4b475d2..41ee8aab4f 100644--- a/docs/src/api/class-locator.md+++ b/docs/src/api/class-locator.md@@ -155,7 +155,7 @@ Additional locator to match.- returns: <[string]>Captures the aria snapshot of the given element.-Read more about [aria snapshots](../aria-snapshots.md) and [`method: LocatorAssertions.toMatchAriaSnapshot#2`] for the corresponding assertion.+Read more about [aria snapshots](../aria-snapshots.md) and [`method: LocatorAssertions.toMatchAriaSnapshot#1`] for the corresponding assertion.**Usage**diff --git a/docs/src/api/class-locatorassertions.md b/docs/src/api/class-locatorassertions.mdindex 968d6375d7..cb5f56027c 100644--- a/docs/src/api/class-locatorassertions.md+++ b/docs/src/api/class-locatorassertions.md@@ -446,7 +446,7 @@ Expected options currently selected.* since: v1.49* langs: python-The opposite of [`method: LocatorAssertions.toMatchAriaSnapshot#2`].+The opposite of [`method: LocatorAssertions.toMatchAriaSnapshot#1`].### param: LocatorAssertions.NotToMatchAriaSnapshot.expected* since: v1.49@@ -2182,57 +2182,6 @@ Expected options currently selected.## async method: LocatorAssertions.toMatchAriaSnapshot#1-* since: v1.50-* langs:- - alias-java: matchesAriaSnapshot--Asserts that the target element matches the given [accessibility snapshot](../aria-snapshots.md).--**Usage**--```js-await expect(page.locator('body')).toMatchAriaSnapshot();-await expect(page.locator('body')).toMatchAriaSnapshot({ name: 'snapshot' });-await expect(page.locator('body')).toMatchAriaSnapshot({ path: '/path/to/snapshot.yml' });-```--```python async-await expect(page.locator('body')).to_match_aria_snapshot(path='/path/to/snapshot.yml')-```--```python sync-expect(page.locator('body')).to_match_aria_snapshot(path='/path/to/snapshot.yml')-```--```csharp-await Expect(page.Locator("body")).ToMatchAriaSnapshotAsync(new { Path = "/path/to/snapshot.yml" });-```--```java-assertThat(page.locator("body")).matchesAriaSnapshot(new LocatorAssertions.MatchesAriaSnapshotOptions().setPath("/path/to/snapshot.yml"));-```--### option: LocatorAssertions.toMatchAriaSnapshot#1.name-* since: v1.50-* langs: js-- `name` <[string]>--Name of the snapshot to store in the snapshot folder corresponding to this test. Generates ordinal name if not specified.--### option: LocatorAssertions.toMatchAriaSnapshot#1.path-* since: v1.50-- `path` <[string]>--Path to the YAML snapshot file.--### option: LocatorAssertions.toMatchAriaSnapshot#1.timeout = %%-js-assertions-timeout-%%-* since: v1.50--### option: LocatorAssertions.toMatchAriaSnapshot#1.timeout = %%-csharp-java-python-assertions-timeout-%%-* since: v1.50---## async method: LocatorAssertions.toMatchAriaSnapshot#2* since: v1.49* langs:- alias-java: matchesAriaSnapshot@@ -2281,12 +2230,62 @@ assertThat(page.locator("body")).matchesAriaSnapshot("""""");```-### param: LocatorAssertions.toMatchAriaSnapshot#2.expected+### param: LocatorAssertions.toMatchAriaSnapshot#1.expected* since: v1.49- `expected` <string>-### option: LocatorAssertions.toMatchAriaSnapshot#2.timeout = %%-js-assertions-timeout-%%+### option: LocatorAssertions.toMatchAriaSnapshot#1.timeout = %%-js-assertions-timeout-%%* since: v1.49-### option: LocatorAssertions.toMatchAriaSnapshot#2.timeout = %%-csharp-java-python-assertions-timeout-%%+### option: LocatorAssertions.toMatchAriaSnapshot#1.timeout = %%-csharp-java-python-assertions-timeout-%%* since: v1.49++## async method: LocatorAssertions.toMatchAriaSnapshot#2+* since: v1.50+* langs:+ - alias-java: matchesAriaSnapshot++Asserts that the target element matches the given [accessibility snapshot](../aria-snapshots.md).++**Usage**++```js+await expect(page.locator('body')).toMatchAriaSnapshot();+await expect(page.locator('body')).toMatchAriaSnapshot({ name: 'snapshot' });+await expect(page.locator('body')).toMatchAriaSnapshot({ path: '/path/to/snapshot.yml' });+```++```python async+await expect(page.locator('body')).to_match_aria_snapshot(path='/path/to/snapshot.yml')+```++```python sync+expect(page.locator('body')).to_match_aria_snapshot(path='/path/to/snapshot.yml')+```++```csharp+await Expect(page.Locator("body")).ToMatchAriaSnapshotAsync(new { Path = "/path/to/snapshot.yml" });+```++```java+assertThat(page.locator("body")).matchesAriaSnapshot(new LocatorAssertions.MatchesAriaSnapshotOptions().setPath("/path/to/snapshot.yml"));+```++### option: LocatorAssertions.toMatchAriaSnapshot#2.name+* since: v1.50+* langs: js+- `name` <[string]>++Name of the snapshot to store in the snapshot folder corresponding to this test. Generates ordinal name if not specified.++### option: LocatorAssertions.toMatchAriaSnapshot#2.path+* since: v1.50+- `path` <[string]>++Path to the YAML snapshot file.++### option: LocatorAssertions.toMatchAriaSnapshot#2.timeout = %%-js-assertions-timeout-%%+* since: v1.50++### option: LocatorAssertions.toMatchAriaSnapshot#2.timeout = %%-csharp-java-python-assertions-timeout-%%+* since: v1.50diff --git a/docs/src/aria-snapshots.md b/docs/src/aria-snapshots.mdindex 27d1c0ebce..b52ff82650 100644--- a/docs/src/aria-snapshots.md+++ b/docs/src/aria-snapshots.md@@ -154,7 +154,7 @@ structure of a page, use the [Chrome DevTools Accessibility Pane](https://develo## Snapshot matching-The [`method: LocatorAssertions.toMatchAriaSnapshot#2`] assertion method in Playwright compares the accessible+The [`method: LocatorAssertions.toMatchAriaSnapshot#1`] assertion method in Playwright compares the accessiblestructure of the locator scope with a predefined aria snapshot template, helping validate the page's state againsttesting requirements.diff --git a/docs/src/release-notes-csharp.md b/docs/src/release-notes-csharp.mdindex 0d2681c874..dab0fdf34e 100644--- a/docs/src/release-notes-csharp.md+++ b/docs/src/release-notes-csharp.md@@ -9,7 +9,7 @@ toc_max_heading_level: 2### Aria snapshots-New assertion [`method: LocatorAssertions.toMatchAriaSnapshot#2`] verifies page structure by comparing to an expected accessibility tree, represented as YAML.+New assertion [`method: LocatorAssertions.toMatchAriaSnapshot#1`] verifies page structure by comparing to an expected accessibility tree, represented as YAML.```csharpawait page.GotoAsync("https://playwright.dev");diff --git a/docs/src/release-notes-java.md b/docs/src/release-notes-java.mdindex 317c1c5398..651d2890da 100644--- a/docs/src/release-notes-java.md+++ b/docs/src/release-notes-java.md@@ -8,7 +8,7 @@ toc_max_heading_level: 2### Aria snapshots-New assertion [`method: LocatorAssertions.toMatchAriaSnapshot#2`] verifies page structure by comparing to an expected accessibility tree, represented as YAML.+New assertion [`method: LocatorAssertions.toMatchAriaSnapshot#1`] verifies page structure by comparing to an expected accessibility tree, represented as YAML.```javapage.navigate("https://playwright.dev");diff --git a/docs/src/release-notes-js.md b/docs/src/release-notes-js.mdindex 0595933b80..9d26d41551 100644--- a/docs/src/release-notes-js.md+++ b/docs/src/release-notes-js.md@@ -15,7 +15,7 @@ import LiteYouTube from '@site/src/components/LiteYouTube';### Aria snapshots-New assertion [`method: LocatorAssertions.toMatchAriaSnapshot#2`] verifies page structure by comparing to an expected accessibility tree, represented as YAML.+New assertion [`method: LocatorAssertions.toMatchAriaSnapshot#1`] verifies page structure by comparing to an expected accessibility tree, represented as YAML.```jsawait page.goto('https://playwright.dev');diff --git a/docs/src/release-notes-python.md b/docs/src/release-notes-python.mdindex f2002f15fd..14f84f395c 100644--- a/docs/src/release-notes-python.md+++ b/docs/src/release-notes-python.md@@ -8,7 +8,7 @@ toc_max_heading_level: 2### Aria snapshots-New assertion [`method: LocatorAssertions.toMatchAriaSnapshot#2`] verifies page structure by comparing to an expected accessibility tree, represented as YAML.+New assertion [`method: LocatorAssertions.toMatchAriaSnapshot#1`] verifies page structure by comparing to an expected accessibility tree, represented as YAML.```pythonpage.goto("https://playwright.dev")diff --git a/packages/playwright-core/types/types.d.ts b/packages/playwright-core/types/types.d.tsindex 21b531b07a..d35137fbe2 100644--- a/packages/playwright-core/types/types.d.ts+++ b/packages/playwright-core/types/types.d.ts@@ -12429,7 +12429,7 @@ export interface Locator {/*** Captures the aria snapshot of the given element. Read more about [aria snapshots](https://playwright.dev/docs/aria-snapshots) and- * [expect(locator).toMatchAriaSnapshot(expected[, options])](https://playwright.dev/docs/api/class-locatorassertions#locator-assertions-to-match-aria-snapshot-2)+ * [expect(locator).toMatchAriaSnapshot(expected[, options])](https://playwright.dev/docs/api/class-locatorassertions#locator-assertions-to-match-aria-snapshot-1)* for the corresponding assertion.** **Usage**diff --git a/packages/playwright/types/test.d.ts b/packages/playwright/types/test.d.tsindex 194a3c4664..56407fe1e0 100644--- a/packages/playwright/types/test.d.ts+++ b/packages/playwright/types/test.d.ts@@ -8688,25 +8688,17 @@ interface LocatorAssertions {* **Usage**** ```js- * await expect(page.locator('body')).toMatchAriaSnapshot();- * await expect(page.locator('body')).toMatchAriaSnapshot({ name: 'snapshot' });- * await expect(page.locator('body')).toMatchAriaSnapshot({ path: '/path/to/snapshot.yml' });+ * await page.goto('https://demo.playwright.dev/todomvc/');+ * await expect(page.locator('body')).toMatchAriaSnapshot(`+ * - heading "todos"+ * - textbox "What needs to be done?"+ * `);* ```*+ * @param expected* @param options*/- toMatchAriaSnapshot(options?: {- /**- * Name of the snapshot to store in the snapshot folder corresponding to this test. Generates ordinal name if not- * specified.- */- name?: string;-- /**- * Path to the YAML snapshot file.- */- path?: string;-+ toMatchAriaSnapshot(expected: string, options?: {/*** Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.*/@@ -8719,17 +8711,25 @@ interface LocatorAssertions {* **Usage**** ```js- * await page.goto('https://demo.playwright.dev/todomvc/');- * await expect(page.locator('body')).toMatchAriaSnapshot(`- * - heading "todos"- * - textbox "What needs to be done?"- * `);+ * await expect(page.locator('body')).toMatchAriaSnapshot();+ * await expect(page.locator('body')).toMatchAriaSnapshot({ name: 'snapshot' });+ * await expect(page.locator('body')).toMatchAriaSnapshot({ path: '/path/to/snapshot.yml' });* ```*- * @param expected* @param options*/- toMatchAriaSnapshot(expected: string, options?: {+ toMatchAriaSnapshot(options?: {+ /**+ * Name of the snapshot to store in the snapshot folder corresponding to this test. Generates ordinal name if not+ * specified.+ */+ name?: string;++ /**+ * Path to the YAML snapshot file.+ */+ path?: string;+/*** Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.*/