I am making a "before each" step and I am wanting to do steps to logout. I can't find anything about checking if an element exists before I try to touch it, then if it doesn't exist do something else. Is it possible to do this with KIF without having a reference to the object I want to check for?
Something like:
if([tester elementExistsWithAccesibilityLabel:@"backButton"])
{
[tester tapViewWithAccessibilityLabel:@"backButton"];
}
else
{
[tester tapViewwithAccesibilityLabel:@"Logout"];
}
I made this function that seems to do the trick in a pinch, but it would have some issues if multiple integration tests were simultaneously relying on the global default timeout. So far, seems to work for me.
You could try something like this: