[platform_view]terminate the app in tear down for platform view xcuitest (#109720)

This commit is contained in:
hellohuanlin 2022-08-17 19:53:55 -07:00 committed by GitHub
parent 61a54b0798
commit 04f4dd8e54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,11 +23,23 @@ static const CGFloat kStandardTimeOut = 60.0;
@implementation PlatformViewUITests
- (void)setUp {
[super setup];
self.continueAfterFailure = NO;
self.app = [[XCUIApplication alloc] init];
[self.app launch];
}
- (void)tearDown {
// This is trying to fix a "failed to terminate" failure, which is likely a bug in Xcode.
// In theory the terminate call is not necessary, but many has encountered this similar
// issue, and fixed it by terminating the app and relaunching it if needed for each test.
// Here we simply try terminating the app in tearDown, but if it does not work,
// then alternative solution is to terminate and relaunch the app.
[self.app terminate];
[super tearDown];
}
- (void)testPlatformViewFocus {
XCUIElement *entranceButton = self.app.buttons[@"platform view focus test"];
XCTAssertTrue([entranceButton waitForExistenceWithTimeout:kStandardTimeOut], @"The element tree is %@", self.app.debugDescription);