Open stof opened 8 years ago
@stof Ah, I haven't used the assertSession
- I thought (by its name) it was purely an asserter, but this actually finds and asserts, which indeed is very very handy. I'm going to look into adding a quick chapter about this somewhere (or maybe updating an existing chapter).
I also hadn't seen the https://github.com/Behat/MinkExtension/blob/master/src/Behat/MinkExtension/Listener/FailureShowListener.php - that's also interesting.
Thanks!
Code changes merged and deployed in at #23. Only todo is to record a small addition to the mink-inside-feature-context
chapter.
WebAssert::elementExists
accepts the same arguments thanElement::find
(plus an optional third one if you want to search in specific element rather than the whole page), but it throws an ExpectationException when there is no node instead of returning null.There is a nice side-effect compared to using a PHPUnit assertion on the element: as the exception thrown is a MinkException, this will play well with the MinkExtension feature allowing to open the failing page on failure (to debug what failed by seeing the actual content)