Skip to content

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

Merged
dgozman merged 1 commit intomicrosoft:mainfrom
dgozman:feat-assertion-path-template
Jan 29, 2025
Merged

feat: per-assertion snapshot path template in config#34537
dgozman merged 1 commit intomicrosoft:mainfrom
dgozman:feat-assertion-path-template

Conversation

@dgozman
Copy link
Copy Markdown
Collaborator

@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.
@github-actions
Copy link
Copy Markdown
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.

@dgozman dgozman merged commit ba65016 into microsoft:main Jan 29, 2025
29 checks passed
dgozman added a commit to dgozman/playwright that referenced this pull request Jan 30, 2025
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