Created
September 16, 2013 03:40
-
-
Save bnickel/6576490 to your computer and use it in GitHub Desktop.
A step to tap wildly on different buttons while trying to get your app to a final state. For example, if your home screen has a "Login" button, your logout flow consists of tapping "Logout" and "Confirm", and your tests could fail leaving alerts with "OK" or "Continue", you could use `[tester tapViewsWithAccessibilityLabels:@[@"OK", @"Continue",…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@implementation KIFUITestActor (BruteForceEscape) | |
- (void)tapViewsWithAccessibilityLabels:(NSArray *)labels whileWaitingForViewWithAccessibilityLabel:(NSString *)targetLabel | |
{ | |
[self runBlock:^KIFTestStepResult(NSError **error) { | |
for (NSString *label in labels) { | |
UIView *view; | |
UIAccessibilityElement *element; | |
if ([UIAccessibilityElement accessibilityElement:&element view:&view withLabel:label value:nil traits:UIAccessibilityTraitNone tappable:YES error:NULL]) { | |
[self tapAccessibilityElement:element inView:view]; | |
} | |
} | |
return [UIAccessibilityElement accessibilityElement:NULL view:NULL withLabel:targetLabel value:nil traits:UIAccessibilityTraitNone tappable:NO error:error] ? KIFTestStepResultSuccess : KIFTestStepResultWait; | |
}]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment