Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: per-assertion snapshot path template in config #34537

Merged
merged 1 commit into from
Jan 29, 2025

Conversation

dgozman
Copy link
Contributor

@dgozman dgozman commented Jan 29, 2025

Introduces the following properties in the config that take precedence over config.snapshotPathTemplate.

export default {
  expect: {
    toHaveScreenshot: {
      pathTemplate: '__screenshots__{/projectName}/{testFilePath}/{arg}{ext}',
    },
    toMatchAriaSnapshot: {
      pathTemplate: '__snapshots__/{testFilePath}/{arg}{ext}',
    },
  },
};

Additionally, changes the default template for aria snapshots to:

{snapshotDir}/{testFileDir}/{testFileName}-snapshots/{arg}{ext}

This is technically a breaking change.

Fixes #34483.

Introduces the following properties in the config that take
precedence over `config.snapshotPathTemplate`.

```ts
export default {
  expect: {
    toHaveScreenshot: {
      pathTemplate: '__screenshots__{/projectName}/{testFilePath}/{arg}{ext}',
    },
    toMatchAriaSnapshot: {
      pathTemplate: '__snapshots__/{testFilePath}/{arg}{ext}',
    },
  },
};
```

Additionally, changes the default template for aria snapshots to:
```
{snapshotDir}/{testFileDir}/{testFileName}-snapshots/{arg}{ext}
```
This is technically a breaking change.
Copy link
Contributor

Test results for "tests 1"

14 flaky ⚠️ [firefox-page] › tests/page/page-evaluate.spec.ts:403:3 › should throw for too deep reference chain @firefox-ubuntu-22.04-node18
⚠️ [installation tests] › tests/typescript-types.spec.ts:18:5 › typescript types should work @package-installations-macos-latest
⚠️ [webkit-library] › tests/library/popup.spec.ts💯3 › should inherit touch support from browser context @webkit-ubuntu-22.04-node18
⚠️ [webkit-library] › tests/library/popup.spec.ts:115:3 › should inherit viewport size from browser context @webkit-ubuntu-22.04-node18
⚠️ [webkit-library] › tests/library/screenshot.spec.ts:44:14 › page screenshot › should work with a mobile viewport @webkit-ubuntu-22.04-node18
⚠️ [webkit-library] › tests/library/selector-generator.spec.ts:564:5 › selector generator › should generate multiple: noText in role @webkit-ubuntu-22.04-node18
⚠️ [webkit-library] › tests/library/video.spec.ts:441:5 › screencast › should work for popups @webkit-ubuntu-22.04-node18
⚠️ [webkit-library] › tests/library/video.spec.ts:475:5 › screencast › should scale frames down to the requested size @webkit-ubuntu-22.04-node18
⚠️ [webkit-page] › tests/page/page-leaks.spec.ts:82:5 › click should not leak @webkit-ubuntu-22.04-node18
⚠️ [webkit-page] › tests/page/page-leaks.spec.ts:107:5 › fill should not leak @webkit-ubuntu-22.04-node18
⚠️ [webkit-page] › tests/page/page-leaks.spec.ts:161:5 › waitFor should not leak @webkit-ubuntu-22.04-node18
⚠️ [webkit-page] › tests/page/page-screenshot.spec.ts:868:5 › page screenshot animations › should wait for fonts to load @webkit-ubuntu-22.04-node18
⚠️ [webkit-page] › tests/page/page-set-input-files.spec.ts:245:3 › should upload large file with relative path @webkit-ubuntu-22.04-node18
⚠️ [playwright-test] › tests/ui-mode-test-watch.spec.ts:145:5 › should watch all @windows-latest-node18-1

37749 passed, 660 skipped
✔️✔️✔️

Merge workflow run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: single aria snapshot for different engines/browsers
2 participants