This repository was archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[google_maps_flutter] Add iOS unit and UI tests #3978
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
packages/google_maps_flutter/google_maps_flutter/CHANGELOG.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
252 changes: 245 additions & 7 deletions
252
...ages/google_maps_flutter/google_maps_flutter/example/ios/Runner.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...le_maps_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
.../google_maps_flutter/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |
18 changes: 18 additions & 0 deletions
18
packages/google_maps_flutter/google_maps_flutter/example/ios/RunnerTests/GoogleMapsTests.m
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
@import google_maps_flutter; | ||
@import XCTest; | ||
|
||
@interface GoogleMapsTests : XCTestCase | ||
@end | ||
|
||
@implementation GoogleMapsTests | ||
|
||
- (void)testPlugin { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Smoke test to prove linking against the plugin works. |
||
FLTGoogleMapsPlugin* plugin = [[FLTGoogleMapsPlugin alloc] init]; | ||
XCTAssertNotNil(plugin); | ||
} | ||
|
||
@end |
22 changes: 22 additions & 0 deletions
22
packages/google_maps_flutter/google_maps_flutter/example/ios/RunnerTests/Info.plist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>$(DEVELOPMENT_LANGUAGE)</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleVersion</key> | ||
<string>1</string> | ||
</dict> | ||
</plist> |
66 changes: 66 additions & 0 deletions
66
...ges/google_maps_flutter/google_maps_flutter/example/ios/RunnerUITests/GoogleMapsUITests.m
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
@import XCTest; | ||
@import os.log; | ||
|
||
@interface GoogleMapsUITests : XCTestCase | ||
@property(nonatomic, strong) XCUIApplication* app; | ||
@end | ||
|
||
@implementation GoogleMapsUITests | ||
|
||
- (void)setUp { | ||
self.continueAfterFailure = NO; | ||
|
||
self.app = [[XCUIApplication alloc] init]; | ||
[self.app launch]; | ||
|
||
[self | ||
addUIInterruptionMonitorWithDescription:@"Permission popups" | ||
handler:^BOOL(XCUIElement* _Nonnull interruptingElement) { | ||
if (@available(iOS 14, *)) { | ||
XCUIElement* locationPermission = | ||
interruptingElement.buttons[@"Allow While Using App"]; | ||
if (![locationPermission | ||
waitForExistenceWithTimeout:30.0]) { | ||
XCTFail(@"Failed due to not able to find " | ||
@"locationPermission button"); | ||
} | ||
[locationPermission tap]; | ||
|
||
} else { | ||
XCUIElement* allow = | ||
interruptingElement.buttons[@"Allow"]; | ||
if (![allow waitForExistenceWithTimeout:30.0]) { | ||
XCTFail(@"Failed due to not able to find Allow button"); | ||
} | ||
[allow tap]; | ||
} | ||
return YES; | ||
}]; | ||
} | ||
|
||
- (void)testUserInterface { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a smoke test to prove the UI test is set up correctly. |
||
XCUIApplication* app = self.app; | ||
XCUIElement* userInteface = app.staticTexts[@"User interface"]; | ||
if (![userInteface waitForExistenceWithTimeout:30.0]) { | ||
os_log_error(OS_LOG_DEFAULT, "%@", app.debugDescription); | ||
XCTFail(@"Failed due to not able to find User interface"); | ||
} | ||
[userInteface tap]; | ||
XCUIElement* platformView = app.otherElements[@"platform_view[0]"]; | ||
if (![platformView waitForExistenceWithTimeout:30.0]) { | ||
os_log_error(OS_LOG_DEFAULT, "%@", app.debugDescription); | ||
XCTFail(@"Failed due to not able to find platform view"); | ||
} | ||
XCUIElement* compass = app.buttons[@"disable compass"]; | ||
if (![compass waitForExistenceWithTimeout:30.0]) { | ||
os_log_error(OS_LOG_DEFAULT, "%@", app.debugDescription); | ||
XCTFail(@"Failed due to not able to find compass button"); | ||
} | ||
[compass tap]; | ||
} | ||
|
||
@end |
22 changes: 22 additions & 0 deletions
22
packages/google_maps_flutter/google_maps_flutter/example/ios/RunnerUITests/Info.plist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>$(DEVELOPMENT_LANGUAGE)</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleVersion</key> | ||
<string>1</string> | ||
</dict> | ||
</plist> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RunnerTests
needs to link against Flutter and plugins.RunnerUITests
do not since they interact with the UI blackbox.