-
Notifications
You must be signed in to change notification settings - Fork 399
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
Improved error messaging for toHaveFocus assertion #304
Improved error messaging for toHaveFocus assertion #304
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution. I can see how the current output is not super helpful.
However, what you propose is not accurate. Probably the same confusing nature of this message lead you to misinterpret it. But the fact is that what we print in the part of the error labeled with "Received" is the element that had the focus. It is meant to let you know where the focus lied instead of where the test expected.
In the case of your screenshot the focus lies in the body element, which is what happens usually when the element that had the focus was removed or hidden from being rendered.
@gnapse thanks for the feedback! Updated the verbiage to read: Expected element with focus:"... |
@syneva-runyan sorry, the other day I noticed that the build is failing, and forgot to notify you. I took a look at the build on travis and it's not clear why it failed. A CI process stopped after 10 minutes without output or something like that. I also don't find a way to request travis to restart the build. I wonder if you can push a change (maybe an extra empty commit) to see if a new build is launched. |
@gnapse no worries, just pushed some commits and looks like it's running now |
Codecov Report
@@ Coverage Diff @@
## master #304 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 23 23
Lines 315 315
Branches 72 72
=========================================
Hits 315 315
Continue to review full report at Codecov.
|
@all-contributors add @syneva-runyan for code |
I've put up a pull request to add @syneva-runyan! 🎉 |
🎉 This PR is included in version 5.11.6 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
What:
Added more details to the .toHaveFocus assertion error message
Why:
The DOM output when an element is not properly focus does not show any meaningful hints to why an assertion may have failed, which can make errors more difficult to debug
How:
Added additional verbiage to the error message
Checklist:
Open to feedback on the messaging content or verbiage!