2
2
// Use of this source code is governed by a BSD-style license that can be
3
3
// found in the LICENSE file.
4
4
5
+ @import CoreLocation;
5
6
@import XCTest;
6
7
@import os.log;
7
- @import GoogleMaps;
8
8
9
9
@interface GoogleMapsUITests : XCTestCase
10
10
@property (nonatomic , strong ) XCUIApplication *app;
@@ -18,8 +18,6 @@ - (void)setUp {
18
18
self.app = [[XCUIApplication alloc ] init ];
19
19
[self .app launch ];
20
20
21
- // The location permission interception is currently not working.
22
- // See: https://github.com/flutter/flutter/issues/93325.
23
21
[self
24
22
addUIInterruptionMonitorWithDescription: @" Permission popups"
25
23
handler: ^BOOL (XCUIElement *_Nonnull interruptingElement) {
@@ -45,26 +43,35 @@ - (void)setUp {
45
43
}];
46
44
}
47
45
48
- // Temporarily disabled due to https://github.com/flutter/flutter/issues/93325
49
- - (void )skip_testUserInterface {
46
+ - (void )testUserInterface {
50
47
XCUIApplication *app = self.app ;
51
48
XCUIElement *userInteface = app.staticTexts [@" User interface" ];
52
49
if (![userInteface waitForExistenceWithTimeout: 30.0 ]) {
53
50
os_log_error (OS_LOG_DEFAULT, " %@" , app.debugDescription );
54
51
XCTFail (@" Failed due to not able to find User interface" );
55
52
}
56
53
[userInteface tap ];
54
+
57
55
XCUIElement *platformView = app.otherElements [@" platform_view[0]" ];
58
56
if (![platformView waitForExistenceWithTimeout: 30.0 ]) {
59
57
os_log_error (OS_LOG_DEFAULT, " %@" , app.debugDescription );
60
58
XCTFail (@" Failed due to not able to find platform view" );
61
59
}
60
+
61
+ // There is a known bug where the permission popups interruption won't get fired until a tap
62
+ // happened in the app. We expect a permission popup so we do a tap here.
63
+ // iOS 16 has a bug where if the app itself is directly tapped: [app tap], the first button
64
+ // (disable compass) in the app is also tapped, so instead we tap a arbitrary location in the app
65
+ // instead.
66
+ XCUICoordinate *coordinate = [app coordinateWithNormalizedOffset: CGVectorMake (0 , 0 )];
67
+ [coordinate tap ];
62
68
XCUIElement *compass = app.buttons [@" disable compass" ];
63
69
if (![compass waitForExistenceWithTimeout: 30.0 ]) {
64
70
os_log_error (OS_LOG_DEFAULT, " %@" , app.debugDescription );
65
- XCTFail (@" Failed due to not able to find compass button" );
71
+ XCTFail (@" Failed due to not able to find disable compass button" );
66
72
}
67
- [compass tap ];
73
+
74
+ [self forceTap: compass];
68
75
}
69
76
70
77
- (void )testMapCoordinatesPage {
@@ -190,4 +197,16 @@ - (void)testMapClickPage {
190
197
}
191
198
}
192
199
200
+ - (void )forceTap : (XCUIElement *)button {
201
+ // iOS 16 introduced a bug where hittable is NO for buttons. We force hit the location of the
202
+ // button if that is the case. It is likely similar to
203
+ // https://github.com/flutter/flutter/issues/113377.
204
+ if (button.isHittable ) {
205
+ [button tap ];
206
+ return ;
207
+ }
208
+ XCUICoordinate *coordinate = [button coordinateWithNormalizedOffset: CGVectorMake (0 , 0 )];
209
+ [coordinate tap ];
210
+ }
211
+
193
212
@end
0 commit comments