Flutter Engine
The Flutter Engine
StatusBarTest.m
Go to the documentation of this file.
1// Copyright 2020 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 "StatusBarTest.h"
6
7@implementation StatusBarTest
8
9- (void)setUp {
10 [super setUp];
11 self.continueAfterFailure = NO;
12
13 self.application = [[XCUIApplication alloc] init];
14 self.application.launchArguments = @[ @"--tap-status-bar" ];
15 [self.application launch];
16}
17
18- (void)testTapStatusBar {
19 if (@available(iOS 13, *)) {
20 XCUIApplication* systemApp =
21 [[XCUIApplication alloc] initWithBundleIdentifier:@"com.apple.springboard"];
22 XCUIElement* statusBar = [systemApp.statusBars firstMatch];
23 if (statusBar.isHittable) {
24 [statusBar tap];
25 } else {
26 XCUICoordinate* coordinates = [statusBar coordinateWithNormalizedOffset:CGVectorMake(0, 0)];
27 [coordinates tap];
28 }
29 } else {
30 [[self.application.statusBars firstMatch] tap];
31 }
32
33 XCUIElement* addTextField =
34 self.application
35 .textFields[@"0,PointerChange.add,device=0,buttons=0,signalKind=PointerSignalKind.none"];
36 BOOL exists = [addTextField waitForExistenceWithTimeout:1];
37 XCTAssertTrue(exists, @"");
38 XCUIElement* downTextField =
39 self.application
40 .textFields[@"1,PointerChange.down,device=0,buttons=0,signalKind=PointerSignalKind.none"];
41 exists = [downTextField waitForExistenceWithTimeout:1];
42 XCTAssertTrue(exists, @"");
43 XCUIElement* upTextField =
44 self.application
45 .textFields[@"2,PointerChange.up,device=0,buttons=0,signalKind=PointerSignalKind.none"];
46 exists = [upTextField waitForExistenceWithTimeout:1];
47 XCTAssertTrue(exists, @"");
48}
49
50@end
void testTapStatusBar()
Definition: StatusBarTest.m:18
int BOOL
Definition: windows_types.h:37