summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMinh Nguyễn <mxn@1ec5.org>2016-04-26 17:07:33 -0700
committerMinh Nguyễn <mxn@1ec5.org>2016-05-05 01:07:29 -0700
commit24f1688a7411f9541a883bc03bf17107dd7e0e85 (patch)
tree2a281d56601b8c005e8a91d6fdebe428ada469cf
parenta3dccc14d62a4661ede478a31c6a6dbf39e105d9 (diff)
downloadqtlocation-mapboxgl-24f1688a7411f9541a883bc03bf17107dd7e0e85.tar.gz
[ios] Test telemetry opt-out
-rw-r--r--platform/ios/ios.xcodeproj/project.pbxproj6
-rw-r--r--platform/ios/uitest/MGLTelemetryTests.m47
2 files changed, 53 insertions, 0 deletions
diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj
index 617443fa27..a05162bed1 100644
--- a/platform/ios/ios.xcodeproj/project.pbxproj
+++ b/platform/ios/ios.xcodeproj/project.pbxproj
@@ -51,6 +51,8 @@
DA35A2CC1CCAAAD200E826B2 /* NSValue+MGLAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = DA35A2C81CCAAAD200E826B2 /* NSValue+MGLAdditions.m */; };
DA4A0DF01CCE82500045352A /* MGLAnnotationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DA4A0DEF1CCE82500045352A /* MGLAnnotationTests.m */; };
DA6A65971CCF429800F21F6B /* MGLGestureTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DA6A65961CCF429800F21F6B /* MGLGestureTests.m */; };
+ DA6A65B71CCF583C00F21F6B /* Mapbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA8847D21CBAF91600AB86E3 /* Mapbox.framework */; };
+ DA6A65B91CCF5DB900F21F6B /* MGLTelemetryTests.m in Sources */ = {isa = PBXBuildFile; fileRef = DA6A65B81CCF5DB900F21F6B /* MGLTelemetryTests.m */; };
DA821D061CCC6D59007508D4 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DA821D041CCC6D59007508D4 /* LaunchScreen.storyboard */; };
DA821D071CCC6D59007508D4 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DA821D051CCC6D59007508D4 /* Main.storyboard */; };
DA8847D91CBAF91600AB86E3 /* Mapbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA8847D21CBAF91600AB86E3 /* Mapbox.framework */; };
@@ -359,6 +361,7 @@
DA4A26961CB6E795000B7809 /* Mapbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Mapbox.framework; sourceTree = BUILT_PRODUCTS_DIR; };
DA6A65961CCF429800F21F6B /* MGLGestureTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLGestureTests.m; sourceTree = "<group>"; };
DA6A65981CCF42FE00F21F6B /* MGLUITests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLUITests.h; sourceTree = "<group>"; };
+ DA6A65B81CCF5DB900F21F6B /* MGLTelemetryTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLTelemetryTests.m; sourceTree = "<group>"; };
DA821D041CCC6D59007508D4 /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = "<group>"; };
DA821D051CCC6D59007508D4 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; };
DA8847D21CBAF91600AB86E3 /* Mapbox.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Mapbox.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -499,6 +502,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ DA6A65B71CCF583C00F21F6B /* Mapbox.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -641,6 +645,7 @@
DA6A65981CCF42FE00F21F6B /* MGLUITests.h */,
DA4A0DEF1CCE82500045352A /* MGLAnnotationTests.m */,
DA6A65961CCF429800F21F6B /* MGLGestureTests.m */,
+ DA6A65B81CCF5DB900F21F6B /* MGLTelemetryTests.m */,
DA4A0DF11CCE82500045352A /* Info.plist */,
);
name = "UI Tests";
@@ -1305,6 +1310,7 @@
buildActionMask = 2147483647;
files = (
DA6A65971CCF429800F21F6B /* MGLGestureTests.m in Sources */,
+ DA6A65B91CCF5DB900F21F6B /* MGLTelemetryTests.m in Sources */,
DA4A0DF01CCE82500045352A /* MGLAnnotationTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
diff --git a/platform/ios/uitest/MGLTelemetryTests.m b/platform/ios/uitest/MGLTelemetryTests.m
new file mode 100644
index 0000000000..fcee8bbdee
--- /dev/null
+++ b/platform/ios/uitest/MGLTelemetryTests.m
@@ -0,0 +1,47 @@
+#import "MGLUITests.h"
+
+@interface MGLTelemetryTests : XCTestCase
+
+@end
+
+@implementation MGLTelemetryTests
+
+- (void)setUp {
+ [super setUp];
+
+ self.continueAfterFailure = NO;
+ [XCUIDevice sharedDevice].orientation = UIDeviceOrientationPortrait;
+ XCUIApplication *app = [[XCUIApplication alloc] init];
+
+ // Bypass the access token prompt.
+ NSMutableDictionary <NSString *, NSString *> *environment = app.launchEnvironment.mutableCopy;
+ environment[@"MAPBOX_ACCESS_TOKEN"] = MGLUITestsBogusAccessToken;
+ app.launchEnvironment = environment;
+
+ [app launch];
+}
+
+- (void)testOptOut {
+ XCUIApplication *app = [[XCUIApplication alloc] init];
+ XCUIElement *mapElement = app.otherElements[@"MGLMapView"];
+ XCUIElement *infoButton = mapElement.buttons[@"MGLMapViewInfo"];
+ [infoButton tap];
+
+ XCUIElement *telemetryButton = app.sheets[@"Mapbox iOS SDK"].collectionViews.buttons[@"Mapbox Telemetry"];
+ [telemetryButton tap];
+
+ XCUIElementQuery *collectionViewsQuery = app.alerts[@"Make Mapbox Maps Better"].collectionViews;
+ [collectionViewsQuery.buttons[@"Keep Participating"] tap];
+ [infoButton tap];
+ [telemetryButton tap];
+ [collectionViewsQuery.buttons[@"Stop Participating"] tap];
+
+ [infoButton tap];
+ [telemetryButton tap];
+ [collectionViewsQuery.buttons[@"Don’t Participate"] tap];
+ [infoButton tap];
+ [telemetryButton tap];
+ [collectionViewsQuery.buttons[@"Participate"] tap];
+}
+
+@end