Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Test selectors #221

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions text/0000-test-selectors.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ While useful, most of these existing APIs generally have downsides:
* They do not do enough to discourage brittle test selectors from being written (e.g. `"ProfilerHeader NavLink label a"`).
* Test ids provide an alternative to this but they [have scaled very poorly in practice](https://gist.github.com/bvaughn/d3c8b8842faf2ac2439bb11773a19cec#gistcomment-3966895).

A first-party React selector API could be adopted by these frameworks so they are no longer be renderer-specific, (although this might require imposing constraints on what the selector syntax supported). It could also make open source libraries like `[react-testing-library](https://github.com/testing-library/react-testing-library)` more powerful.
A first-party React selector API could be adopted by these frameworks so they are no longer be renderer-specific, (although this might require imposing constraints on what the selector syntax supported). It could also make open source libraries like [`react-testing-library`](https://github.com/testing-library/react-testing-library) more powerful.
bvaughn marked this conversation as resolved.
Show resolved Hide resolved

Specifically, the API proposed below has the following goals:
* Remove dependency on React internals that may change in future releases.
Expand Down Expand Up @@ -813,4 +813,4 @@ Much of the above RFC (usage examples) could be converted to user-facing documen

* What are the best ways to require component definitions to passed to `createComponentSelector`?
* Will existing test libraries (other than potentially Jest) adopt this new API?
* More (to be uncovered by this RFC?)
* More (to be uncovered by this RFC?)