You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
WebAssert::elementExists accepts the same arguments than Element::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)
The text was updated successfully, but these errors were encountered:
@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).
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)
The text was updated successfully, but these errors were encountered: