Closed DarkTrick closed 2 years ago
You can query the DOM if you want.
Depending on your use case, you can use getAll
queries or just document.querySelectorAll
const inputs = screen.getAllByRole('textbox');
const inputs = document.querySelectorAll('input');
// or another variant
Then this is perhaps a documentation issue(?)
Eg. The cheat sheet says ByRole find by aria role
. Would be very nice if the documentation would be more clear about this :)
Not sure, if this is actually possible...
Motivation
I'd like to be able to figure out, if someone changed the UI (added input element to form) without changing the test.
Describe the feature you'd like:
Function call to query all input fields (like
queryAllInputFields
)Describe alternatives you've considered:
AFAIK there is none.
Teachability, Documentation, Adoption, Migration Strategy: