-
Notifications
You must be signed in to change notification settings - Fork 9
Include DOM path when nesting in assertions #34
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
Conversation
| if (! is_null($callback)) { | ||
| $elementAssert = new AssertElement($this->getContent(), $element); | ||
|
|
||
| $elementAssert->withSelectors($this->selectorPath, $selector); |
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.
This basically tells it to use the current closures selectors, and track the new selector. Seemed the most simple this way, but feel free to change :)
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.
Seems all good :)
|
Great idea. Will indeed make debugging way easier |
Currently :
We can use and nest multiple
find()methods, but, when an issue occurs it's not always obvious where exactly it is when using factories etc..We end up with errors such as :
But, the issue is we could have numerous data providers etc-and many tests so it becomes difficult to debug.
Changes
This PR adds more context to the errors by including the selector paths ie:
Which helps direct us closer to where it is.. as the selectors are the same we've entered.
To do the above I've added a
TrackSelectorstrait to contain that logic - and added withwithSelectorsin thefind()method to keep track of all the selectors.We can probably alter more assertions to be more specific - but just done a few for now.