diff --git a/docs/src/api/class-locatorassertions.md b/docs/src/api/class-locatorassertions.md index 63b487208f..35f64ea711 100644 --- a/docs/src/api/class-locatorassertions.md +++ b/docs/src/api/class-locatorassertions.md @@ -2274,13 +2274,8 @@ assertThat(page.locator("body")).matchesAriaSnapshot(new LocatorAssertions.Match * 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. +Name of the snapshot to store in the snapshot (screenshot) folder corresponding to this test. +Generates sequential names if not specified. ### option: LocatorAssertions.toMatchAriaSnapshot#2.timeout = %%-js-assertions-timeout-%% * since: v1.50 diff --git a/packages/playwright/src/matchers/toMatchAriaSnapshot.ts b/packages/playwright/src/matchers/toMatchAriaSnapshot.ts index 152ceb6ba9..c291770fd5 100644 --- a/packages/playwright/src/matchers/toMatchAriaSnapshot.ts +++ b/packages/playwright/src/matchers/toMatchAriaSnapshot.ts @@ -59,9 +59,7 @@ export async function toMatchAriaSnapshot( if (isString(expectedParam)) { expected = expectedParam; } else { - if (expectedParam?.path) { - expectedPath = expectedParam.path; - } else if (expectedParam?.name) { + if (expectedParam?.name) { expectedPath = testInfo.snapshotPath(sanitizeFilePathBeforeExtension(expectedParam.name)); } else { let snapshotNames = (testInfo as any)[snapshotNamesSymbol] as SnapshotNames; diff --git a/packages/playwright/types/test.d.ts b/packages/playwright/types/test.d.ts index e01271ceec..b67377eb6d 100644 --- a/packages/playwright/types/test.d.ts +++ b/packages/playwright/types/test.d.ts @@ -8697,16 +8697,11 @@ interface LocatorAssertions { */ toMatchAriaSnapshot(options?: { /** - * Name of the snapshot to store in the snapshot folder corresponding to this test. Generates ordinal name if not - * specified. + * Name of the snapshot to store in the snapshot (screenshot) folder corresponding to this test. Generates sequential + * names 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`. */ diff --git a/tests/playwright-test/aria-snapshot-file.spec.ts b/tests/playwright-test/aria-snapshot-file.spec.ts index c05ae3897d..18ebc072cc 100644 --- a/tests/playwright-test/aria-snapshot-file.spec.ts +++ b/tests/playwright-test/aria-snapshot-file.spec.ts @@ -42,24 +42,6 @@ test('should match snapshot with name', async ({ runInlineTest }, testInfo) => { expect(result.exitCode).toBe(0); }); -test('should match snapshot with path', async ({ runInlineTest }, testInfo) => { - const result = await runInlineTest({ - 'test.yml': ` - - heading "hello world" - `, - 'a.spec.ts': ` - import { test, expect } from '@playwright/test'; - import path from 'path'; - test('test', async ({ page }) => { - await page.setContent(\`