KIF 2.0 check label value with

1k Views Asked by At

I have a problem with KIF 2.0. I try to test the value of a UILabel with the function below:

  • (UIView *)waitForViewWithAccessibilityLabel:(NSString *)label value:(NSString *)value traits:(UIAccessibilityTraits)traits

But the test fails with this error:

-[MyApp testLabelContent] : The step timed out after 10.00 seconds: Found an accessibility element with the label "myLabel", but with the value "(null)", not "2"

I set up value with @"2" but it doesn't work, I don't understand why!

Could you please help me!

Thanks

1

There are 1 best solutions below

2
On

I assume you have set the value for the label's text property. In this case the problem is that when KIF tries to access the "value" it is looking for the UIAccessibilityElements "accessibilityValue" property what you can set by calling [yourLabel setValue:@"2" forKey:@"accessibilityValue"].

For further information visit https://developer.apple.com/library/ios/documentation/uikit/reference/UIAccessibilityElement_Class/Reference/Reference.html.