IntegrationTests.m 1.36 KB
Newer Older
1 2 3 4
// Copyright 2014 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.

5
#import <EarlGreyTest/EarlGrey.h>
6 7 8 9 10 11 12 13 14 15
#import <XCTest/XCTest.h>

#import "AppDelegate.h"
#import "FullScreenViewController.h"

@interface FlutterTests : XCTestCase
@end

@implementation FlutterTests

16 17 18 19
- (void)setUp {
  self.continueAfterFailure = NO;
  XCUIApplication *app = [[XCUIApplication alloc] init];
  [app launch];
20 21 22
}

- (void)testFullScreenCanPop {
23 24 25 26 27 28 29
  XCTestExpectation *notificationReceived = [self expectationWithDescription:@"Remote semantics notification"];
  NSNotificationCenter *notificationCenter = [[GREYHostApplicationDistantObject sharedInstance] notificationCenter];
  id observer = [notificationCenter addObserverForName:FlutterSemanticsUpdateNotification object:nil queue:nil usingBlock:^(NSNotification *notification) {
    XCTAssertTrue([notification.object isKindOfClass:GREY_REMOTE_CLASS_IN_APP(FullScreenViewController)]);
    [notificationReceived fulfill];
  }];

30 31 32 33
  [[EarlGrey selectElementWithMatcher:grey_keyWindow()]
      assertWithMatcher:grey_sufficientlyVisible()];
  [[EarlGrey selectElementWithMatcher:grey_buttonTitle(@"Full Screen (Cold)")]
      performAction:grey_tap()];
34 35 36

  [self waitForExpectationsWithTimeout:30.0 handler:nil];
  [notificationCenter removeObserver:observer];
37 38 39
}

@end