Skip to content

Commit bdc102f

Browse files
committed
Add functional precise swipe tests
1 parent 5cf02d5 commit bdc102f

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

Tests/FunctionalTests/Sources/FTRGestureTest.m

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,65 @@ - (void)testSwipeWithLocationForAllDirections {
190190
assertWithMatcher:grey_sufficientlyVisible()];
191191
}
192192

193+
- (void)testPreciseSwipe {
194+
[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"Grey Box")]
195+
performAction:grey_swipeFastFromStartToEndPoint(CGPointMake(55.f, 5.f), CGPointMake(55.f, 100.f))];
196+
[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"swipe down")]
197+
assertWithMatcher:grey_sufficientlyVisible()];
198+
[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"x:55.0 - y:5.0")]
199+
assertWithMatcher:grey_sufficientlyVisible()];
200+
201+
[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"Grey Box")]
202+
performAction:grey_swipeFastFromStartToEndPoint(CGPointMake(2.f, 30.f), CGPointMake(80.f, 38.f))];
203+
[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"swipe right")]
204+
assertWithMatcher:grey_sufficientlyVisible()];
205+
[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"x:2.0 - y:30.0")]
206+
assertWithMatcher:grey_sufficientlyVisible()];
207+
208+
[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"Grey Box")]
209+
performAction:grey_swipeSlowFromStartToEndPoint(CGPointMake(150.f, 80.f), CGPointMake(50.f, 80.f))];
210+
[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"swipe left")]
211+
assertWithMatcher:grey_sufficientlyVisible()];
212+
[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"x:150.0 - y:80.0")]
213+
assertWithMatcher:grey_sufficientlyVisible()];
214+
215+
[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"Grey Box")]
216+
performAction:grey_swipeSlowFromStartToEndPoint(CGPointMake(40.f, 100.f), CGPointMake(40.f, 30.f))];
217+
[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"swipe up")]
218+
assertWithMatcher:grey_sufficientlyVisible()];
219+
[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"x:40.0 - y:100.0")]
220+
assertWithMatcher:grey_sufficientlyVisible()];
221+
222+
[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"Grey Box")]
223+
performAction:grey_swipeFastFromStartToEndPoint(CGPointMake(40.f, 100.f), CGPointMake(40.f, -50.f))];
224+
[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"swipe up")]
225+
assertWithMatcher:grey_sufficientlyVisible()];
226+
[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"x:40.0 - y:100.0")]
227+
assertWithMatcher:grey_sufficientlyVisible()];
228+
}
229+
230+
- (void)testPreciseSwipeOnWindow {
231+
[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"Window swipes start here")]
232+
performAction:grey_swipeFastFromStartToEndPoint(CGPointMake(55.f, 5.f), CGPointMake(55.f, 100.f))];
233+
[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"swipe down on window")]
234+
assertWithMatcher:grey_sufficientlyVisible()];
235+
236+
[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"Window swipes start here")]
237+
performAction:grey_swipeFastFromStartToEndPoint(CGPointMake(2.f, 30.f), CGPointMake(80.f, 38.f))];
238+
[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"swipe right on window")]
239+
assertWithMatcher:grey_sufficientlyVisible()];
240+
241+
[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"Window swipes start here")]
242+
performAction:grey_swipeSlowFromStartToEndPoint(CGPointMake(150.f, 80.f), CGPointMake(50.f, 80.f))];
243+
[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"swipe left on window")]
244+
assertWithMatcher:grey_sufficientlyVisible()];
245+
246+
[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"Window swipes start here")]
247+
performAction:grey_swipeSlowFromStartToEndPoint(CGPointMake(40.f, 100.f), CGPointMake(40.f, 30.f))];
248+
[[EarlGrey selectElementWithMatcher:grey_accessibilityLabel(@"swipe up on window")]
249+
assertWithMatcher:grey_sufficientlyVisible()];
250+
}
251+
193252
- (void)testPinchWorksInAllDirectionsInPortraitMode {
194253
[self ftr_assertPinchWorksInAllDirections];
195254
}

0 commit comments

Comments
 (0)