Skip to content

Commit 770f9fb

Browse files
test(e2e): Add auto init from JS tests (#4588)
1 parent ae342a3 commit 770f9fb

File tree

5 files changed

+49
-18
lines changed

5 files changed

+49
-18
lines changed

.github/workflows/sample-application.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ jobs:
186186
path: ${{ env.REACT_NATIVE_SAMPLE_PATH }}/${{ matrix.platform }}/*.log
187187

188188
test:
189-
name: Test ${{ matrix.platform }} ${{ matrix.build-type }}
189+
name: ${{ matrix.job-name }}
190190
runs-on: ${{ matrix.runs-on }}
191191
needs: [diff_check, build]
192192
if: ${{ needs.diff_check.outputs.skip_ci != 'true' }}
@@ -195,16 +195,28 @@ jobs:
195195
fail-fast: false
196196
matrix:
197197
include:
198-
- platform: ios
198+
- job-name: 'Test iOS Release Auto Init'
199+
platform: ios
199200
runs-on: macos-15
200201
rn-architecture: 'new'
201202
ios-use-frameworks: 'no-frameworks'
202203
build-type: 'production'
204+
test-command: 'yarn test-ios-auto' # tests native auto init from JS
203205

204-
- platform: android
206+
- job-name: 'Test iOS Release Manual Init'
207+
platform: ios
208+
runs-on: macos-15
209+
rn-architecture: 'new'
210+
ios-use-frameworks: 'no-frameworks'
211+
build-type: 'production'
212+
test-command: 'yarn test-ios'
213+
214+
- job-name: 'Test Android Release Manual Init'
215+
platform: android
205216
runs-on: ubuntu-latest
206217
rn-architecture: 'new'
207218
build-type: 'production'
219+
test-command: 'yarn test-android'
208220

209221
steps:
210222
- uses: actions/checkout@v4
@@ -277,7 +289,7 @@ jobs:
277289
- name: Run Detox iOS Tests
278290
if: ${{ matrix.platform == 'ios' }}
279291
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
280-
run: yarn test-ios
292+
run: ${{ matrix.test-command }}
281293

282294
- name: Run tests on Android
283295
if: ${{ matrix.platform == 'android' }}
@@ -303,4 +315,4 @@ jobs:
303315
-camera-front none
304316
-timezone US/Pacific
305317
working-directory: ${{ env.REACT_NATIVE_SAMPLE_PATH }}
306-
script: yarn test-android
318+
script: ${{ matrix.test-command }}

samples/react-native/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"set-test-dsn-ios": "scripts/set-dsn-ios.mjs",
1717
"test-android": "scripts/test-android.sh",
1818
"test-ios": "scripts/test-ios.sh",
19+
"test-ios-auto": "scripts/test-ios-auto.sh",
1920
"lint": "npx eslint . --ext .js,.jsx,.ts,.tsx",
2021
"fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
2122
"pod-install-debug-static": "scripts/pod-install-debug-static.sh",
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
# Exit on error and print commands
4+
set -xe
5+
6+
if [ -z "$IOS_DEVICE" ]; then
7+
# Get the first booted simulator device type and version
8+
BOOTED_DEVICE=$(xcrun simctl list devices | grep "Booted" | head -n 1)
9+
10+
if [ -z "$BOOTED_DEVICE" ]; then
11+
echo "No booted iOS simulator found"
12+
exit 1
13+
fi
14+
15+
# Extract device type from booted device
16+
export IOS_DEVICE=$(echo "$BOOTED_DEVICE" | cut -d "(" -f1 | xargs)
17+
echo "Using booted iOS simulator: $IOS_DEVICE"
18+
fi
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
# Exit on error and print commands
4+
set -xe
5+
6+
thisFilePath=$(dirname "$0")
7+
8+
cd "${thisFilePath}/.."
9+
10+
"${thisFilePath}/detect-ios-sim.sh"
11+
12+
detox test --configuration ci.sim --app-launch-args="--sentry-disable-native-start"

samples/react-native/scripts/test-ios.sh

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,6 @@ thisFilePath=$(dirname "$0")
77

88
cd "${thisFilePath}/.."
99

10-
if [ -z "$IOS_DEVICE" ]; then
11-
# Get the first booted simulator device type and version
12-
BOOTED_DEVICE=$(xcrun simctl list devices | grep "Booted" | head -n 1)
13-
14-
if [ -z "$BOOTED_DEVICE" ]; then
15-
echo "No booted iOS simulator found"
16-
exit 1
17-
fi
18-
19-
# Extract device type from booted device
20-
export IOS_DEVICE=$(echo "$BOOTED_DEVICE" | cut -d "(" -f1 | xargs)
21-
echo "Using booted iOS simulator: $IOS_DEVICE"
22-
fi
10+
"${thisFilePath}/detect-ios-sim.sh"
2311

2412
detox test --configuration ci.sim

0 commit comments

Comments
 (0)