Skip to content

Commit 9f5467a

Browse files
committed
test(ios): separate simulator boot from detox run
perhaps we can isolate and handle Simulator boot issues
1 parent ad33f12 commit 9f5467a

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
# Any command here that exits non-zero is an error
4+
set -e
5+
6+
# Get our simulator name from our test Detox config
7+
pushd "$(dirname "$0")/../../../tests" || exit 1
8+
SIM="$(cat .detoxrc.js | grep iPhone | cut -d"'" -f2)"
9+
echo "Attempting to boot iOS Simulator $SIM..."
10+
11+
# Boot the simulator if not booted, make sure it is in the foreground
12+
(xcrun simctl boot "$SIM" || true) && open -a Simulator.app
13+
14+
# Is it booted?
15+
xcrun simctl list |grep -i 'iPhone 16 ('|grep -v 'Phone:'|grep -v 'unavailable'|grep -v CoreSimulator|grep Booted
16+
17+
# Are we a Debug or Release build?
18+
BUILDDIR="$(ls -1 ios/build/Build/Products/)"
19+
20+
# Install our app (glob so Release or Debug works)
21+
xcrun simctl install 'iPhone 16' "ios/build/Build/Products/$BUILDDIR/testing.app"

.github/workflows/tests_e2e_ios.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_dispatch:
55
inputs:
66
iterations:
7-
description: "Number of iterations to run. Default 1. Max 122."
7+
description: 'Number of iterations to run. Default 1. Max 122.'
88
required: true
99
default: 1
1010
type: number
@@ -282,6 +282,11 @@ jobs:
282282
continue-on-error: true
283283
run: nohup sh -c "sleep 110 && xcrun simctl spawn booted log stream --level debug --style compact > simulator.log 2>&1 &"
284284

285+
- name: Pre-Boot Simulator
286+
# The goal here is to separate Simulator boot from Detox run,
287+
# So that Simulator boot issues we seem to have may be handled separately
288+
run: ./.github/workflows/scripts/boot-simulator.sh
289+
285290
- name: Detox Test
286291
if: contains(matrix.buildmode, 'debug')
287292
timeout-minutes: 50

0 commit comments

Comments
 (0)