spectator
spectator copied to clipboard
Improve error message for not visible elements in tests
I'm submitting a...
[x] Feature request
Current behavior
When an element that you expect to be visible is not, the error message is Expected element to be visible
.
Expected behavior
The error message would include the matcher used to try to find the element.
Minimal reproduction of the problem with instructions
For bug reports please provide the STEPS TO REPRODUCE and if possible a MINIMAL DEMO of the problem via https://stackblitz.com or similar (you can use this template as a starting point: https://bit.ly/2zme3bj).
What is the motivation / use case for changing the behavior?
This would make it clearer quicker why a test had failed, easing mental load when trying to fix it (the line number is right there, so that's cool - it'd just be even nicer.
You're welcome to submit a PR.
You're welcome to submit a PR.
Do you know what would be a good approach to get from the matcher code back to the selector info? 🤔
I can't think of a way to keep a reference to the selector info without changing the return type of the query to include it - so its accessible to the matchers - currently I think the query returns a plain Element. So I'd need to start using something like ElementWithSelector extends Element
, right?