Skip to content

Commit 0a16b53

Browse files
hramosfacebook-github-bot
authored andcommitted
Use Xcode 10.2.0 and iOS 12.2 in iOS tests (#24572)
Summary: Pull Request resolved: #24572 Bumps to Xcode 10.2.0 and uses the iOS 12.2 simulator when running tests. Changelog: [iOS] [Changed] - iOS tests: Bump Xcode to 10.2.0, iOS to 12.2. Reviewed By: cpojer Differential Revision: D15049833 fbshipit-source-id: 40ee039f8be4db1365ad650b45e2e3e0a4ea80f3
1 parent f1086b8 commit 0a16b53

File tree

3 files changed

+99
-6
lines changed

3 files changed

+99
-6
lines changed

.circleci/config.yml

+97-4
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ android_defaults: &android_defaults
170170
macos_defaults: &macos_defaults
171171
<<: *defaults
172172
macos:
173-
xcode: "10.1.0"
173+
xcode: "10.2.0"
174174

175175
# -------------------------
176176
# JOBS
@@ -340,12 +340,22 @@ jobs:
340340
# Runs unit tests on iOS devices
341341
test_ios:
342342
<<: *macos_defaults
343+
environment:
344+
- REPORTS_DIR: "./reports"
343345
steps:
344346
- attach_workspace:
345347
at: ~/react-native
346348

347349
- run:
348-
name: Boot iPhone Simulator
350+
name: Print Xcode environment
351+
command: xcodebuild -version
352+
353+
- run:
354+
name: List available devices
355+
command: instruments -s devices
356+
357+
- run:
358+
name: Boot iOS Simulator
349359
command: source scripts/.tests.env && xcrun simctl boot "$IOS_DEVICE" || true
350360

351361
- restore-cache: *restore-brew-cache
@@ -357,8 +367,91 @@ jobs:
357367
- save-cache: *save-brew-cache
358368

359369
- run:
360-
name: iOS Test Suite
361-
command: ./scripts/objc-test-ios.sh test
370+
name: Start Metro packager
371+
command: yarn start --nonPersistent --max-workers=1 || echo "Can't start packager automatically"
372+
background: true
373+
374+
- run:
375+
name: Start WebSocket test server
376+
command: open "./IntegrationTests/launchWebSocketServer.command" || echo "Can't start web socket server automatically"
377+
background: true
378+
379+
- run:
380+
name: Verify RNTester can be built
381+
command: |
382+
source ./scripts/.tests.env
383+
xcodebuild \
384+
-project RNTester/RNTester.xcodeproj \
385+
-scheme RNTester \
386+
-sdk iphonesimulator \
387+
-destination "platform=iOS Simulator,name=$IOS_DEVICE,OS=$IOS_TARGET_OS" \
388+
-UseModernBuildSystem=NO \
389+
build | \
390+
xcpretty --report junit --output "$REPORTS_DIR/junit/ios_buiild/results.xml" && \
391+
exit "${PIPESTATUS[0]}"
392+
393+
- run:
394+
name: Wait for Metro packager
395+
command: |
396+
max_attempts=60
397+
attempt_num=1
398+
until curl -s http://localhost:8081/status | grep "packager-status:running" -q; do
399+
if (( attempt_num == max_attempts )); then
400+
echo "Packager did not respond in time. No more attempts left."
401+
exit 1
402+
else
403+
(( attempt_num++ ))
404+
echo "Packager did not respond. Retrying for attempt number $attempt_num..."
405+
sleep 1
406+
fi
407+
done
408+
echo "Packager is ready!"
409+
410+
- run:
411+
name: Preload the RNTesterApp bundles
412+
command: |
413+
curl --silent 'http://localhost:8081/RNTester/js/RNTesterApp.ios.bundle?platform=ios&dev=true' --output /dev/null
414+
curl --silent 'http://localhost:8081/RNTester/js/RNTesterApp.ios.bundle?platform=ios&dev=true&minify=false' --output /dev/null
415+
curl --silent 'http://localhost:8081/IntegrationTests/IntegrationTestsApp.bundle?platform=ios&dev=true' --output /dev/null
416+
curl --silent 'http://localhost:8081/IntegrationTests/RCTRootViewIntegrationTestApp.bundle?platform=ios&dev=true' --output /dev/null
417+
418+
- run:
419+
name: Run RNTester Unit Tests
420+
command: |
421+
source ./scripts/.tests.env
422+
xcodebuild \
423+
-project RNTester/RNTester.xcodeproj \
424+
-scheme RNTester \
425+
-sdk iphonesimulator \
426+
-destination "platform=iOS Simulator,name=$IOS_DEVICE,OS=$IOS_TARGET_OS" \
427+
-UseModernBuildSystem=NO \
428+
-only-testing:RNTesterUnitTests \
429+
build test | \
430+
xcpretty --report junit --output "$REPORTS_DIR/junit/ios_unit_tests/results.xml" && \
431+
exit "${PIPESTATUS[0]}"
432+
433+
- run:
434+
name: Run RNTester Integration Tests
435+
command: |
436+
source ./scripts/.tests.env
437+
xcodebuild \
438+
-project RNTester/RNTester.xcodeproj \
439+
-scheme RNTester \
440+
-sdk iphonesimulator \
441+
-destination "platform=iOS Simulator,name=$IOS_DEVICE,OS=$IOS_TARGET_OS" \
442+
-UseModernBuildSystem=NO \
443+
-only-testing:RNTesterIntegrationTests \
444+
build test | \
445+
xcpretty --report junit --output "$REPORTS_DIR/junit/ios_integration_tests/results.xml" && \
446+
exit "${PIPESTATUS[0]}"
447+
448+
- run:
449+
name: Stop Metro packager and WebSocket test server
450+
command: |
451+
# kill whatever is occupying port 8081 (packager)
452+
lsof -i tcp:8081 | awk 'NR!=1 {print $2}' | xargs kill
453+
# kill whatever is occupying port 5555 (web socket server)
454+
lsof -i tcp:5555 | awk 'NR!=1 {print $2}' | xargs kill
362455
363456
- run:
364457
name: iOS End-to-End Test Suite

scripts/.tests.env

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export AVD_NAME="testAVD"
1717
export AVD_ABI=x86
1818

1919
## IOS ##
20-
export IOS_TARGET_OS="12.1"
20+
export IOS_TARGET_OS="12.2"
2121
export IOS_DEVICE="iPhone 6s"
2222
export TVOS_DEVICE="Apple TV"
2323

scripts/run-ci-e2e-tests.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ try {
220220
if (
221221
tryExecNTimes(
222222
() => {
223-
let destination = 'platform=iOS Simulator,name=iPhone 6s,OS=12.1';
223+
let destination = 'platform=iOS Simulator,name=iPhone 6s,OS=12.2';
224224
let sdk = 'iphonesimulator';
225225
let scheme = 'EndToEndTest';
226226

0 commit comments

Comments
 (0)