From 0a668b980451a2990eed00516efb4edad79bc155 Mon Sep 17 00:00:00 2001 From: Romain Rastel Date: Fri, 22 Jan 2021 02:26:07 +0100 Subject: [PATCH] Add details to the iOS part integration_test (#74428) --- packages/integration_test/README.md | 34 ++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/packages/integration_test/README.md b/packages/integration_test/README.md index 875edc5800c..fd18b3d8330 100644 --- a/packages/integration_test/README.md +++ b/packages/integration_test/README.md @@ -182,8 +182,10 @@ devices you want to test on. See Open `ios/Runner.xcworkspace` in Xcode. Create a test target if you do not already have one via `File > New > Target...` and select `Unit Testing Bundle`. -Change the `Product Name` to `RunnerTests`. Make sure `Target to be Tested` is set to `Runner`. +Change the `Product Name` to `RunnerTests`. Make sure `Target to be Tested` is set to `Runner` and language is set to `Objective-C`. Select `Finish`. +Under **Runner** > **Info** > **Configurations** section, make sure, that `Runner` and `RunnerTests` have the same value under each configuration. +Make sure that the **iOS Deployment Target** of `RunnerTests` within the **Build Settings** section is the same as `Runner`. Add the new test target to `ios/Podfile` by embedding in the existing `Runner` target. @@ -217,3 +219,33 @@ To build `integration_test/foo_test.dart` from the command line, run: # Pass --simulator if building for the simulator. flutter build ios integration_test/foo_test.dart ``` + +To deploy it to Firebase Test Lab you can follow these steps: + +Execute this script at the root of your Flutter app: + +```sh +output="../build/ios_integ" +product="$output/Build/Products" +dev_target="14.3" + +# Pass --simulator if building for the simulator. +flutter build ios integration_test/foo_test.dart -release + +pushd ios +xcodebuild -workspace Runner.xcworkspace -scheme Runner -config Flutter/Release.xcconfig -derivedDataPath $output -sdk iphoneos build-for-testing +zip -r "$output/ios_tests.zip" "$product/Release-iphoneos" "$product/Runner_iphoneos$dev_target-arm64.xctestrun" +popd +``` + +You can verify locally that your tests are succesful by running the following command: + +```sh +xcodebuild test-without-building -xctestrun "build/ios_integ/Build/Products/Runner_iphoneos14.3-arm64.xctestrun" -destination id= +``` + +Once everything is ok, you can upload the resulting zip to Firebase Test Lab (change the model with your values): + +```sh +gcloud firebase test ios run --test "build/ios_integ/ios_tests.zip" --device model=iphone11pro,version=14.1,locale=fr_FR,orientation=portrait +```