5#import <XCTest/XCTest.h>
16 self.continueAfterFailure = NO;
17 self.hostApplication =
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;
42 NSPredicate* cellPredicate = [NSPredicate
44 @"label == 'XCElementSnapshotPrivilegedValuePlaceholder' OR label = 'Scenarios'"];
47 XCUIElement* firstCell =
48 [
self.hostApplication.collectionViews.cells matchingPredicate:cellPredicate].firstMatch;
49 if (![firstCell waitForExistenceWithTimeout:10]) {
51 XCTFail(
@"Failed due to not able to find Scenarios cell within %@ seconds", @(10));
54 NSArray<XCUIElement*>* shareSheetCells =
55 [
self.hostApplication.collectionViews.cells matchingPredicate:cellPredicate]
56 .allElementsBoundByIndex;
57 for (XCUIElement* shareSheetCell in shareSheetCells) {
60 XCUIElement* flutterView =
self.hostApplication.otherElements[@"flutter_view"];
61 if ([flutterView waitForExistenceWithTimeout:10]) {
62 launchedExtensionInFlutter = YES;
68 XCUIElement* cancel =
self.hostApplication.buttons[@"Cancel"];
69 if ([cancel waitForExistenceWithTimeout:10]) {
74 XCTAssertTrue(launchedExtensionInFlutter);
XCUIApplication * hostApplication
void testAppExtensionLaunching()