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

Delete and create iOS simulator before running Scenario app test #50835

Merged
Changes from all 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
25 changes: 23 additions & 2 deletions testing/scenario_app/run_ios_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,34 @@ zip_and_upload_xcresult_to_luci () {
exit 1
}

readonly DEVICE_NAME="iPhone SE (3rd generation)"
readonly DEVICE=com.apple.CoreSimulator.SimDeviceType.iPhone-SE-3rd-generation
readonly OS_RUNTIME=com.apple.CoreSimulator.SimRuntime.iOS-17-0
readonly OS="17.0"

# Delete any existing devices named "iPhone SE (3rd generation)". Having more
# than one may cause issues when builds target the device.
echo "Deleting any existing devices names $DEVICE_NAME..."
RESULT=0
while [[ $RESULT == 0 ]]; do
xcrun simctl delete "$DEVICE_NAME" || RESULT=1
if [ $RESULT == 0 ]; then
echo "Deleted $DEVICE_NAME"
fi
done
echo ""

echo "Creating $DEVICE_NAME $DEVICE $OS_RUNTIME ..."
xcrun simctl create "$DEVICE_NAME" "$DEVICE" "$OS_RUNTIME"
echo ""

echo "Running simulator tests with Skia"
echo ""

if set -o pipefail && xcodebuild -sdk iphonesimulator \
-scheme Scenarios \
-resultBundlePath "$RESULT_BUNDLE_PATH/ios_scenario.xcresult" \
-destination 'platform=iOS Simulator,OS=17.0,name=iPhone SE (3rd generation)' \
-destination "platform=iOS Simulator,OS=$OS,name=$DEVICE_NAME" \
clean test \
FLUTTER_ENGINE="$FLUTTER_ENGINE"; then
echo "test success."
Expand All @@ -82,7 +103,7 @@ echo ""
if set -o pipefail && xcodebuild -sdk iphonesimulator \
-scheme Scenarios \
-resultBundlePath "$RESULT_BUNDLE_PATH/ios_scenario.xcresult" \
-destination 'platform=iOS Simulator,OS=17.0,name=iPhone SE (3rd generation)' \
-destination "platform=iOS Simulator,OS=$OS,name=$DEVICE_NAME" \
clean test \
FLUTTER_ENGINE="$FLUTTER_ENGINE" \
-skip-testing ScenariosUITests/MultiplePlatformViewsBackgroundForegroundTest/testPlatformView \
Expand Down