microsoft / microsoft/playwright

[Feature]: Be able to switch off regex number substitution for aria snapshots

Open
#40,080 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P3-collecting-feedback
Dominant language
TypeScript
Stars
96.3k
Forks
6.5k
Avg merge
1d 6h
Merged PRs (30d)
180

Description

### 🚀 Feature Request

We love the aria snapshots feature, but the substituted numbers for regex \d is in our case un-necessary as our endpoints are mocked out - numbers and dates are static.

We would love an option to switch this off, so we just get the static text in the snapshot, no regex.

e.g. `numbers: 'regex' | 'static'` option added per snapshot and globally.

### Example

we would switch this on globally in order to have static snapshots

### Motivation

We update snapshots and all the time have to manually fix them. e.g.

Image

having the exact date or number instead of a regex is better for us because:
1. it tests more - we don't need an extra specific check for a each number in 10 lines under the snapshot
2. in many of our cases the regex is longer and harder to read than just including the static value (see image above) - I think this is really obvious when your UI has *alot* of numbers in it, as is our case.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files, tests, or entry points are named in the issue. Start by locating the aria snapshots number-substitution implementation and its snapshot option plumbing; done means a per-snapshot and global setting can preserve static numbers and dates while retaining the existing regex behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.