Closed
Description
🚀 Feature Request
this was previously raised and implemented but I think there are still alot of improvements available.
previous issue: #35158
Implement a way to specify the snapshot is deeply equal and if new items get added, the snapshot needs updating. Further if the option is inside the snapshot, like children equal, don't remove the option when updating snapshots.
Example
right now we have a children equal option that closed the above issue, but it is shallow and not deep. So we can do this:
await expect(page.locator('body')).toMatchAriaSnapshot(`
- /children: equal
- navigation:
- /children: equal
- button "Toggle navigation"
- list:
- /children: equal
- listitem:
- /children: equal
- link "Home":
- /children: equal
- /url: /home
but
- its tedious to add children equal everywhere manually
- when snapshots are updated, it removes the children equal - so you have to manually re-add them everywhere
Motivation
why do I want deep equal snapshots?
- people can add elements by mistake to a view and most people assume the snapshot fails if new elements are added
- if I change something that does fail the snapshot it can suddenly get extra nodes that were added by someone else - so a developer has to explain on a PR why a snapshot suddenly changed so much when only one small thing was changed
ideally for me, it would either be a new function or a global option.
Metadata
Metadata
Assignees
Labels
No labels