Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

[image_picker] Set up XCUITests #3254

Merged
merged 7 commits into from
Nov 9, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ task:
- name: build-ipas+drive-examples
env:
PATH: $PATH:/usr/local/bin
PLUGINS_TO_SKIP_XCTESTS: "battery/battery,camera,connectivity/connectivity,device_info/device_info,espresso,google_maps_flutter/google_maps_flutter,google_sign_in/google_sign_in,image_picker/image_picker,in_app_purchase,integration_test,ios_platform_images,local_auth,package_info,path_provider/path_provider,quick_actions,sensors,shared_preferences/shared_preferences,url_launcher/url_launcher,video_player/video_player,webview_flutter,wifi_info_flutter/wifi_info_flutter"
PLUGINS_TO_SKIP_XCTESTS: "battery/battery,camera,connectivity/connectivity,device_info/device_info,espresso,google_maps_flutter/google_maps_flutter,google_sign_in/google_sign_in,in_app_purchase,integration_test,ios_platform_images,local_auth,package_info,path_provider/path_provider,quick_actions,sensors,shared_preferences/shared_preferences,url_launcher/url_launcher,video_player/video_player,webview_flutter,wifi_info_flutter/wifi_info_flutter"
matrix:
PLUGIN_SHARDING: "--shardIndex 0 --shardCount 4"
PLUGIN_SHARDING: "--shardIndex 1 --shardCount 4"
Expand Down
4 changes: 4 additions & 0 deletions packages/image_picker/image_picker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.6.7+14

* Set up XCUITests.

## 0.6.7+13

* Update documentation of `getImage()` about HEIC images.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
680049272280D79A006DD6AB /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
680049382280F2B9006DD6AB /* pngImage.png in Resources */ = {isa = PBXBuildFile; fileRef = 680049352280F2B8006DD6AB /* pngImage.png */; };
680049392280F2B9006DD6AB /* jpgImage.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 680049362280F2B8006DD6AB /* jpgImage.jpg */; };
6801C8392555D726009DAF8D /* ImagePickerFromGalleryUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 6801C8382555D726009DAF8D /* ImagePickerFromGalleryUITests.m */; };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amirh This is the new test file that Chris added. If Xcode doesn't know about it, then xcodebuild test won't run it.

6801C8422555E0A7009DAF8D /* RunnerUITestUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 6801C8412555E0A7009DAF8D /* RunnerUITestUtils.m */; };
68B9AF72243E4B3F00927CE4 /* ImagePickerPluginTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 68B9AF71243E4B3F00927CE4 /* ImagePickerPluginTests.m */; };
68F4B464228B3AB500C25614 /* PhotoAssetUtilTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 68F4B463228B3AB500C25614 /* PhotoAssetUtilTests.m */; };
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
Expand All @@ -34,6 +36,13 @@
remoteGlobalIDString = 97C146ED1CF9000F007C117D;
remoteInfo = Runner;
};
6801C83B2555D726009DAF8D /* PBXContainerItemProxy */ = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the new test target. This grouping tells Xcode what kind of tests they are (UI tests in this case) so it knows how to run them.

isa = PBXContainerItemProxy;
containerPortal = 97C146E61CF9000F007C117D /* Project object */;
proxyType = 1;
remoteGlobalIDString = 97C146ED1CF9000F007C117D;
remoteInfo = Runner;
};
/* End PBXContainerItemProxy section */

/* Begin PBXCopyFilesBuildPhase section */
Expand All @@ -60,6 +69,11 @@
680049352280F2B8006DD6AB /* pngImage.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = pngImage.png; sourceTree = "<group>"; };
680049362280F2B8006DD6AB /* jpgImage.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = jpgImage.jpg; sourceTree = "<group>"; };
6801632E632668F4349764C9 /* 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>"; };
6801C8362555D726009DAF8D /* RunnerUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the location the test xctest product bundle will be built, so the binaries where the tests are compiled into.

6801C8382555D726009DAF8D /* ImagePickerFromGalleryUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ImagePickerFromGalleryUITests.m; sourceTree = "<group>"; };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the new test file that was explicitly added.

6801C83A2555D726009DAF8D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the Info.plist file that was also explicitly added. It contains metadata about the bundle, and is required for most bundle types (apps, frameworks, extensions etc)

6801C8402555E0A7009DAF8D /* RunnerUITestUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RunnerUITestUtils.h; sourceTree = "<group>"; };
6801C8412555E0A7009DAF8D /* RunnerUITestUtils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RunnerUITestUtils.m; sourceTree = "<group>"; };
68B9AF71243E4B3F00927CE4 /* ImagePickerPluginTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ImagePickerPluginTests.m; path = ../../../ios/Tests/ImagePickerPluginTests.m; sourceTree = "<group>"; };
68F4B463228B3AB500C25614 /* PhotoAssetUtilTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = PhotoAssetUtilTests.m; path = ../../../ios/Tests/PhotoAssetUtilTests.m; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
Expand Down Expand Up @@ -88,6 +102,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
6801C8332555D726009DAF8D /* Frameworks */ = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the default Frameworks build phase that Xcode adds for every new target. This one is empty, so it could be deleted, but most people keep the default ones.

isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
97C146EB1CF9000F007C117D /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -123,6 +144,17 @@
path = TestImages;
sourceTree = "<group>";
};
6801C8372555D726009DAF8D /* RunnerUITests */ = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is describing the files that are in the RunnerUITests group in Xcode, so the files/folders explorer thing on the left side.

isa = PBXGroup;
children = (
6801C8382555D726009DAF8D /* ImagePickerFromGalleryUITests.m */,
6801C83A2555D726009DAF8D /* Info.plist */,
6801C8402555E0A7009DAF8D /* RunnerUITestUtils.h */,
6801C8412555E0A7009DAF8D /* RunnerUITestUtils.m */,
);
path = RunnerUITests;
sourceTree = "<group>";
};
840012C8B5EDBCF56B0E4AC1 /* Pods */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -150,6 +182,7 @@
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
680049182280D368006DD6AB /* image_picker_exampleTests */,
6801C8372555D726009DAF8D /* RunnerUITests */,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a group, the thing that looks like a folder in the explorer on the left side.

97C146EF1CF9000F007C117D /* Products */,
840012C8B5EDBCF56B0E4AC1 /* Pods */,
CF3B75C9A7D2FA2A4C99F110 /* Frameworks */,
Expand All @@ -161,6 +194,7 @@
children = (
97C146EE1CF9000F007C117D /* Runner.app */,
680049172280D368006DD6AB /* image_picker_exampleTests.xctest */,
6801C8362555D726009DAF8D /* RunnerUITests.xctest */,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is that xctest bundle mentioned above, but shown in that same file explorer.

);
name = Products;
sourceTree = "<group>";
Expand Down Expand Up @@ -218,6 +252,24 @@
productReference = 680049172280D368006DD6AB /* image_picker_exampleTests.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
6801C8352555D726009DAF8D /* RunnerUITests */ = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the new test target. It lists which build phases (which sources to compile, frameworks to embed, resource embedding) are associated with the test target.

isa = PBXNativeTarget;
buildConfigurationList = 6801C83F2555D726009DAF8D /* Build configuration list for PBXNativeTarget "RunnerUITests" */;
buildPhases = (
6801C8322555D726009DAF8D /* Sources */,
6801C8332555D726009DAF8D /* Frameworks */,
6801C8342555D726009DAF8D /* Resources */,
);
buildRules = (
);
dependencies = (
6801C83C2555D726009DAF8D /* PBXTargetDependency */,
);
name = RunnerUITests;
productName = RunnerUITests;
productReference = 6801C8362555D726009DAF8D /* RunnerUITests.xctest */;
productType = "com.apple.product-type.bundle.ui-testing";
};
97C146ED1CF9000F007C117D /* Runner */ = {
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
Expand Down Expand Up @@ -255,6 +307,11 @@
ProvisioningStyle = Automatic;
TestTargetID = 97C146ED1CF9000F007C117D;
};
6801C8352555D726009DAF8D = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is metadata about the test target, so which version of Xcode was used to create it, and how how the product should be signed.

CreatedOnToolsVersion = 11.7;
ProvisioningStyle = Automatic;
TestTargetID = 97C146ED1CF9000F007C117D;
};
97C146ED1CF9000F007C117D = {
CreatedOnToolsVersion = 7.3.1;
SystemCapabilities = {
Expand All @@ -280,6 +337,7 @@
targets = (
97C146ED1CF9000F007C117D /* Runner */,
680049162280D368006DD6AB /* image_picker_exampleTests */,
6801C8352555D726009DAF8D /* RunnerUITests */,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the target referenced in the project settings.

);
};
/* End PBXProject section */
Expand All @@ -296,6 +354,13 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
6801C8342555D726009DAF8D /* Resources */ = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the default Resources build phase that Xcode adds for every new target, like the Frameworks one above. This one is also empty, so it could be deleted, but most people keep the default ones.

isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
97C146EC1CF9000F007C117D /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -389,6 +454,15 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
6801C8322555D726009DAF8D /* Sources */ = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the Sources build phase that says which files should be compiled into the xctest bundle. So ImagePickerFromGalleryUITests in this case.

isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
6801C8392555D726009DAF8D /* ImagePickerFromGalleryUITests.m in Sources */,
6801C8422555E0A7009DAF8D /* RunnerUITestUtils.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
97C146EA1CF9000F007C117D /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
Expand All @@ -407,6 +481,11 @@
target = 97C146ED1CF9000F007C117D /* Runner */;
targetProxy = 6800491C2280D368006DD6AB /* PBXContainerItemProxy */;
};
6801C83C2555D726009DAF8D /* PBXTargetDependency */ = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This says that the test target depends on the Runner (app) target, so Runner needs to be built first.

isa = PBXTargetDependency;
target = 97C146ED1CF9000F007C117D /* Runner */;
targetProxy = 6801C83B2555D726009DAF8D /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */

/* Begin PBXVariantGroup section */
Expand Down Expand Up @@ -480,9 +559,55 @@
};
name = Release;
};
6801C83D2555D726009DAF8D /* Debug */ = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are the Debug build configuration build settings, and it looks like it's all the defaults Xcode uses for new targets. The CLANG_ GCC_C_ and MTL_ ones can be removed since they would be inherited from the overall project settings. But most people just let Xcode set the overrides it wants and don't touch it.

isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = "";
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = RunnerUITests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.google.RunnerUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = Runner;
};
name = Debug;
};
6801C83E2555D726009DAF8D /* Release */ = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto but for the Release build configuration build settings.

isa = XCBuildConfiguration;
buildSettings = {
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
CLANG_ENABLE_OBJC_WEAK = YES;
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = "";
GCC_C_LANGUAGE_STANDARD = gnu11;
INFOPLIST_FILE = RunnerUITests/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.google.RunnerUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
TEST_TARGET_NAME = Runner;
};
name = Release;
};
97C147031CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
Expand Down Expand Up @@ -539,7 +664,6 @@
};
97C147041CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
Expand Down Expand Up @@ -644,6 +768,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
6801C83F2555D726009DAF8D /* Build configuration list for PBXNativeTarget "RunnerUITests" */ = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This the hook for setting build configuration settings for the new test target (like a base xcconfig file)

isa = XCConfigurationList;
buildConfigurations = (
6801C83D2555D726009DAF8D /* Debug */,
6801C83E2555D726009DAF8D /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
Expand Down
Loading