docs: update usage examples for toMatchAriaSnapshot in locator assertions

This commit is contained in:
Debbie O'Brien 2025-01-27 22:19:09 +01:00
parent c2b4cdc665
commit 8d869ec614

View file

@ -2249,23 +2249,6 @@ Asserts that the target element matches the given [accessibility snapshot](../ar
```js ```js
await expect(page.locator('body')).toMatchAriaSnapshot(); await expect(page.locator('body')).toMatchAriaSnapshot();
await expect(page.locator('body')).toMatchAriaSnapshot({ name: 'snapshot' });
```
```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 ### option: LocatorAssertions.toMatchAriaSnapshot#2.name
@ -2276,6 +2259,12 @@ assertThat(page.locator("body")).matchesAriaSnapshot(new LocatorAssertions.Match
Name of the snapshot to store in the snapshot (screenshot) folder corresponding to this test. Name of the snapshot to store in the snapshot (screenshot) folder corresponding to this test.
Generates sequential names if not specified. Generates sequential names if not specified.
**Usage**
```js
await expect(page.locator('body')).toMatchAriaSnapshot({ name: 'snapshot.yml' });
```
### option: LocatorAssertions.toMatchAriaSnapshot#2.timeout = %%-js-assertions-timeout-%% ### option: LocatorAssertions.toMatchAriaSnapshot#2.timeout = %%-js-assertions-timeout-%%
* since: v1.50 * since: v1.50