r/learnreactjs • u/BilboMcDoogle • May 06 '22
React Testing Library - what does "Queries Accessible by Everyone" mean?
I keep seeing that as the title of a major section of queries.
What does it mean? Why would you want your testing "accessible to everyone"? You or the other developers are the only ones who are gonna see the tests so I don't understand the perspective.
The other section titles are:
Semantic Queries
and
Test IDs
What section allows me to just pick the element I want to test and test it? Like grab a input field or an img tag or something along those lines? I don't understand the language. Does "accessible by everyone" just mean "anything on the website anyone can see"?
View all comments
Show parent comment
1
u/Izero_devI May 08 '22
No, no. It is all frontend, this is React we are talking about. Queries are for tests to target elements on the DOM.
So library just want to tell you that if you are going to target/query an element