-
Notifications
You must be signed in to change notification settings - Fork 470
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
"Please file an issue with the code that's causing you to see this error" #911
Comments
Ok, so I am new and I think I was just making a mistake; I switched from fireEvent.click(screen, "addSpreadsheetButton");
fireEvent.click(screen, "verifyGroupButton"); to fireEvent.click(screen.getByTestId("addSpreadsheetButton"));
fireEvent.click(screen.getByTestId("verifyGroupButton")); After doing that, the spooky error went away. Obviously, it couldn't find the element because I was passing in a string, not a node (duh). Still, I mindlessly submitted this issue after seeing the error message. I wonder if it is possible to provide a more descriptive error in cases like this? |
Hi @jdevries3133, thanks for opening this :) |
Yes, the first part of the error is good and accurate, I just don't think it should solicit a GitHub issue since it's a case of user error. It made me think that I had caused an unexpected exception and uncovered a problem in the library when that obviously wasn't the case. |
We can make a better error message here, maybe checking if the element is in fact an HTML element and only then ask the user to file an issue. dom-testing-library/src/helpers.js Line 90 in 1b19094
|
I plan to work on this issue today. |
- first step for fix issue: Output User Error instead of New Issue error for wrong node from user getWindowFromNode(node) addresses issue testing-library#911
…ror for wrong node from user - by adding additional check and correct error-message according to edge use case from the issue testing-library#911
🎉 This issue has been resolved in version 7.31.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Edit
Please see my last comment – this is a case of beginner's confusion but maybe a bit of a confusing error message as well.
@testing-library/dom
version: 7.30.0Relevant code or config
https://github.com/jdevries3133/song_maker_gallery/blob/12fcc5be423a8cdac1a439e9e35d8e6ab1fe9bc9/django_smg/frontend/src/components/teacher/teacher.test.js#L44
What you did: Working on some tests; I am still very new to testing-library and unit testing with React overall.
What happened:
I got this error message, so am opening an issue as requested:
Reproduction repository:
https://github.com/testing-library/dom-testing-library-template
Problem description: I got an error asking to open an issue.
Suggested solution: Who knows, but I hope this can help you trace down a bug if there is one. Let me know if you'd like any additional information.
The text was updated successfully, but these errors were encountered: