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 = self.application.textFields[@"PointerChange.add"];
34  BOOL exists = [addTextField waitForExistenceWithTimeout:1];
35  XCTAssertTrue(exists, @"");
36  XCUIElement* upTextField = self.application.textFields[@"PointerChange.up"];
37  exists = [upTextField waitForExistenceWithTimeout:1];
38  XCTAssertTrue(exists, @"");
39 }
40 
41 @end
XCUIApplication * application
Definition: StatusBarTest.h:10