Last active
December 17, 2015 03:19
-
-
Save ecgreb/5542148 to your computer and use it in GitHub Desktop.
This file contains 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 KIFTestStep (HelloTDDAdditions) | |
+ (id)stepToVerifyGreeting:(NSString *)expectedLabel { | |
NSString *description = | |
[NSString stringWithFormat:@"Verify output is '%@'", | |
expectedLabel]; | |
return [self stepWithDescription:description | |
executionBlock:^(KIFTestStep *step, NSError **error) { | |
UIAccessibilityElement *element = | |
[[UIApplication sharedApplication] | |
accessibilityElementWithLabel:@"Greeting"]; | |
UILabel *label = (UILabel *)[UIAccessibilityElement | |
viewContainingAccessibilityElement:element]; | |
if ([expectedLabel isEqualToString:label.text]) { | |
return KIFTestStepResultSuccess; | |
} | |
KIFTestCondition(NO, error, | |
@"Failed to compare the label text: expected '%@', actual '%@'", | |
expectedLabel, label.text); | |
}]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment