forked from flutter/flutter
-
Notifications
You must be signed in to change notification settings - Fork 7
/
GoogleMapsUITests.m
66 lines (57 loc) · 2.73 KB
/
GoogleMapsUITests.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
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 {
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