mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
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
|
* langs: js
|
||||||
- `name` <[string]>
|
- `name` <[string]>
|
||||||
|
|
||||||
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.
|
||||||
### option: LocatorAssertions.toMatchAriaSnapshot#2.path
|
|
||||||
* since: v1.50
|
|
||||||
- `path` <[string]>
|
|
||||||
|
|
||||||
Path to the YAML snapshot file.
|
|
||||||
|
|
||||||
### option: LocatorAssertions.toMatchAriaSnapshot#2.timeout = %%-js-assertions-timeout-%%
|
### option: LocatorAssertions.toMatchAriaSnapshot#2.timeout = %%-js-assertions-timeout-%%
|
||||||
* since: v1.50
|
* since: v1.50
|
||||||
|
|||||||
@ -59,9 +59,7 @@ export async function toMatchAriaSnapshot(
|
|||||||
if (isString(expectedParam)) {
|
if (isString(expectedParam)) {
|
||||||
expected = expectedParam;
|
expected = expectedParam;
|
||||||
} else {
|
} else {
|
||||||
if (expectedParam?.path) {
|
if (expectedParam?.name) {
|
||||||
expectedPath = expectedParam.path;
|
|
||||||
} else if (expectedParam?.name) {
|
|
||||||
expectedPath = testInfo.snapshotPath(sanitizeFilePathBeforeExtension(expectedParam.name));
|
expectedPath = testInfo.snapshotPath(sanitizeFilePathBeforeExtension(expectedParam.name));
|
||||||
} else {
|
} else {
|
||||||
let snapshotNames = (testInfo as any)[snapshotNamesSymbol] as SnapshotNames;
|
let snapshotNames = (testInfo as any)[snapshotNamesSymbol] as SnapshotNames;
|
||||||
|
|||||||
9
packages/playwright/types/test.d.ts
vendored
9
packages/playwright/types/test.d.ts
vendored
@ -8697,16 +8697,11 @@ interface LocatorAssertions {
|
|||||||
*/
|
*/
|
||||||
toMatchAriaSnapshot(options?: {
|
toMatchAriaSnapshot(options?: {
|
||||||
/**
|
/**
|
||||||
* Name of the snapshot to store in the snapshot folder corresponding to this test. Generates ordinal name if not
|
* Name of the snapshot to store in the snapshot (screenshot) folder corresponding to this test. Generates sequential
|
||||||
* specified.
|
* names if not specified.
|
||||||
*/
|
*/
|
||||||
name?: string;
|
name?: string;
|
||||||
|
|
||||||
/**
|
|
||||||
* Path to the YAML snapshot file.
|
|
||||||
*/
|
|
||||||
path?: string;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time to retry the assertion for in milliseconds. Defaults to `timeout` in `TestConfig.expect`.
|
* 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);
|
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) => {
|
test('should generate multiple missing', async ({ runInlineTest }, testInfo) => {
|
||||||
const result = await runInlineTest({
|
const result = await runInlineTest({
|
||||||
'playwright.config.ts': `
|
'playwright.config.ts': `
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user