diff --git a/dev/devicelab/bin/tasks/native_ui_tests_ios.dart b/dev/devicelab/bin/tasks/native_ui_tests_ios.dart new file mode 100644 index 000000000000..68bc76f3eff2 --- /dev/null +++ b/dev/devicelab/bin/tasks/native_ui_tests_ios.dart @@ -0,0 +1,49 @@ +// 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. + +import 'package:flutter_devicelab/framework/devices.dart'; +import 'package:flutter_devicelab/framework/framework.dart'; +import 'package:flutter_devicelab/framework/ios.dart'; +import 'package:flutter_devicelab/framework/task_result.dart'; +import 'package:flutter_devicelab/framework/utils.dart'; +import 'package:path/path.dart' as path; + +Future main() async { + deviceOperatingSystem = DeviceOperatingSystem.ios; + + await task(() async { + final String projectDirectory = '${flutterDirectory.path}/dev/integration_tests/flutter_gallery'; + + await inDirectory(projectDirectory, () async { + section('Build clean'); + + await flutter('clean'); + + section('Build gallery app'); + + await flutter( + 'build', + options: [ + 'ios', + '-v', + '--release', + '--config-only', + ], + ); + }); + + section('Run platform unit tests'); + + final Device device = await devices.workingDevice; + if (!await runXcodeTests( + platformDirectory: path.join(projectDirectory, 'ios'), + destination: 'id=${device.deviceId}', + testName: 'native_ui_tests_ios', + )) { + return TaskResult.failure('Platform unit tests failed'); + } + + return TaskResult.success(null); + }); +} diff --git a/dev/integration_tests/flutter_gallery/ios/GalleryUITests/GalleryUITests.m b/dev/integration_tests/flutter_gallery/ios/GalleryUITests/GalleryUITests.m new file mode 100644 index 000000000000..92dde33f295d --- /dev/null +++ b/dev/integration_tests/flutter_gallery/ios/GalleryUITests/GalleryUITests.m @@ -0,0 +1,26 @@ +// 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. + +#import + +@interface GalleryUITests : XCTestCase +@property (strong) XCUIApplication *app; +@end + +@implementation GalleryUITests + +- (void)setUp { + self.continueAfterFailure = NO; + + XCUIApplication *app = [[XCUIApplication alloc] init]; + [app launch]; + self.app = app; +} + +- (void)testLaunch { + // Basic smoke test that the app launched and any element was loaded. + XCTAssertTrue([self.app.otherElements.firstMatch waitForExistenceWithTimeout:60.0]); +} + +@end diff --git a/dev/integration_tests/flutter_gallery/ios/GalleryUITests/Info.plist b/dev/integration_tests/flutter_gallery/ios/GalleryUITests/Info.plist new file mode 100644 index 000000000000..64d65ca49577 --- /dev/null +++ b/dev/integration_tests/flutter_gallery/ios/GalleryUITests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/dev/integration_tests/flutter_gallery/ios/Runner.xcodeproj/project.pbxproj b/dev/integration_tests/flutter_gallery/ios/Runner.xcodeproj/project.pbxproj index 0437c23e8e8c..5facc21e7b3f 100644 --- a/dev/integration_tests/flutter_gallery/ios/Runner.xcodeproj/project.pbxproj +++ b/dev/integration_tests/flutter_gallery/ios/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 50; objects = { /* Begin PBXBuildFile section */ @@ -15,8 +15,19 @@ 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; AA1F617779EAA28FB12EC66E /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C77CA0BBC4B57129484236F4 /* libPods-Runner.a */; }; + F7C2268825DCA70C00389C82 /* GalleryUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = F7C2268725DCA70C00389C82 /* GalleryUITests.m */; }; /* End PBXBuildFile section */ +/* Begin PBXContainerItemProxy section */ + F7C2268A25DCA70C00389C82 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 97C146E61CF9000F007C117D /* Project object */; + proxyType = 1; + remoteGlobalIDString = 97C146ED1CF9000F007C117D; + remoteInfo = Runner; + }; +/* End PBXContainerItemProxy section */ + /* Begin PBXCopyFilesBuildPhase section */ 9705A1C41CF9048500538489 /* Embed Frameworks */ = { isa = PBXCopyFilesBuildPhase; @@ -49,6 +60,9 @@ C77CA0BBC4B57129484236F4 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; DC01738FBE39EADD5AC4BF42 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; ECF490DDAB8ABCEEFB1780BE /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + F7C2268525DCA70C00389C82 /* GalleryUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GalleryUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + F7C2268725DCA70C00389C82 /* GalleryUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GalleryUITests.m; sourceTree = ""; }; + F7C2268925DCA70C00389C82 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -60,6 +74,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + F7C2268225DCA70C00389C82 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -79,6 +100,7 @@ children = ( 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, + F7C2268625DCA70C00389C82 /* GalleryUITests */, 97C146EF1CF9000F007C117D /* Products */, CF3B75C9A7D2FA2A4C99F110 /* Frameworks */, E54E8B7296D73DD9B2385312 /* Pods */, @@ -89,6 +111,7 @@ isa = PBXGroup; children = ( 97C146EE1CF9000F007C117D /* Flutter Gallery.app */, + F7C2268525DCA70C00389C82 /* GalleryUITests.xctest */, ); name = Products; sourceTree = ""; @@ -135,6 +158,15 @@ name = Pods; sourceTree = ""; }; + F7C2268625DCA70C00389C82 /* GalleryUITests */ = { + isa = PBXGroup; + children = ( + F7C2268725DCA70C00389C82 /* GalleryUITests.m */, + F7C2268925DCA70C00389C82 /* Info.plist */, + ); + path = GalleryUITests; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -159,6 +191,24 @@ productReference = 97C146EE1CF9000F007C117D /* Flutter Gallery.app */; productType = "com.apple.product-type.application"; }; + F7C2268425DCA70C00389C82 /* GalleryUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = F7C2268F25DCA70C00389C82 /* Build configuration list for PBXNativeTarget "GalleryUITests" */; + buildPhases = ( + F7C2268125DCA70C00389C82 /* Sources */, + F7C2268225DCA70C00389C82 /* Frameworks */, + F7C2268325DCA70C00389C82 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + F7C2268B25DCA70C00389C82 /* PBXTargetDependency */, + ); + name = GalleryUITests; + productName = GalleryUITests; + productReference = F7C2268525DCA70C00389C82 /* GalleryUITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -171,6 +221,11 @@ 97C146ED1CF9000F007C117D = { CreatedOnToolsVersion = 7.3.1; }; + F7C2268425DCA70C00389C82 = { + CreatedOnToolsVersion = 12.4; + ProvisioningStyle = Automatic; + TestTargetID = 97C146ED1CF9000F007C117D; + }; }; }; buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; @@ -187,6 +242,7 @@ projectRoot = ""; targets = ( 97C146ED1CF9000F007C117D /* Runner */, + F7C2268425DCA70C00389C82 /* GalleryUITests */, ); }; /* End PBXProject section */ @@ -203,6 +259,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + F7C2268325DCA70C00389C82 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ @@ -250,7 +313,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build\n"; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; /* End PBXShellScriptBuildPhase section */ @@ -265,8 +328,24 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + F7C2268125DCA70C00389C82 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + F7C2268825DCA70C00389C82 /* GalleryUITests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXTargetDependency section */ + F7C2268B25DCA70C00389C82 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 97C146ED1CF9000F007C117D /* Runner */; + targetProxy = F7C2268A25DCA70C00389C82 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + /* Begin PBXVariantGroup section */ 97C146FA1CF9000F007C117D /* Main.storyboard */ = { isa = PBXVariantGroup; @@ -479,6 +558,45 @@ }; name = Release; }; + F7C2268C25DCA70C00389C82 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + INFOPLIST_FILE = GalleryUITests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.flutterio.GalleryUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_TARGET_NAME = Runner; + }; + name = Debug; + }; + F7C2268D25DCA70C00389C82 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + INFOPLIST_FILE = GalleryUITests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.flutterio.GalleryUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_TARGET_NAME = Runner; + }; + name = Release; + }; + F7C2268E25DCA70C00389C82 /* Profile */ = { + isa = XCBuildConfiguration; + buildSettings = { + INFOPLIST_FILE = GalleryUITests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_FAST_MATH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.flutterio.GalleryUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_TARGET_NAME = Runner; + }; + name = Profile; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -502,6 +620,16 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + F7C2268F25DCA70C00389C82 /* Build configuration list for PBXNativeTarget "GalleryUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F7C2268C25DCA70C00389C82 /* Debug */, + F7C2268D25DCA70C00389C82 /* Release */, + F7C2268E25DCA70C00389C82 /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = 97C146E61CF9000F007C117D /* Project object */; diff --git a/dev/integration_tests/flutter_gallery/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/dev/integration_tests/flutter_gallery/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index e7b2d8764c65..c27e9dc99aea 100644 --- a/dev/integration_tests/flutter_gallery/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/dev/integration_tests/flutter_gallery/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -37,6 +37,16 @@ + + + +