Skip to content

Commit cd02be3

Browse files
committed
cherry-pick(#34379) chore: remove toMatchAriaSnapshot.path
1 parent 1b21ec9 commit cd02be3

File tree

4 files changed

+5
-35
lines changed

4 files changed

+5
-35
lines changed

docs/src/api/class-locatorassertions.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2274,13 +2274,8 @@ assertThat(page.locator("body")).matchesAriaSnapshot(new LocatorAssertions.Match
22742274
* langs: js
22752275
- `name` <[string]>
22762276

2277-
Name of the snapshot to store in the snapshot folder corresponding to this test. Generates ordinal name if not specified.
2278-
2279-
### option: LocatorAssertions.toMatchAriaSnapshot#2.path
2280-
* since: v1.50
2281-
- `path` <[string]>
2282-
2283-
Path to the YAML snapshot file.
2277+
Name of the snapshot to store in the snapshot (screenshot) folder corresponding to this test.
2278+
Generates sequential names if not specified.
22842279

22852280
### option: LocatorAssertions.toMatchAriaSnapshot#2.timeout = %%-js-assertions-timeout-%%
22862281
* since: v1.50

packages/playwright/src/matchers/toMatchAriaSnapshot.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,7 @@ export async function toMatchAriaSnapshot(
5959
if (isString(expectedParam)) {
6060
expected = expectedParam;
6161
} else {
62-
if (expectedParam?.path) {
63-
expectedPath = expectedParam.path;
64-
} else if (expectedParam?.name) {
62+
if (expectedParam?.name) {
6563
expectedPath = testInfo.snapshotPath(sanitizeFilePathBeforeExtension(expectedParam.name));
6664
} else {
6765
let snapshotNames = (testInfo as any)[snapshotNamesSymbol] as SnapshotNames;

packages/playwright/types/test.d.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8697,16 +8697,11 @@ interface LocatorAssertions {
86978697
*/
86988698
toMatchAriaSnapshot(options?: {
86998699
/**
8700-
* Name of the snapshot to store in the snapshot folder corresponding to this test. Generates ordinal name if not
8701-
* specified.
8700+
* Name of the snapshot to store in the snapshot (screenshot) folder corresponding to this test. Generates sequential
8701+
* names if not specified.
87028702
*/
87038703
name?: string;
87048704

8705-
/**
8706-
* Path to the YAML snapshot file.
8707-
*/
8708-
path?: string;
8709-
87108705
/**
87118706
* Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
87128707
*/

tests/playwright-test/aria-snapshot-file.spec.ts

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,24 +42,6 @@ test('should match snapshot with name', async ({ runInlineTest }, testInfo) => {
4242
expect(result.exitCode).toBe(0);
4343
});
4444

45-
test('should match snapshot with path', async ({ runInlineTest }, testInfo) => {
46-
const result = await runInlineTest({
47-
'test.yml': `
48-
- heading "hello world"
49-
`,
50-
'a.spec.ts': `
51-
import { test, expect } from '@playwright/test';
52-
import path from 'path';
53-
test('test', async ({ page }) => {
54-
await page.setContent(\`<h1>hello world</h1>\`);
55-
await expect(page.locator('body')).toMatchAriaSnapshot({ path: path.resolve(__dirname, 'test.yml') });
56-
});
57-
`
58-
});
59-
60-
expect(result.exitCode).toBe(0);
61-
});
62-
6345
test('should generate multiple missing', async ({ runInlineTest }, testInfo) => {
6446
const result = await runInlineTest({
6547
'playwright.config.ts': `

0 commit comments

Comments
 (0)