Skip to content

Commit 60b1944

Browse files
authored
Fix: detox e2e tests (#14607)
2 parents faa49ef + efcab1a commit 60b1944

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

.github/workflows/callable-e2e-test-detox.yml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,30 @@ jobs:
4444
cd ios && pod install
4545
working-directory: ${{ inputs.working_directory }}
4646
shell: bash
47-
- name: Start iOS simulator (background)
47+
- name: Setup iOS Simulator
4848
run: |
49-
xcrun simctl boot "iPhone 15" &
49+
# Check if iPhone 15 device exists
50+
if ! xcrun simctl list devices | grep -q "iPhone 15"; then
51+
echo "iPhone 15 device not found, creating one..."
52+
53+
# Get the latest available iOS runtime
54+
RUNTIME=$(xcrun simctl list runtimes | grep iOS | tail -1 | awk '{print $NF}')
55+
echo "Using runtime: $RUNTIME"
56+
57+
# Create iPhone 15 device with available runtime
58+
xcrun simctl create "iPhone 15" "com.apple.CoreSimulator.SimDeviceType.iPhone-15" "$RUNTIME" || \
59+
xcrun simctl create "iPhone 15" "iPhone 15" "$RUNTIME" || \
60+
echo "Could not create iPhone 15, will use available device"
61+
fi
62+
63+
# Boot iPhone 15 if it exists, otherwise use first available iPhone
64+
if xcrun simctl list devices | grep -q "iPhone 15"; then
65+
xcrun simctl boot "iPhone 15" &
66+
else
67+
DEVICE=$(xcrun simctl list devices available | grep "iPhone" | head -1 | sed 's/.*\(iPhone[^(]*\).*/\1/' | xargs)
68+
echo "Using fallback device: $DEVICE"
69+
xcrun simctl boot "$DEVICE" &
70+
fi
5071
shell: bash
5172
- name: Start Metro Packager (background)
5273
run: |

0 commit comments

Comments
 (0)