You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There should be a query that works for both these elements :
<button>Click Me</button>
<input type="button" value="Click Me" />
Currently, getByDisplayValue("Click Me") will find the input but not the button, and getByText("Click Me") is the opposite. There is no way to write a test that will stay green if i refactor one into the other (Assuming that for whatever reason I can't use getByRole or other queries)
Suggested implementation:
getByText finding the input is counter-intuitive I think, so in my opinion the best way would be to change the getByDisplayValue query so that it works with button elements.
Describe alternatives you've considered:
There are many workarounds and alternatives, but they rely on using less specific queries, or queries that make the tests less close to what a user would do, which is the apposite of what I'm trying to do if I'm using testing-library.