F.branch()
FuncUnit.branch
branch(check1, success1, check2, success2)
Uses 2 checker methods to see which success function to call. This is a way to conditionally run one method if you're unsure about the conditions of your page, without causing a test failure. For example, this is useful for login steps, if you're not sure whether the app is logged in.
F.branch(function(){
return (F("#exists").size() > 0);
}, function(){
ok(true, "found exists")
}, function(){
return (F("#notexists").size() > 0);
}, function(){
ok(false, "found notexists")
});
Parameters
-
check1
{function()}
a checker function that, if it returns true, causes success1 to be called
-
success1
{function()}
a function that runs when check1 returns true
-
check2
{function()}
a checker function that, if it returns true, causes success2 to be called
-
success2
{function()}
a function that runs when check2 returns true
-
timeout
{Number}
if neither checker returns true before this timeout, the test fails