microsoft / microsoft/playwright

[Feature] Add global setting to make getByText default to exact: true

Open
#19,235 19 comments 25 reactions 0 assignees View on GitHub
P3-collecting-feedback
Dominant language
TypeScript
Stars
96.3k
Forks
6.5k
Avg merge
1d 6h
Merged PRs (30d)
180

Description

[The default behaviour in Testing Library is `{ exact: true }`](https://testing-library.com/docs/queries/bytext), while Playwright defaults to `{ exact: false }`.

Naturally this is bound to catch people out. It would be useful to have at least a global setting to change the default to `{ exact: true }`.

See also https://github.com/microsoft/playwright/discussions/18239

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the getByText implementation and the linked Testing Library documentation, then read the related Playwright discussion for prior design context. Done means Playwright provides a global setting that makes getByText default to exact: true without requiring the option on every call.

Written by the indexing model from the issue text.

Assessment

Tech stack
playwright, typescript
Domain
testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.