5#import <XCTest/XCTest.h>
16 self.continueAfterFailure = NO;
18 [[XCUIApplication alloc] initWithBundleIdentifier:@"dev.flutter.FlutterAppExtensionTestHost"];
23 XCUIApplication* app = [[XCUIApplication alloc] init];
27 [
self.hostApplication launch];
28 XCUIElement* button =
self.hostApplication.buttons[@"Open Share"];
29 if (![button waitForExistenceWithTimeout:10]) {
31 XCTFail(
@"Failed due to not able to find any button with %@ seconds", @(10));
34 BOOL launchedExtensionInFlutter = NO;
37 XCUIElement* firstCell =
self.hostApplication.collectionViews.cells.firstMatch;
38 if (![firstCell waitForExistenceWithTimeout:10]) {
40 XCTFail(
@"Failed due to not able to find any cells with %@ seconds", @(10));
49 NSPredicate* cellPredicate = [NSPredicate
51 @"label == 'XCElementSnapshotPrivilegedValuePlaceholder' OR label = 'Scenarios'"];
52 NSArray<XCUIElement*>* shareSheetCells =
53 [
self.hostApplication.collectionViews.cells matchingPredicate:cellPredicate]
54 .allElementsBoundByIndex;
55 for (XCUIElement* shareSheetCell in shareSheetCells) {
58 XCUIElement* flutterView =
self.hostApplication.otherElements[@"flutter_view"];
59 if ([flutterView waitForExistenceWithTimeout:10]) {
60 launchedExtensionInFlutter = YES;
66 XCUIElement* cancel =
self.hostApplication.buttons[@"Cancel"];
67 if ([cancel waitForExistenceWithTimeout:10]) {
72 XCTAssertTrue(launchedExtensionInFlutter);
XCUIApplication * hostApplication
void testAppExtensionLaunching()