Skip to content

Conversation

@vincenzo-gasparo
Copy link
Contributor

Add exact parameter to toMatchAriaSnapshot to save raw data

Fixes #38074, references #38074.

Copy link
Contributor

@agg23 agg23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution. We always ask that people file issues first so we can triage and decide whether or not a PR is warranted, but in this case we do think this is something worth implementing (and it's a trivial implementation).

Minor comments: just naming and supporting both overloads.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@vincenzo-gasparo
Copy link
Contributor Author

vincenzo-gasparo commented Nov 5, 2025

@agg23 I cannot manage to make this code to work:

[`property: TestConfig.updateSnapshots`]

It gives me this error:

Error: Undefined member reference: [`property: TestConfig.updateSnapshots`]

Can you give me some help?

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@agg23
Copy link
Contributor

agg23 commented Nov 10, 2025

I cannot manage to make this code to work:

[`property: TestConfig.updateSnapshots`]

It gives me this error:

Error: Undefined member reference: [`property: TestConfig.updateSnapshots`]

Can you give me some help?

@vincenzo-gasparo this is because TestConfig is a JavaScript only concept; the other language ports do not support it (no test runner). You should disable the docs for this new flag in the non-JS platforms by setting langs: js everywhere, including on the new update parameter.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@samueldebenedictis
Copy link

@agg23 , even using langs: js for the new update parameter in toMatchAriaSnapshot, the build still fails with
"Undefined member reference: [property: TestConfig.updateSnapshots]"

I tried to add

### option: LocatorAssertions.toMatchAriaSnapshot#2.update = %%-js-assertions-aria-snapshot-update-%%
* langs: js

in class-locatorassertions.md

and


## js-assertions-aria-snapshot-update
* langs: js
* since: v1.57
- `update` <["raw"]|["relaxed"]>

Defines how snapshots are written when used with [`property: TestConfig.updateSnapshots`]. Defaults to `'relaxed'`.
* `'relaxed'` - Writes an ARIA snapshot that uses flexible patterns (for example, regular expressions for numbers) to reduce flakiness from minor changes.
* `'raw'` - Writes the exact ARIA snapshot without transformations. This is strict and will fail if values change.

in params.md

but still does not work

Screenshot for reference
image

Copy link
Contributor

@agg23 agg23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thank you for trying to get the docs to work. I think what you have here is fine. Just need to restrict it to JS.

@github-actions
Copy link
Contributor

Test results for "MCP"

2432 passed, 116 skipped


Merge workflow run.

@github-actions
Copy link
Contributor

Test results for "tests 1"

1 failed
❌ [playwright-test] › runner.spec.ts:118 › should ignore subprocess creation error because of SIGINT @macos-latest-node18-2

2 flaky ⚠️ [firefox-library] › library/inspector/cli-codegen-1.spec.ts:1079 › cli codegen › should not throw csp directive violation errors `@firefox-ubuntu-22.04-node18`
⚠️ [firefox-page] › page/page-goto.spec.ts:83 › should work with Cross-Origin-Opener-Policy `@firefox-ubuntu-22.04-node18`

40349 passed, 787 skipped


Merge workflow run.

@vincenzo-gasparo vincenzo-gasparo changed the title feat(toMatchAriaSnapshot): add exact saving option feat(toMatchAriaSnapshot): add raw saving option Nov 18, 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]: Add aria snapshot raw saving

3 participants