Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit 0ee83e9

Browse files
committed
[google_maps_flutter] Add iOS unit and UI tests
1 parent 2576d6b commit 0ee83e9

File tree

11 files changed

+412
-8
lines changed

11 files changed

+412
-8
lines changed

packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## NEXT
2+
3+
* Add iOS unit and UI integration test targets.
4+
15
## 2.0.6
26

37
* Migrate maven repo from jcenter to mavenCentral.

packages/google_maps_flutter/google_maps_flutter/example/ios/Podfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ flutter_ios_podfile_setup
2929

3030
target 'Runner' do
3131
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
32+
target 'RunnerTests' do
33+
inherit! :search_paths
34+
end
3235
end
3336

3437
post_install do |installer|

packages/google_maps_flutter/google_maps_flutter/example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 245 additions & 7 deletions
Large diffs are not rendered by default.

packages/google_maps_flutter/google_maps_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/google_maps_flutter/google_maps_flutter/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,26 @@
3737
</BuildableReference>
3838
</MacroExpansion>
3939
<Testables>
40+
<TestableReference
41+
skipped = "NO">
42+
<BuildableReference
43+
BuildableIdentifier = "primary"
44+
BlueprintIdentifier = "F7151F0F265D7ED70028CB91"
45+
BuildableName = "RunnerTests.xctest"
46+
BlueprintName = "RunnerTests"
47+
ReferencedContainer = "container:Runner.xcodeproj">
48+
</BuildableReference>
49+
</TestableReference>
50+
<TestableReference
51+
skipped = "NO">
52+
<BuildableReference
53+
BuildableIdentifier = "primary"
54+
BlueprintIdentifier = "F7151F1D265D7EE50028CB91"
55+
BuildableName = "RunnerUITests.xctest"
56+
BlueprintName = "RunnerUITests"
57+
ReferencedContainer = "container:Runner.xcodeproj">
58+
</BuildableReference>
59+
</TestableReference>
4060
</Testables>
4161
</TestAction>
4262
<LaunchAction
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
@import google_maps_flutter;
6+
@import XCTest;
7+
8+
@interface GoogleMapsTests : XCTestCase
9+
@end
10+
11+
@implementation GoogleMapsTests
12+
13+
- (void)testPlugin {
14+
FLTGoogleMapsPlugin* plugin = [[FLTGoogleMapsPlugin alloc] init];
15+
XCTAssertNotNil(plugin);
16+
}
17+
18+
@end
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>$(DEVELOPMENT_LANGUAGE)</string>
7+
<key>CFBundleExecutable</key>
8+
<string>$(EXECUTABLE_NAME)</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>$(PRODUCT_NAME)</string>
15+
<key>CFBundlePackageType</key>
16+
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>1.0</string>
19+
<key>CFBundleVersion</key>
20+
<string>1</string>
21+
</dict>
22+
</plist>
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
// Copyright 2013 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
@import XCTest;
6+
@import os.log;
7+
8+
@interface GoogleMapsUITests : XCTestCase
9+
@property(nonatomic, strong) XCUIApplication* app;
10+
@end
11+
12+
@implementation GoogleMapsUITests
13+
14+
- (void)setUp {
15+
self.continueAfterFailure = NO;
16+
17+
self.app = [[XCUIApplication alloc] init];
18+
[self.app launch];
19+
20+
[self addUIInterruptionMonitorWithDescription:@"Permission popups"
21+
handler:^BOOL(XCUIElement* _Nonnull interruptingElement) {
22+
if (@available(iOS 14, *)) {
23+
XCUIElement* locationPermission = interruptingElement.buttons[@"Allow While Using App"];
24+
if (![locationPermission waitForExistenceWithTimeout:30.0]) {
25+
XCTFail(@"Failed due to not able to find locationPermission button");
26+
}
27+
[locationPermission tap];
28+
29+
} else {
30+
XCUIElement* allow = interruptingElement.buttons[@"Allow"];
31+
if (![allow waitForExistenceWithTimeout:30.0]) {
32+
XCTFail(@"Failed due to not able to find Allow button");
33+
}
34+
[allow tap];
35+
}
36+
return YES;
37+
}];
38+
}
39+
40+
- (void)testUserInterface {
41+
XCUIApplication* app = self.app;
42+
XCUIElement* userInteface = app.staticTexts[@"User interface"];
43+
if (![userInteface waitForExistenceWithTimeout:30.0]) {
44+
os_log_error(OS_LOG_DEFAULT, "%@", app.debugDescription);
45+
XCTFail(@"Failed due to not able to find User interface");
46+
}
47+
[userInteface tap];
48+
XCUIElement* platformView = app.otherElements[@"platform_view[0]"];
49+
if (![platformView waitForExistenceWithTimeout:30.0]) {
50+
os_log_error(OS_LOG_DEFAULT, "%@", app.debugDescription);
51+
XCTFail(@"Failed due to not able to find platform view");
52+
}
53+
XCUIElement* compass = app.buttons[@"disable compass"];
54+
if (![compass waitForExistenceWithTimeout:30.0]) {
55+
os_log_error(OS_LOG_DEFAULT, "%@", app.debugDescription);
56+
XCTFail(@"Failed due to not able to find compass button");
57+
}
58+
[compass tap];
59+
}
60+
61+
@end
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleDevelopmentRegion</key>
6+
<string>$(DEVELOPMENT_LANGUAGE)</string>
7+
<key>CFBundleExecutable</key>
8+
<string>$(EXECUTABLE_NAME)</string>
9+
<key>CFBundleIdentifier</key>
10+
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11+
<key>CFBundleInfoDictionaryVersion</key>
12+
<string>6.0</string>
13+
<key>CFBundleName</key>
14+
<string>$(PRODUCT_NAME)</string>
15+
<key>CFBundlePackageType</key>
16+
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
17+
<key>CFBundleShortVersionString</key>
18+
<string>1.0</string>
19+
<key>CFBundleVersion</key>
20+
<string>1</string>
21+
</dict>
22+
</plist>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

0 commit comments

Comments
 (0)