Text From UI と What I get from WebService Using KIF V3.0 を比較したいと思います。KIF 1.0 で比較する方法は知っていますが、KIF V3.0 ではわかりません。
V1.0の場合
+(id)stepToverifyOutput:(NSString *) expectedLabel アクセシビリティ:(NSString *)mylabel
{
NSString *description = [NSString stringWithFormat:@"Verify label text for %@",expectedLabel];
return [self stepWithDescription:description executionBlock:^(KIFTestStep *step, NSError **error) {
UIAccessibilityElement *element = [[UIApplication sharedApplication] accessibilityElementWithLabel:mylabel];
BOOL isValid;
UINavigationController *navbar;
UILabel *lblName;
if([element isKindOfClass:[UILabel class]]){
isValid=YES;
lblName = (UILabel *)[UIAccessibilityElement viewContainingAccessibilityElement:element];;
if ([expectedLabel isEqualToString:lblName.text]) {
return KIFTestStepResultSuccess;
}
}else{
isValid=NO;
navbar = (UINavigationController *)[UIAccessibilityElement viewContainingAccessibilityElement:element];;
if ([expectedLabel isEqualToString:navbar.title]) {
return KIFTestStepResultSuccess;
}
}
KIFTestCondition(NO, error, @"Failed to compare the label text: expected '%@', actual '%@'", expectedLabel,(isValid)?lblName.text:navbar.title);
}];
}
私のために必要なことをしてください.私はこの場所で立ち往生しています.