I have a case where i want to wait for a view to appear, but if it doesn't appear I want to just log it, without KIF timing out and raising an exception. I tried using a @try/@catch
block, but it didn't seem to catch it. Research suggests this may be a limitation of KIF, but just wanted to verify. I don't want to modify failWithException
for just this one case, since every other time I do want the test to fail.
Example of what I tried:
@try {
[tester waitForViewWithAccessibilityLabel:@"Foo"];
}
@catch (NSException *exception) {
[TestLogger logTestMethodFailed:[NSString stringWithFormat:@"%@ on %@", self.currentTest, [[UIDevice currentDevice] name]] withExceptionMessage:@"LOGOUT FAILED! Didn't find 'foo' element. This may be acceptable if the test does not need to log out."];
}