-
Notifications
You must be signed in to change notification settings - Fork 472
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
userEvent.click(screen.getAll*) produces an ambiguous error #892
Comments
Seems like a good idea to me 👍 |
Thanks @juanca for taking the time to open this! :) |
Isn't this also the case with |
@timdeschryver You're right I wasn't thinking about it, I just reproduced it with |
Unless someone gets to it by end of Sunday, I'll probably give it a stab. |
I never did specify which Sunday. Lemme know how that looks, it seemed suspiciously too straight-forward ;) |
@testing-library/dom
version: @testing-library/dom@7.29.4Relevant code or config
Repro sandbox: https://codesandbox.io/s/react-testing-library-demo-forked-u4lcu?file=/src/__tests__/hello.js
What you did:
I ran a test and tried to click the result of
screen.getAllByLabelText
.What happened:
Running the test produces something like:
where the element in question is an array:
Problem description:
The thrown error is a bit ambiguous -- there is room for improvement.
Suggested solution:
I would assume that
userEvent
methods would error on having multiple elements -- where the error text would be a bit more direct. I am not sure if a user can interact with more than 1 element at a time.The text was updated successfully, but these errors were encountered: