summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-04-26 00:57:12 -0700
committerMinh Nguyễn <mxn@1ec5.org>2016-05-05 01:07:29 -0700
commit261b9a5811948141541e2da4d6535c157b980831 (patch)
tree7ba07af0416cff8918c558eccfad4bad503d069f
parentebf8fa36c613e03e4f3ab0972ed4229b3b374c68 (diff)
downloadqtlocation-mapboxgl-261b9a5811948141541e2da4d6535c157b980831.tar.gz
[ios] Test 100 points, world tour
-rw-r--r--platform/ios/uitest/MGLAnnotationTests.m57
1 files changed, 47 insertions, 10 deletions
diff --git a/platform/ios/uitest/MGLAnnotationTests.m b/platform/ios/uitest/MGLAnnotationTests.m
index 0420fd3b59..a719bc5638 100644
--- a/platform/ios/uitest/MGLAnnotationTests.m
+++ b/platform/ios/uitest/MGLAnnotationTests.m
@@ -17,13 +17,15 @@
- (void)testDropPin {
XCUIElement *mapElement = [[XCUIApplication alloc] init].otherElements[@"MGLMapView"];
+ NSPredicate *exists = [NSPredicate predicateWithFormat:@"exists == YES"];
+ NSPredicate *isAbsent = [NSPredicate predicateWithFormat:@"exists == NO"];
// Drop a pin.
XCUIElement *mapProxyElement = mapElement.buttons[@"MGLMapViewProxyAccessibilityElement"];
XCTAssertFalse(mapElement.buttons[@"MGLMapViewProxyAccessibilityElement"].exists, @"Map proxy element should be absent until opening callout view.");
- [self expectationForPredicate:[NSPredicate predicateWithFormat:@"exists == true"] evaluatedWithObject:mapProxyElement handler:nil];
+ [self expectationForPredicate:exists evaluatedWithObject:mapProxyElement handler:nil];
[mapElement pressForDuration:1.1];
- [self waitForExpectationsWithTimeout:1 handler:nil];
+ [self waitForExpectationsWithTimeout:2 handler:nil];
// Inspect the callout view.
NSString *annotationTitle = @"Dropped Pin";
@@ -38,7 +40,7 @@
XCTAssertTrue(calloutRightAccessoryButton.exists, @"Callout right accessory button should be present after opening callout.");
// Close the callout view by tapping on the map proxy element. Note that the map proxy element has a gaping hole in the middle to accommodate the callout view.
- [self expectationForPredicate:[NSPredicate predicateWithFormat:@"exists == false"] evaluatedWithObject:mapProxyElement handler:nil];
+ [self expectationForPredicate:isAbsent evaluatedWithObject:mapProxyElement handler:nil];
XCUICoordinate *coordinate = [[mapProxyElement coordinateWithNormalizedOffset:CGVectorMake(0, 0)] coordinateWithOffset:CGVectorMake(100, 100)];
[coordinate tap];
[self waitForExpectationsWithTimeout:2 handler:nil];
@@ -57,15 +59,17 @@
- (void)testFrameWithGestures {
XCUIElement *mapElement = [[XCUIApplication alloc] init].otherElements[@"MGLMapView"];
+ NSPredicate *exists = [NSPredicate predicateWithFormat:@"exists == YES"];
+ NSPredicate *isAbsent = [NSPredicate predicateWithFormat:@"exists == NO"];
// Drop a pin.
XCUIElement *mapProxyElement = mapElement.buttons[@"MGLMapViewProxyAccessibilityElement"];
- [self expectationForPredicate:[NSPredicate predicateWithFormat:@"exists == true"] evaluatedWithObject:mapProxyElement handler:nil];
+ [self expectationForPredicate:exists evaluatedWithObject:mapProxyElement handler:nil];
[mapElement pressForDuration:1.1];
[self waitForExpectationsWithTimeout:1 handler:nil];
// Close the callout view.
- [self expectationForPredicate:[NSPredicate predicateWithFormat:@"exists == false"] evaluatedWithObject:mapProxyElement handler:nil];
+ [self expectationForPredicate:isAbsent evaluatedWithObject:mapProxyElement handler:nil];
XCUICoordinate *coordinate = [[mapProxyElement coordinateWithNormalizedOffset:CGVectorMake(0, 0)] coordinateWithOffset:CGVectorMake(100, 100)];
[coordinate tap];
[self waitForExpectationsWithTimeout:2 handler:nil];
@@ -97,24 +101,57 @@
- (void)testRemoveAnnotations {
XCUIApplication *app = [[XCUIApplication alloc] init];
+ NSPredicate *exists = [NSPredicate predicateWithFormat:@"exists == YES"];
+ NSPredicate *isAbsent = [NSPredicate predicateWithFormat:@"exists == NO"];
// Drop a pin.
XCUIElement *mapElement = [[XCUIApplication alloc] init].otherElements[@"MGLMapView"];
XCUIElement *mapProxyElement = mapElement.buttons[@"MGLMapViewProxyAccessibilityElement"];
- [self expectationForPredicate:[NSPredicate predicateWithFormat:@"exists == true"] evaluatedWithObject:mapProxyElement handler:nil];
+ [self expectationForPredicate:exists evaluatedWithObject:mapProxyElement handler:nil];
[mapElement pressForDuration:1.1];
[self waitForExpectationsWithTimeout:1 handler:nil];
// Remove all annotations, closing the callout view.
[app.navigationBars[@"MBXNavigationBar"].buttons[@"MBXSettingsButton"] tap];
[app.sheets[@"Map Settings"] swipeUp];
- XCUIElementQuery *settingsCollectionViewsQuery = app.sheets[@"Map Settings"].collectionViews;
- XCUIElement *removeAnnotationsButton = settingsCollectionViewsQuery.buttons[@"Remove Annotations"];
- [self expectationForPredicate:[NSPredicate predicateWithFormat:@"exists == false"] evaluatedWithObject:mapProxyElement handler:nil];
- [removeAnnotationsButton tap];
+ [self expectationForPredicate:isAbsent evaluatedWithObject:mapProxyElement handler:nil];
+ [app.sheets[@"Map Settings"].collectionViews.buttons[@"Remove Annotations"] tap];
[self waitForExpectationsWithTimeout:2 handler:nil];
XCTAssertFalse(mapElement.buttons[@"MGLMapViewAnnotation 0"].exists, @"Annotation should be gone after removing all annotations.");
}
+- (void)testAddHundredPoints {
+ XCUIApplication *app = [[XCUIApplication alloc] init];
+ NSPredicate *exists = [NSPredicate predicateWithFormat:@"exists == YES"];
+ [app.navigationBars[@"MBXNavigationBar"].buttons[@"MBXSettingsButton"] tap];
+
+ // Add 100 points.
+ XCUIElement *mapElement = [[XCUIApplication alloc] init].otherElements[@"MGLMapView"];
+ XCUIElement *lastAnnotationElement = mapElement.buttons[@"MGLMapViewAnnotation 99"];
+ [self expectationForPredicate:exists evaluatedWithObject:lastAnnotationElement handler:nil];
+ [app.sheets[@"Map Settings"].collectionViews.buttons[@"Add 100 Points"] tap];
+ [self waitForExpectationsWithTimeout:2 handler:nil];
+
+ XCTAssertGreaterThanOrEqual(mapElement.buttons.count, 100, @"Adding 100 points should leave at least 100 buttons visible within the map.");
+}
+
+- (void)testTourWorld {
+ XCUIApplication *app = [[XCUIApplication alloc] init];
+ NSPredicate *exists = [NSPredicate predicateWithFormat:@"exists == YES"];
+ [app.navigationBars[@"MBXNavigationBar"].buttons[@"MBXSettingsButton"] tap];
+
+ // Start the world tour.
+ XCUIElement *mapElement = [[XCUIApplication alloc] init].otherElements[@"MGLMapView"];
+ [self expectationForPredicate:exists evaluatedWithObject:mapElement.buttons[@"Washington, D.C."] handler:nil];
+ [app.sheets[@"Map Settings"].collectionViews.buttons[@"Start World Tour"] tap];
+ [self waitForExpectationsWithTimeout:5 handler:nil];
+ [self expectationForPredicate:exists evaluatedWithObject:mapElement.buttons[@"San Francisco"] handler:nil];
+ [self waitForExpectationsWithTimeout:15 handler:nil];
+ [self expectationForPredicate:exists evaluatedWithObject:mapElement.buttons[@"Bangalore"] handler:nil];
+ [self waitForExpectationsWithTimeout:20 handler:nil];
+ [self expectationForPredicate:exists evaluatedWithObject:mapElement.buttons[@"Ayacucho"] handler:nil];
+ [self waitForExpectationsWithTimeout:20 handler:nil];
+}
+
@end