I try to make some scenarios with the KIF framework. When I adding for example:
[scenario addStep:[KIFTestStep stepToTapViewWithAccessibilityLabel:@"MyUIButtonAccessibilityLabel"]];
the UIControlEventTouchUpInside is not fired for the UIButton with accessibilityLabel @"MyUIButtonAccessibilityLabel".
Is uigesturerecognizer interfering with the UIControlEventTouchUpInside in KIF? Is there a work-around for this in KIF?
I actually ran into this yesterday. stepToTapViewWithAccessibilityLabel has worked just fine for everything in my app, but I encountered a button that it just absolutely won't work for.
To work around it, I ended up using stepToTapScreenAtPoint (which I don't especially like), but it seems to work fine. I also added a void initialize method to my category so that I can determine which device is executing the tests at run-time and based on that, figure out where exactly I need to tap:
@implementation KIFTestStep (SLAdditions)
static CGPoint kButtonLocation;
+ (void)initialize
{
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
kButtonLocation = CGPointMake(498.0, 622.0);
else
kButtonLocation = CGPointMake(247.0, 316.0);
}
+ (NSArray *)stepsToDoSomething
{
NSMutableArray *steps = [NSMutableArray array];
[steps addObject:[KIFTestStep stepToWaitForTappableViewWithAccessibilityLabel:@"The Button Label"]];
[steps addObject:[KIFTestStep stepToTapScreenAtPoint:kButtonLocation]];
// Verify that tapping succeeded
[steps addObject:[KIFTestStep stepToWaitForAbsenceOfViewWithAccessibilityLabel:@"The Button Label"]];
return steps;
}