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
Reland "[google_maps_flutter] ios: re-enable test with popup #5312" #6783
Merged
auto-submit
merged 3 commits into
flutter:main
from
cyanglaz:reland_enable_google_map_interface_test
Dec 12, 2022
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
2 changes: 2 additions & 0 deletions
2
packages/google_maps_flutter/google_maps_flutter_ios/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
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 |
---|---|---|
|
@@ -2,9 +2,9 @@ | |
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
@import CoreLocation; | ||
@import XCTest; | ||
@import os.log; | ||
@import GoogleMaps; | ||
|
||
@interface GoogleMapsUITests : XCTestCase | ||
@property(nonatomic, strong) XCUIApplication *app; | ||
|
@@ -18,8 +18,6 @@ - (void)setUp { | |
self.app = [[XCUIApplication alloc] init]; | ||
[self.app launch]; | ||
|
||
// The location permission interception is currently not working. | ||
// See: https://github.com/flutter/flutter/issues/93325. | ||
[self | ||
addUIInterruptionMonitorWithDescription:@"Permission popups" | ||
handler:^BOOL(XCUIElement *_Nonnull interruptingElement) { | ||
|
@@ -45,26 +43,35 @@ - (void)setUp { | |
}]; | ||
} | ||
|
||
// Temporarily disabled due to https://github.com/flutter/flutter/issues/93325 | ||
- (void)skip_testUserInterface { | ||
- (void)testUserInterface { | ||
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"); | ||
} | ||
|
||
// There is a known bug where the permission popups interruption won't get fired until a tap | ||
// happened in the app. We expect a permission popup so we do a tap here. | ||
// iOS 16 has a bug where if the app itself is directly tapped: [app tap], the first button | ||
// (disable compass) in the app is also tapped, so instead we tap a arbitrary location in the app | ||
// instead. | ||
XCUICoordinate *coordinate = [app coordinateWithNormalizedOffset:CGVectorMake(0, 0)]; | ||
[coordinate tap]; | ||
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"); | ||
XCTFail(@"Failed due to not able to find disable compass button"); | ||
} | ||
[compass tap]; | ||
|
||
[self forceTap:compass]; | ||
} | ||
|
||
- (void)testMapCoordinatesPage { | ||
|
@@ -190,4 +197,16 @@ - (void)testMapClickPage { | |
} | ||
} | ||
|
||
- (void)forceTap:(XCUIElement *)button { | ||
// iOS 16 introduced a bug where hittable is NO for buttons. We force hit the location of the | ||
// button if that is the case. It is likely similar to | ||
// https://github.com/flutter/flutter/issues/113377. | ||
if (button.isHittable) { | ||
[button tap]; | ||
return; | ||
} | ||
XCUICoordinate *coordinate = [button coordinateWithNormalizedOffset:CGVectorMake(0, 0)]; | ||
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. Hopefully this doesn't cause flakiness. |
||
[coordinate tap]; | ||
} | ||
|
||
@end |
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.
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.
We don't need the entire GoogleMaps sdk to run the tests. Only CoreLocation is necessary.