Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a way to set "quiesceWaitInterval" for animations that last longer than 0.5f #158

Closed
linusthe3rd opened this issue Oct 21, 2012 · 2 comments

Comments

@linusthe3rd
Copy link

I currently have a set of KIF tests that run against a viewcontroller I acquired from the TDSemiModal github project. However, these tests fail because the viewcontroller I am consuming has an animation that runs for 0.7 seconds:

-(void) dismissSemiModalViewController:(TDSemiModalViewController*)vc {
    double animationDelay = 0.7; // **PROBLEMATIC CODE FOR THIS BUG**
    UIView* modalView = vc.view;
    UIView* coverView = vc.coverView;


    [UIView beginAnimations:nil context:(__bridge void *)(modalView)];
    [UIView setAnimationDuration:animationDelay];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDidStopSelector:@selector(dismissSemiModalViewControllerEnded:finished:context:)];

    modalView.center = self.offscreenCenter;
    coverView.alpha = 0.0f;

    [UIView commitAnimations];

    [coverView performSelector:@selector(removeFromSuperview) withObject:nil afterDelay:animationDelay];

}

From looking at the KIF code, I see that that the default wait time for animations to run is set to 0.5:

+ (id)stepToTapViewWithAccessibilityLabel:(NSString *)label value:(NSString *)value traits:(UIAccessibilityTraits)traits;
{
    NSString *description = nil;
    if (value.length) {
        description = [NSString stringWithFormat:@"Tap view with accessibility label \"%@\" and accessibility value \"%@\"", label, value];
    } else {
        description = [NSString stringWithFormat:@"Tap view with accessibility label \"%@\"", label];
    }

    // After tapping the view we want to wait a short period to allow things to settle (animations and such). We can't do this using CFRunLoopRunInMode() because certain things, such as the built-in media picker, do things with the run loop that are not compatible with this kind of wait. Instead we leverage the way KIF hooks into the existing run loop by returning "wait" results for the desired period.
    const NSTimeInterval quiesceWaitInterval = 0.5;
    __block NSTimeInterval quiesceStartTime = 0.0;
    // ...
}

Since the problematic code is coming from an external library, I "should not" be modifying that code. Is there an alternative way to set the wait time for animations in KIF, or should this functionality be added?

@cowboygneox
Copy link

Why can't you fork the source and change it to your needs? That's what I did with scroll animations.

@bnickel
Copy link
Contributor

bnickel commented Sep 9, 2013

I'm not sure I see the value in increasing the complexity of the API for this. The quiesce time is the typical minimum time it takes for something animations to take place. You could follow this with a [KIFTestStep stepToWaitForTimeInterval:0.3 description:@"Waiting for animations to complete"] or wait for the view to disappear with stepToWaitForAbscenceOfViewWithAccessibilityLabel:

Closing due to age.

@bnickel bnickel closed this as completed Sep 9, 2013
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants