summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJustin R. Miller <incanus@codesorcery.net>2015-09-24 15:36:51 -0700
committerJustin R. Miller <incanus@codesorcery.net>2015-10-20 11:32:39 -0700
commit6eee72e677bbac34af5203d6c80ada2275027c8a (patch)
treee2e4f1ad5fb05d257ee8fc0c719b17d38894eaa2 /test
parent28be82c1c19505abb47ca1c03fd069cc4a015ec6 (diff)
downloadqtlocation-mapboxgl-6eee72e677bbac34af5203d6c80ada2275027c8a.tar.gz
fixes #2419: adapt iOS tests for Bitrise CI
Diffstat (limited to 'test')
-rw-r--r--test/ios/MapViewTests.m21
1 files changed, 16 insertions, 5 deletions
diff --git a/test/ios/MapViewTests.m b/test/ios/MapViewTests.m
index 521549f5d2..9dd5821768 100644
--- a/test/ios/MapViewTests.m
+++ b/test/ios/MapViewTests.m
@@ -8,6 +8,7 @@
#import "LocationMocker/LocationMocker.h"
#import <CoreLocation/CoreLocation.h>
+#import <KIF/UIAutomationHelper.h>
@interface MGLMapView (LocationManager)
@@ -41,6 +42,15 @@
tester.mapView.delegate = self;
}
+- (void)approveLocationIfNeeded {
+ if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined) {
+ [UIAutomationHelper acknowledgeSystemAlert];
+ [tester waitForTimeInterval:1];
+ }
+ XCTAssertTrue([CLLocationManager locationServicesEnabled]);
+ XCTAssertEqual([CLLocationManager authorizationStatus], kCLAuthorizationStatusAuthorizedAlways);
+}
+
- (void)testDirectionSet {
tester.mapView.direction = 270;
@@ -576,10 +586,9 @@
object:tester.mapView
whileExecutingBlock:^{
tester.mapView.showsUserLocation = YES;
+ [self approveLocationIfNeeded];
}];
- [tester acknowledgeSystemAlert];
-
XCTAssertEqualObjects(notification.name,
@"mapViewWillStartLocatingUser",
@"mapViewWillStartLocatingUser delegate should receive message");
@@ -613,7 +622,8 @@
- (void)testUserTrackingModeFollow {
tester.mapView.userTrackingMode = MGLUserTrackingModeFollow;
- [tester acknowledgeSystemAlert];
+ [self approveLocationIfNeeded];
+ [tester waitForAnimationsToFinish];
XCTAssertEqual(tester.mapView.userLocationVisible,
YES,
@@ -639,8 +649,9 @@
- (void)testUserTrackingModeFollowWithHeading {
tester.mapView.userTrackingMode = MGLUserTrackingModeFollowWithHeading;
- [tester acknowledgeSystemAlert];
-
+ [self approveLocationIfNeeded];
+ [tester waitForAnimationsToFinish];
+
XCTAssertEqual(tester.mapView.userLocationVisible,
YES,
@"user location should be visible");