I am trying to select a search input using react-testing-library in the more semantic way possible.
I tagged the input with type=search
, and I was expecting to be able to do something like this:
cy.findByRole('search').click().clear().type(content);
However the type fails because there is no element with the role search. Is this a limitation? Or is it supposed to be put in a different place? For example in a wrapping form? Currently the search input is just that, an isolated input that triggers search queries.
If you don't have an explicit role attribute on the element,
the role to use is
searchbox