microsoft / microsoft/playwright
[Feature]: Make `toMatchAriaSnapshot` diffs show minimal/precise changes for partial matches
@cpAdm is already working on this.
Since Jan 25, 2026.
- Dominant language
- TypeScript
- Stars
- 96.4k
- Forks
- 6.5k
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 180
Description
🚀 Feature Request
Improve readability of diff in trace viewer when assertion toMatchAriaSnapshot with - /children: equal fails
Example
Sample test
test('table matches aria snapshot', async ({ page }) => {
// Set up a sample table with headers and data
await page.setContent(`
<table>
<caption>Employee Directory</caption>
<thead>
<tr>
<th>Name</th>
<th>Role</th>
<th>Department</th>
</tr>
</thead>
<tbody>
<tr>
<td>Alice Johnson</td>
<td>Engineer</td>
<td>Development</td>
</tr>
<tr>
<td>Bob Smith</td>
<td>Designer</td>
<td>UI</td>
</tr>
<tr>
<td>Carol White</td>
<td>Manager</td>
<td>Operations</td>
</tr>
</tbody>
</table>
`);
// Verify the table structure using toMatchAriaSnapshot
await expect(page.getByRole('table')).toMatchAriaSnapshot(`
- table "Employee Directory":
- rowgroup:
- row "Name Role Department"
- rowgroup:
- /children: equal
- row "Alice Johnson Engineer Development"
- row "Bob Smith Designer UX"
- row "Carol White Manager Operations"
`);
});
Current diff:
Whilst the only difference is actually "UI" vs "UX" in this example.
Motivation
Aria snapshots are a powerful tool, however when these assertions fail, it's often hard to quickly grasp what part of the snapshot is unexpected. In the above example it looks like there is a lot wrong (red) with the table, whilst in reality there is just one small typo.
Note that also - /children: equal is shown green in the diff, however this ofc never part of the actual aria snapshot.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.