Any ideas on how to implement pull to upgrade using KIF tests?

This is pretty frank.

Does anyone have an idea on how to test the functionality for updating in KIF tests?

+4
source share
2 answers

Just dragging from the top of the screen down to the bottom of the screen would do this, right? KIF has the following method implemented in the UIView-KIFAdditions category:

- (void)dragFromPoint:(CGPoint)startPoint toPoint:(CGPoint)endPoint; 

I went further and created the following test step for simple drag and drop operations:

 + (id)stepToDragFromStartPoint:(CGPoint)startPoint toEndPoint:(CGPoint)endPoint { NSString *description = [NSString stringWithFormat:@"Simulate dragging finger from point %.1f,%.1f to point %.1f,%.1f", startPoint.x, startPoint.y, endPoint.x, endPoint.y]; return [KIFTestStep stepWithDescription:description executionBlock:^(KIFTestStep *step, NSError **error) { UIView *viewToSwipe = [UIApplication sharedApplication].keyWindow.subviews.lastObject; [viewToSwipe dragFromPoint:startPoint toPoint:endPoint]; return KIFTestStepResultSuccess; }]; } 

Hope this helps!

+3
source

While after the publication of this question, KIF developed the built-in "pull to refresh" functionality. See The Following Methods in KIFUITestActor

 - (void)pullToRefreshViewWithAccessibilityLabel:(NSString *)label pullDownDuration:(KIFPullToRefreshTiming) pullDownDuration; - (void)pullToRefreshViewWithAccessibilityLabel:(NSString *)label value:(NSString *)value; - (void)pullToRefreshAccessibilityElement:(UIAccessibilityElement *)element inView:(UIView *)viewToSwipe pullDownDuration:(KIFPullToRefreshTiming) pullDownDuration; 
0
source

All Articles