mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-03-06 22:37:14 +08:00
Use Xcode 10.2.0 and iOS 12.2 in iOS tests
Summary: Bumps to Xcode 10.2.0 and uses the iOS 12.2 simulator when running tests. The `testBundleURL` test is temporarily disabled to allow the iOS unit tests to run successfully in the internal Facebook CI system. Changelog: [iOS] [Changed] - iOS tests: Bump Xcode to 10.2.0, iOS to 12.2. Reviewed By: TheSavior Differential Revision: D14962710 fbshipit-source-id: 769cfb90aacce33903ab6e8dbcc5b5727deacf41
This commit is contained in:
committed by
Facebook Github Bot
parent
ebed815fb5
commit
e106112202
@@ -170,7 +170,7 @@ android_defaults: &android_defaults
|
||||
macos_defaults: &macos_defaults
|
||||
<<: *defaults
|
||||
macos:
|
||||
xcode: "10.1.0"
|
||||
xcode: "10.2.0"
|
||||
|
||||
# -------------------------
|
||||
# JOBS
|
||||
@@ -340,12 +340,22 @@ jobs:
|
||||
# Runs unit tests on iOS devices
|
||||
test_ios:
|
||||
<<: *macos_defaults
|
||||
environment:
|
||||
- REPORTS_DIR: "./reports"
|
||||
steps:
|
||||
- attach_workspace:
|
||||
at: ~/react-native
|
||||
|
||||
- run:
|
||||
name: Boot iPhone Simulator
|
||||
name: Print Xcode environment
|
||||
command: xcodebuild -version
|
||||
|
||||
- run:
|
||||
name: List available devices
|
||||
command: instruments -s devices
|
||||
|
||||
- run:
|
||||
name: Boot iOS Simulator
|
||||
command: source scripts/.tests.env && xcrun simctl boot "$IOS_DEVICE" || true
|
||||
|
||||
- restore-cache: *restore-brew-cache
|
||||
@@ -357,8 +367,91 @@ jobs:
|
||||
- save-cache: *save-brew-cache
|
||||
|
||||
- run:
|
||||
name: iOS Test Suite
|
||||
command: ./scripts/objc-test-ios.sh test
|
||||
name: Start Metro packager
|
||||
command: yarn start --nonPersistent --max-workers=1 || echo "Can't start packager automatically"
|
||||
background: true
|
||||
|
||||
- run:
|
||||
name: Start WebSocket test server
|
||||
command: open "./IntegrationTests/launchWebSocketServer.command" || echo "Can't start web socket server automatically"
|
||||
background: true
|
||||
|
||||
- run:
|
||||
name: Verify RNTester can be built
|
||||
command: |
|
||||
source ./scripts/.tests.env
|
||||
xcodebuild \
|
||||
-project RNTester/RNTester.xcodeproj \
|
||||
-scheme RNTester \
|
||||
-sdk iphonesimulator \
|
||||
-destination "platform=iOS Simulator,name=$IOS_DEVICE,OS=$IOS_TARGET_OS" \
|
||||
-UseModernBuildSystem=NO \
|
||||
build | \
|
||||
xcpretty --report junit --output "$REPORTS_DIR/junit/ios_buiild/results.xml" && \
|
||||
exit "${PIPESTATUS[0]}"
|
||||
|
||||
- run:
|
||||
name: Wait for Metro packager
|
||||
command: |
|
||||
max_attempts=60
|
||||
attempt_num=1
|
||||
until curl -s http://localhost:8081/status | grep "packager-status:running" -q; do
|
||||
if (( attempt_num == max_attempts )); then
|
||||
echo "Packager did not respond in time. No more attempts left."
|
||||
exit 1
|
||||
else
|
||||
(( attempt_num++ ))
|
||||
echo "Packager did not respond. Retrying for attempt number $attempt_num..."
|
||||
sleep 1
|
||||
fi
|
||||
done
|
||||
echo "Packager is ready!"
|
||||
|
||||
- run:
|
||||
name: Preload the RNTesterApp bundles
|
||||
command: |
|
||||
curl --silent 'http://localhost:8081/RNTester/js/RNTesterApp.ios.bundle?platform=ios&dev=true' --output /dev/null
|
||||
curl --silent 'http://localhost:8081/RNTester/js/RNTesterApp.ios.bundle?platform=ios&dev=true&minify=false' --output /dev/null
|
||||
curl --silent 'http://localhost:8081/IntegrationTests/IntegrationTestsApp.bundle?platform=ios&dev=true' --output /dev/null
|
||||
curl --silent 'http://localhost:8081/IntegrationTests/RCTRootViewIntegrationTestApp.bundle?platform=ios&dev=true' --output /dev/null
|
||||
|
||||
- run:
|
||||
name: Run RNTester Unit Tests
|
||||
command: |
|
||||
source ./scripts/.tests.env
|
||||
xcodebuild \
|
||||
-project RNTester/RNTester.xcodeproj \
|
||||
-scheme RNTester \
|
||||
-sdk iphonesimulator \
|
||||
-destination "platform=iOS Simulator,name=$IOS_DEVICE,OS=$IOS_TARGET_OS" \
|
||||
-UseModernBuildSystem=NO \
|
||||
-only-testing:RNTesterUnitTests \
|
||||
build test | \
|
||||
xcpretty --report junit --output "$REPORTS_DIR/junit/ios_unit_tests/results.xml" && \
|
||||
exit "${PIPESTATUS[0]}"
|
||||
|
||||
- run:
|
||||
name: Run RNTester Integration Tests
|
||||
command: |
|
||||
source ./scripts/.tests.env
|
||||
xcodebuild \
|
||||
-project RNTester/RNTester.xcodeproj \
|
||||
-scheme RNTester \
|
||||
-sdk iphonesimulator \
|
||||
-destination "platform=iOS Simulator,name=$IOS_DEVICE,OS=$IOS_TARGET_OS" \
|
||||
-UseModernBuildSystem=NO \
|
||||
-only-testing:RNTesterIntegrationTests \
|
||||
build test | \
|
||||
xcpretty --report junit --output "$REPORTS_DIR/junit/ios_integration_tests/results.xml" && \
|
||||
exit "${PIPESTATUS[0]}"
|
||||
|
||||
- run:
|
||||
name: Stop Metro packager and WebSocket test server
|
||||
command: |
|
||||
# kill whatever is occupying port 8081 (packager)
|
||||
lsof -i tcp:8081 | awk 'NR!=1 {print $2}' | xargs kill
|
||||
# kill whatever is occupying port 5555 (web socket server)
|
||||
lsof -i tcp:5555 | awk 'NR!=1 {print $2}' | xargs kill
|
||||
|
||||
- run:
|
||||
name: iOS End-to-End Test Suite
|
||||
|
||||
@@ -64,6 +64,9 @@ static NSURL *ipBundleURL()
|
||||
[super tearDown];
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO: t43430850: Temporarily disable testBundleURL test.
|
||||
* To be re-enabled when the packager can be reliably used on Sandcastle.
|
||||
- (void)testBundleURL
|
||||
{
|
||||
RCTBundleURLProvider *settings = [RCTBundleURLProvider sharedSettings];
|
||||
@@ -75,6 +78,7 @@ static NSURL *ipBundleURL()
|
||||
XCTAssertEqualObjects(URL, localhostBundleURL());
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
- (void)testLocalhostURL
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@ export AVD_NAME="testAVD"
|
||||
export AVD_ABI=x86
|
||||
|
||||
## IOS ##
|
||||
export IOS_TARGET_OS="12.1"
|
||||
export IOS_TARGET_OS="12.2"
|
||||
export IOS_DEVICE="iPhone 6s"
|
||||
export TVOS_DEVICE="Apple TV"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user