Skip to content

Commit 46d85f8

Browse files
committed
Avoid using iOS 26.0 in workflow
1 parent 3ca419f commit 46d85f8

File tree

1 file changed

+52
-5
lines changed

1 file changed

+52
-5
lines changed

maestro/helpers/prepare_ios.sh

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,72 @@
11
#!/bin/bash
22

3+
# Configuration - modify these values as needed
4+
DEVICE_TYPE="iPhone 16"
5+
IOS_VERSION="18.5"
6+
37
start_simulator() {
48
echo "Starting iOS Simulator..."
5-
xcrun simctl boot "iPhone 16" || echo "Simulator already booted"
9+
echo "Looking for: $DEVICE_TYPE with iOS $IOS_VERSION"
10+
11+
# List available simulators to debug
12+
echo "Available simulators:"
13+
xcrun simctl list devices available
14+
15+
# Try to find the specified device with the specified iOS version
16+
DEVICE_ID=$(xcrun simctl list devices available | grep -A1 "iOS $IOS_VERSION" | grep "$DEVICE_TYPE " | head -1 | grep -o "[A-F0-9-]{36}")
17+
18+
if [ -z "$DEVICE_ID" ]; then
19+
echo "No $DEVICE_TYPE with iOS $IOS_VERSION found. Trying to create one..."
20+
# Try to create the device with the specified iOS version
21+
IOS_RUNTIME="com.apple.CoreSimulator.SimRuntime.iOS-${IOS_VERSION//./-}"
22+
DEVICE_TYPE_ID="com.apple.CoreSimulator.SimDeviceType.${DEVICE_TYPE// /-}"
23+
DEVICE_ID=$(xcrun simctl create "${DEVICE_TYPE} Test" "$DEVICE_TYPE_ID" "$IOS_RUNTIME" 2>/dev/null)
24+
25+
if [ -z "$DEVICE_ID" ]; then
26+
echo "Failed to create $DEVICE_TYPE with iOS $IOS_VERSION. Using any available $DEVICE_TYPE."
27+
DEVICE_ID=$(xcrun simctl list devices available | grep "$DEVICE_TYPE " | head -1 | grep -o "[A-F0-9-]{36}")
28+
fi
29+
fi
30+
31+
if [ -z "$DEVICE_ID" ]; then
32+
echo "Error: Could not find or create any $DEVICE_TYPE device"
33+
exit 1
34+
fi
35+
36+
echo "Using device ID: $DEVICE_ID"
37+
export SIMULATOR_DEVICE_ID="$DEVICE_ID"
38+
39+
# Boot the device
40+
xcrun simctl boot "$DEVICE_ID" || echo "Simulator already booted"
641
sleep 30
7-
xcrun simctl bootstatus || echo "Simulator booted successfully"
42+
xcrun simctl bootstatus "$DEVICE_ID" || echo "Simulator booted successfully"
843
}
944

1045
set_status_bar() {
1146
echo "Setting status bar on iOS Simulator..."
12-
xcrun simctl status_bar "iPhone 16" override --time "11:01" --wifiBars 3 --cellularBars 4 --batteryState charged --batteryLevel 100
47+
if [ -z "$SIMULATOR_DEVICE_ID" ]; then
48+
echo "Error: SIMULATOR_DEVICE_ID not set"
49+
return 1
50+
fi
51+
xcrun simctl status_bar "$SIMULATOR_DEVICE_ID" override --time "11:01" --wifiBars 3 --cellularBars 4 --batteryState charged --batteryLevel 100
1352
}
1453

1554
install_ios_app() {
1655
echo "Installing iOS app on simulator..."
17-
xcrun simctl install booted ios-app/Debug-iphonesimulator/NativeTemplate.app
56+
if [ -z "$SIMULATOR_DEVICE_ID" ]; then
57+
echo "Error: SIMULATOR_DEVICE_ID not set"
58+
return 1
59+
fi
60+
xcrun simctl install "$SIMULATOR_DEVICE_ID" ios-app/Debug-iphonesimulator/NativeTemplate.app
1861
}
1962

2063
verify_installed_app() {
2164
echo "Verifying installed app..."
22-
xcrun simctl get_app_container booted com.mendix.native.template
65+
if [ -z "$SIMULATOR_DEVICE_ID" ]; then
66+
echo "Error: SIMULATOR_DEVICE_ID not set"
67+
return 1
68+
fi
69+
xcrun simctl get_app_container "$SIMULATOR_DEVICE_ID" com.mendix.native.template
2370
}
2471

2572
start_simulator

0 commit comments

Comments
 (0)