Skip to content

[Feature]: make toMatchAriaSnapshot "partial" behavior optional or add "toMatchFullAriaSnapshot" #36436

Closed
@lukpsaxo

Description

@lukpsaxo

🚀 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

  1. its tedious to add children equal everywhere manually
  2. 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?

  1. people can add elements by mistake to a view and most people assume the snapshot fails if new elements are added
  2. 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions