I'm totally new with CodeCeption.
I want to do an action/assertion depending on another assertion result, like this:
if ($I->see('message')){
$I->click('button_close');
}
Is something like that possible? I tried, but doesn't work. Probably the assertion result doesn't apply to IF, but is there any alternative?
Thanks in advance!
Finally Codeception now has the function performOn
!!
http://codeception.com/docs/modules/WebDriver#performOn
I had this same issue. Although it's not ideal, you can do this:
try {
$I->see('message');
// Continue to do this if it's present
// ...
} catch (Exception $e) {
// Do this if it's not present.
// ...
}
Great!! This solution is better than mine! Much more flexible, and looks better. I didn't know that try/catch could work. Thank you very much!
np! One thing to note - it won't show the test as failed, but if you do have a failure after that it may add an additional error line that can be confusing. But if the rest of the tests pass it won't complain.
Thanks DAB! I guess I'll be able to deal with such situations with the catch.
This didn't do anything for me, my tests still fail if the element isn't present. Anyone have any follow ups?