Skip to content

Commit 3df9647

Browse files
Add iOS E2E job and register XCUITest target in Xcode project
- Adds ReactNativeExampleUITests target to project.pbxproj via a Ruby script (example/ios/add_uitest_target.rb) that uses the xcodeproj gem. The script is idempotent and checked in so CI or other devs can regenerate if the pbxproj is reset. - Adds ios-e2e job to the workflow: runs on macos-15, installs pods, builds for testing, then runs xcodebuild test-without-building with -only-testing:ReactNativeExampleUITests on an iPhone 16 simulator. Credentials come from the same E2E_* repository secrets as Android. - Both jobs (android-e2e, ios-e2e) run in parallel on every PR. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 1336257 commit 3df9647

File tree

3 files changed

+331
-6
lines changed

3 files changed

+331
-6
lines changed

.github/workflows/react-native-sdk-e2e.yml

Lines changed: 82 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Local Android E2E tests for the React Native example app.
2-
# Mirrors frontegg-android-kotlin's demo-e2e.yml: builds the example app,
3-
# boots an emulator, runs the UiAutomator instrumentation tests, and reports
4-
# JUnit results as a PR check.
1+
# Local E2E tests for the React Native example app (Android + iOS).
2+
# Mirrors frontegg-android-kotlin's demo-e2e.yml and frontegg-ios-swift's
3+
# demo-e2e.yml: builds the example app, boots a device/simulator, runs the
4+
# instrumented tests, and reports results as PR checks.
55
#
66
# The previous cross-repo call to e2e-system-tests was never functional
77
# (0-second failure on every run since the workflow was created) due to
88
# GitHub's private-repo reusable-workflow access restrictions. This replaces
9-
# it with a self-contained local suite that actually runs.
9+
# it with self-contained local suites that actually run.
1010

1111
name: React Native SDK E2E
1212

@@ -20,6 +20,9 @@ permissions:
2020
checks: write
2121

2222
jobs:
23+
# ──────────────────────────────────────────────────────────────────────
24+
# Android — UiAutomator on an API 34 emulator
25+
# ──────────────────────────────────────────────────────────────────────
2326
android-e2e:
2427
name: Android E2E
2528
runs-on: ubuntu-latest
@@ -140,7 +143,7 @@ jobs:
140143
if: always()
141144
with:
142145
report_paths: e2e-artifacts/*.xml
143-
check_name: React Native SDK E2E
146+
check_name: Android E2E
144147

145148
- name: Upload test artifacts
146149
uses: actions/upload-artifact@v4
@@ -149,3 +152,76 @@ jobs:
149152
name: android-e2e-results
150153
path: e2e-artifacts/
151154
if-no-files-found: ignore
155+
156+
# ──────────────────────────────────────────────────────────────────────
157+
# iOS — XCUITest on an iPhone simulator (macOS runner)
158+
# Mirrors frontegg-ios-swift's demo-e2e.yml.
159+
# ──────────────────────────────────────────────────────────────────────
160+
ios-e2e:
161+
name: iOS E2E
162+
runs-on: macos-15
163+
timeout-minutes: 60
164+
env:
165+
LOGIN_EMAIL: ${{ secrets.E2E_LOGIN_EMAIL }}
166+
LOGIN_PASSWORD: ${{ secrets.E2E_LOGIN_PASSWORD }}
167+
LOGIN_WRONG_PASSWORD: ${{ secrets.E2E_LOGIN_WRONG_PASSWORD }}
168+
TENANT_NAME_1: ${{ secrets.E2E_TENANT_NAME_1 }}
169+
TENANT_NAME_2: ${{ secrets.E2E_TENANT_NAME_2 }}
170+
GOOGLE_EMAIL: ${{ secrets.E2E_GOOGLE_EMAIL }}
171+
GOOGLE_PASSWORD: ${{ secrets.E2E_GOOGLE_PASSWORD }}
172+
steps:
173+
- name: Checkout
174+
uses: actions/checkout@v4
175+
176+
- name: Set up Node.js
177+
uses: actions/setup-node@v4
178+
with:
179+
node-version: 18
180+
181+
- name: Install JS dependencies
182+
run: |
183+
yarn install --frozen-lockfile
184+
cd example && yarn install --frozen-lockfile
185+
186+
- name: Install CocoaPods dependencies
187+
working-directory: example/ios
188+
run: pod install
189+
190+
- name: Build for testing
191+
working-directory: example/ios
192+
run: |
193+
set -o pipefail
194+
xcodebuild \
195+
build-for-testing \
196+
-workspace ReactNativeExample.xcworkspace \
197+
-scheme ReactNativeExample \
198+
-destination "platform=iOS Simulator,name=iPhone 16" \
199+
-derivedDataPath "$RUNNER_TEMP/DerivedData" \
200+
CODE_SIGNING_ALLOWED=NO \
201+
2>&1 | tee "$RUNNER_TEMP/build.log"
202+
203+
- name: Run UI tests
204+
working-directory: example/ios
205+
run: |
206+
set -o pipefail
207+
xcodebuild \
208+
test-without-building \
209+
-workspace ReactNativeExample.xcworkspace \
210+
-scheme ReactNativeExample \
211+
-only-testing:ReactNativeExampleUITests \
212+
-destination "platform=iOS Simulator,name=iPhone 16" \
213+
-derivedDataPath "$RUNNER_TEMP/DerivedData" \
214+
-resultBundlePath "$RUNNER_TEMP/ios-e2e.xcresult" \
215+
-parallel-testing-enabled NO \
216+
2>&1 | tee "$RUNNER_TEMP/test.log"
217+
218+
- name: Upload test artifacts
219+
uses: actions/upload-artifact@v4
220+
if: always()
221+
with:
222+
name: ios-e2e-results
223+
path: |
224+
${{ runner.temp }}/build.log
225+
${{ runner.temp }}/test.log
226+
${{ runner.temp }}/ios-e2e.xcresult
227+
if-no-files-found: ignore

0 commit comments

Comments
 (0)