chore: remove toMatchAriaSnapshot.path (#34379)
This commit is contained in:
parent
d082805ea9
commit
9970446f51
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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`.
|
||||
*/
|
||||
|
|
|
@ -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(\`<h1>hello world</h1>\`);
|
||||
await expect(page.locator('body')).toMatchAriaSnapshot({ path: path.resolve(__dirname, 'test.yml') });
|
||||
});
|
||||
`
|
||||
});
|
||||
|
||||
expect(result.exitCode).toBe(0);
|
||||
});
|
||||
|
||||
test('should generate multiple missing', async ({ runInlineTest }, testInfo) => {
|
||||
const result = await runInlineTest({
|
||||
'playwright.config.ts': `
|
||||
|
|
Loading…
Reference in New Issue