Unverified Commit a30ebf67 authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Add gallery integration iOS UI integration test (#76658)

parent ea1e1a41
// 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 'dart:io';
import 'package:flutter_devicelab/framework/adb.dart';
import 'package:flutter_devicelab/framework/framework.dart';
import 'package:flutter_devicelab/framework/host_agent.dart';
import 'package:flutter_devicelab/framework/task_result.dart';
import 'package:flutter_devicelab/framework/utils.dart';
import 'package:path/path.dart' as path;
Future<void> 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: <String>[
'ios',
'-v',
'--release',
'--config-only',
],
);
});
section('Run platform unit tests');
final Device device = await devices.workingDevice;
final Map<String, String> environment = Platform.environment;
// If not running on CI, inject the Flutter team code signing properties.
final String developmentTeam = environment['FLUTTER_XCODE_DEVELOPMENT_TEAM'] ?? 'S8QB4VV633';
final String codeSignStyle = environment['FLUTTER_XCODE_CODE_SIGN_STYLE'];
final String provisioningProfile = environment['FLUTTER_XCODE_PROVISIONING_PROFILE_SPECIFIER'];
final String resultBundleTemp = Directory.systemTemp.createTempSync('native_ui_tests_ios32_xcresult.').path;
final String resultBundlePath = path.join(resultBundleTemp, 'result');
final int testResultExit = await exec(
'xcodebuild',
<String>[
'-workspace',
'Runner.xcworkspace',
'-scheme',
'Runner',
'-configuration',
'Release',
'-destination',
'id=${device.deviceId}',
'-resultBundlePath',
resultBundlePath,
'test',
'COMPILER_INDEX_STORE_ENABLE=NO',
'DEVELOPMENT_TEAM=$developmentTeam',
if (codeSignStyle != null)
'CODE_SIGN_STYLE=$codeSignStyle',
if (provisioningProfile != null)
'PROVISIONING_PROFILE_SPECIFIER=$provisioningProfile',
],
workingDirectory: path.join(projectDirectory, 'ios'),
canFail: true,
);
if (testResultExit != 0) {
// Zip the test results to the artifacts directory for upload.
final String zipPath = path.join(hostAgent.dumpDirectory.path,
'native_ui_tests_ios32-${DateTime.now().toLocal().toIso8601String()}.zip');
await exec(
'zip',
<String>[
'-r',
'-9',
zipPath,
'result.xcresult',
],
workingDirectory: resultBundleTemp,
canFail: true, // Best effort to get the logs.
);
return TaskResult.failure('Platform unit tests failed');
}
return TaskResult.success(null);
});
}
...@@ -91,6 +91,13 @@ tasks: ...@@ -91,6 +91,13 @@ tasks:
stage: devicelab_ios stage: devicelab_ios
required_agent_capabilities: ["mac/ios32"] required_agent_capabilities: ["mac/ios32"]
native_ui_tests_ios32:
description: >
Run native XCUITests on 32-bit iOS (iPhone 4S).
stage: devicelab_ios
required_agent_capabilities: ["mac/ios32"]
flaky: true
platform_interaction_test_ios: platform_interaction_test_ios:
description: > description: >
Checks platform interaction on iPhone 6. Checks platform interaction on iPhone 6.
......
// 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 <XCTest/XCTest.h>
@interface GalleryUITests : XCTestCase
@end
@implementation GalleryUITests
- (void)setUp {
self.continueAfterFailure = NO;
}
- (void)testLaunch {
XCUIApplication *app = [[XCUIApplication alloc] init];
[app launch];
// Basic smoke test that the app launched and any element was loaded.
XCTAssertTrue([app.otherElements.firstMatch waitForExistenceWithTimeout:60.0]);
}
@end
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>
...@@ -15,8 +15,19 @@ ...@@ -15,8 +15,19 @@
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
AA1F617779EAA28FB12EC66E /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C77CA0BBC4B57129484236F4 /* libPods-Runner.a */; }; 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 */ /* 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 */ /* Begin PBXCopyFilesBuildPhase section */
9705A1C41CF9048500538489 /* Embed Frameworks */ = { 9705A1C41CF9048500538489 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase; isa = PBXCopyFilesBuildPhase;
...@@ -49,6 +60,9 @@ ...@@ -49,6 +60,9 @@
C77CA0BBC4B57129484236F4 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 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 = "<group>"; }; 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 = "<group>"; };
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 = "<group>"; }; 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 = "<group>"; };
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 = "<group>"; };
F7C2268925DCA70C00389C82 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
...@@ -60,6 +74,13 @@ ...@@ -60,6 +74,13 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
F7C2268225DCA70C00389C82 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */ /* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */ /* Begin PBXGroup section */
...@@ -79,6 +100,7 @@ ...@@ -79,6 +100,7 @@
children = ( children = (
9740EEB11CF90186004384FC /* Flutter */, 9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */, 97C146F01CF9000F007C117D /* Runner */,
F7C2268625DCA70C00389C82 /* GalleryUITests */,
97C146EF1CF9000F007C117D /* Products */, 97C146EF1CF9000F007C117D /* Products */,
CF3B75C9A7D2FA2A4C99F110 /* Frameworks */, CF3B75C9A7D2FA2A4C99F110 /* Frameworks */,
E54E8B7296D73DD9B2385312 /* Pods */, E54E8B7296D73DD9B2385312 /* Pods */,
...@@ -89,6 +111,7 @@ ...@@ -89,6 +111,7 @@
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
97C146EE1CF9000F007C117D /* Flutter Gallery.app */, 97C146EE1CF9000F007C117D /* Flutter Gallery.app */,
F7C2268525DCA70C00389C82 /* GalleryUITests.xctest */,
); );
name = Products; name = Products;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -135,6 +158,15 @@ ...@@ -135,6 +158,15 @@
name = Pods; name = Pods;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
F7C2268625DCA70C00389C82 /* GalleryUITests */ = {
isa = PBXGroup;
children = (
F7C2268725DCA70C00389C82 /* GalleryUITests.m */,
F7C2268925DCA70C00389C82 /* Info.plist */,
);
path = GalleryUITests;
sourceTree = "<group>";
};
/* End PBXGroup section */ /* End PBXGroup section */
/* Begin PBXNativeTarget section */ /* Begin PBXNativeTarget section */
...@@ -159,6 +191,24 @@ ...@@ -159,6 +191,24 @@
productReference = 97C146EE1CF9000F007C117D /* Flutter Gallery.app */; productReference = 97C146EE1CF9000F007C117D /* Flutter Gallery.app */;
productType = "com.apple.product-type.application"; 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 */ /* End PBXNativeTarget section */
/* Begin PBXProject section */ /* Begin PBXProject section */
...@@ -171,6 +221,11 @@ ...@@ -171,6 +221,11 @@
97C146ED1CF9000F007C117D = { 97C146ED1CF9000F007C117D = {
CreatedOnToolsVersion = 7.3.1; CreatedOnToolsVersion = 7.3.1;
}; };
F7C2268425DCA70C00389C82 = {
CreatedOnToolsVersion = 12.4;
ProvisioningStyle = Automatic;
TestTargetID = 97C146ED1CF9000F007C117D;
};
}; };
}; };
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
...@@ -187,6 +242,7 @@ ...@@ -187,6 +242,7 @@
projectRoot = ""; projectRoot = "";
targets = ( targets = (
97C146ED1CF9000F007C117D /* Runner */, 97C146ED1CF9000F007C117D /* Runner */,
F7C2268425DCA70C00389C82 /* GalleryUITests */,
); );
}; };
/* End PBXProject section */ /* End PBXProject section */
...@@ -203,6 +259,13 @@ ...@@ -203,6 +259,13 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
F7C2268325DCA70C00389C82 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */ /* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */
...@@ -265,8 +328,24 @@ ...@@ -265,8 +328,24 @@
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
F7C2268125DCA70C00389C82 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
F7C2268825DCA70C00389C82 /* GalleryUITests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */ /* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
F7C2268B25DCA70C00389C82 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 97C146ED1CF9000F007C117D /* Runner */;
targetProxy = F7C2268A25DCA70C00389C82 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin PBXVariantGroup section */ /* Begin PBXVariantGroup section */
97C146FA1CF9000F007C117D /* Main.storyboard */ = { 97C146FA1CF9000F007C117D /* Main.storyboard */ = {
isa = PBXVariantGroup; isa = PBXVariantGroup;
...@@ -479,6 +558,45 @@ ...@@ -479,6 +558,45 @@
}; };
name = Release; name = Release;
}; };
F7C2268C25DCA70C00389C82 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
INFOPLIST_FILE = GalleryUITests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.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 = 9.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 = 9.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 */ /* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */ /* Begin XCConfigurationList section */
...@@ -502,6 +620,16 @@ ...@@ -502,6 +620,16 @@
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release; 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 */ /* End XCConfigurationList section */
}; };
rootObject = 97C146E61CF9000F007C117D /* Project object */; rootObject = 97C146E61CF9000F007C117D /* Project object */;
......
...@@ -24,8 +24,8 @@ ...@@ -24,8 +24,8 @@
</BuildAction> </BuildAction>
<TestAction <TestAction
buildConfiguration = "Debug" buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedDebuggerIdentifier = ""
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
shouldUseLaunchSchemeArgsEnv = "YES"> shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion> <MacroExpansion>
<BuildableReference <BuildableReference
...@@ -37,6 +37,16 @@ ...@@ -37,6 +37,16 @@
</BuildableReference> </BuildableReference>
</MacroExpansion> </MacroExpansion>
<Testables> <Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F7C2268425DCA70C00389C82"
BuildableName = "GalleryUITests.xctest"
BlueprintName = "GalleryUITests"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables> </Testables>
</TestAction> </TestAction>
<LaunchAction <LaunchAction
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment