Consolidate e2e steps and run Detox tests before e2e (#20550)

Summary:
Run Detox before the flaky e2e iOS tests in order to get better signal.
Pull Request resolved: https://github.com/facebook/react-native/pull/20550

Differential Revision: D9183655

Pulled By: hramos

fbshipit-source-id: e499daad86249961cd6d0b8fc22c846392622056
This commit is contained in:
Héctor Ramos 2018-08-06 12:59:41 -07:00 committed by Facebook Github Bot
parent 6d65e8b4ed
commit fb223e7675
1 changed files with 71 additions and 61 deletions

View File

@ -128,10 +128,6 @@ aliases:
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn sudo apt-get update && sudo apt-get install yarn
- &install-node-dependencies
|
npm install --no-package-lock --no-spin --no-progress
- &install-buck - &install-buck
name: Install BUCK name: Install BUCK
command: | command: |
@ -147,13 +143,6 @@ aliases:
mkdir -p ~/react-native/tooling/junit mkdir -p ~/react-native/tooling/junit
cp -R ~/okbuck/tooling/junit/* ~/react-native/tooling/junit/. cp -R ~/okbuck/tooling/junit/* ~/react-native/tooling/junit/.
- &install-node
name: Install Node
command: |
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
- &create-ndk-directory - &create-ndk-directory
name: Create Android NDK Directory name: Create Android NDK Directory
command: | command: |
@ -194,17 +183,11 @@ aliases:
# eslint sometimes runs into trouble generating the reports # eslint sometimes runs into trouble generating the reports
- &run-lint-checks - &run-lint-checks
name: Lint code name: Lint code
command: | command: scripts/circleci/exec_swallow_error.sh yarn lint --format junit -o ~/react-native/reports/junit/eslint/results.xml
if [ $((0 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
scripts/circleci/exec_swallow_error.sh yarn lint --format junit -o ~/react-native/reports/junit/eslint/results.xml
fi
- &run-flow-checks - &run-flow-checks
name: Check for errors in code using Flow name: Check for errors in code using Flow
command: | command: yarn flow check
if [ $((0 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
yarn flow check
fi
- &run-sanity-checks - &run-sanity-checks
name: Sanity checks name: Sanity checks
@ -282,35 +265,45 @@ aliases:
mkdir -p ~/react-native/reports/junit/ mkdir -p ~/react-native/reports/junit/
mkdir -p ~/react-native/reports/outputs/ mkdir -p ~/react-native/reports/outputs/
- &brew-install-watchman
name: Install Watchman
command: |
brew install watchman
touch .watchmanconfig
- &boot-simulator-iphone - &boot-simulator-iphone
name: Boot iPhone Simulator
command: xcrun simctl boot "iPhone 5s" || true
- &boot-simulator-iphone-with-parallelism
name: Boot iPhone Simulator name: Boot iPhone Simulator
command: | command: |
if [ $((0 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then if [ $((0 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
xcrun simctl boot "iPhone 5s" || true xcrun simctl boot "iPhone 5s" || true
fi fi
- &boot-simulator-appletv - &boot-simulator-appletv-with-parallelism
name: Boot Apple TV Simulator name: Boot Apple TV Simulator
command: | command: |
if [ $((1 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then if [ $((1 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
xcrun simctl boot "Apple TV" || true xcrun simctl boot "Apple TV" || true
fi fi
- &run-objc-ios-tests - &run-objc-ios-tests-with-parallelism
name: iOS Test Suite name: iOS Test Suite
command: | command: |
if [ $((0 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then if [ $((0 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
./scripts/objc-test-ios.sh test ./scripts/objc-test-ios.sh test
fi fi
- &run-objc-tvos-tests - &run-objc-tvos-tests-with-parallelism
name: tvOS Test Suite name: tvOS Test Suite
command: | command: |
if [ $((1 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then if [ $((1 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
./scripts/objc-test-tvos.sh test ./scripts/objc-test-tvos.sh test
fi fi
- &run-podspec-tests - &run-podspec-tests-with-parallelism
name: Test CocoaPods name: Test CocoaPods
command: | command: |
if [ $((2 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then if [ $((2 % CIRCLE_NODE_TOTAL)) -eq "$CIRCLE_NODE_INDEX" ]; then
@ -321,6 +314,29 @@ aliases:
name: End-to-End Test Suite name: End-to-End Test Suite
command: node ./scripts/run-ci-e2e-tests.js --android --ios --tvos --js --retries 3; command: node ./scripts/run-ci-e2e-tests.js --android --ios --tvos --js --retries 3;
- &install-node-8
name: Install Node 8
command: |
echo 'export PATH=/usr/local/opt/node@8/bin:$PATH' >> $BASH_ENV
source $BASH_ENV
brew install node@8
brew link node@8
node -v
- &install-apple-simulator-utils
name: Install Apple Simulator Utilities
command: |
brew tap wix/brew
brew install applesimutils
- &build-ios-app-e2e
name: Build iOS App for Simulator
command: yarn run build-ios-e2e
- &run-ios-detox-tests
name: Run Detox Tests
command: yarn run test-ios-e2e
- &run-objc-ios-e2e-tests - &run-objc-ios-e2e-tests
name: iOS End-to-End Test Suite name: iOS End-to-End Test Suite
command: | command: |
@ -425,56 +441,45 @@ jobs:
- attach_workspace: - attach_workspace:
at: ~/react-native at: ~/react-native
- run: *boot-simulator-iphone - run: *boot-simulator-iphone-with-parallelism
- run: *boot-simulator-appletv - run: *boot-simulator-appletv-with-parallelism
- run: brew install watchman - run: *brew-install-watchman
- run: *run-objc-ios-tests - run: *run-objc-ios-tests-with-parallelism
- run: *run-objc-tvos-tests - run: *run-objc-tvos-tests-with-parallelism
- run: *run-podspec-tests - run: *run-podspec-tests-with-parallelism
- store_test_results: - store_test_results:
path: ~/react-native/reports/junit path: ~/react-native/reports/junit
# Runs end to end tests # Runs end to end tests (Objective-C)
test_end_to_end: test_objc_end_to_end:
<<: *macos_defaults <<: *macos_defaults
steps: steps:
- attach_workspace: - attach_workspace:
at: ~/react-native at: ~/react-native
- run: - run: *boot-simulator-iphone
name: Boot iOS Simulator
command: xcrun simctl boot "iPhone 5s" || true
- run:
name: Configure Environment Variables
command: |
echo 'export PATH=/usr/local/opt/node@8/bin:$PATH' >> $BASH_ENV
source $BASH_ENV
- run:
name: Install Node 8
command: |
brew install node@8
brew link node@8
node -v
- run: *run-objc-ios-e2e-tests - run: *run-objc-ios-e2e-tests
- run: - store_test_results:
name: Install Apple Simulator Utilities path: ~/react-native/reports/junit
command: |
brew tap wix/brew
brew install applesimutils
- run: # Runs end to end tests (Detox)
name: Build iOS App for Simulator test_detox_end_to_end:
command: yarn run build-ios-e2e <<: *macos_defaults
steps:
- attach_workspace:
at: ~/react-native
- run: - run: *boot-simulator-iphone
name: Run Detox Tests
command: yarn run test-ios-e2e - run: *install-node-8
- run: *install-apple-simulator-utils
- run: *build-ios-app-e2e
- run: *run-ios-detox-tests
- store_test_results: - store_test_results:
path: ~/react-native/reports/junit path: ~/react-native/reports/junit
@ -670,11 +675,17 @@ workflows:
- checkout_code - checkout_code
# End-to-end tests # End-to-end tests
- test_end_to_end: - test_objc_end_to_end:
filters: *filter-ignore-gh-pages filters: *filter-ignore-gh-pages
requires: requires:
- checkout_code - checkout_code
- test_detox_end_to_end:
filters: *filter-ignore-gh-pages
requires:
- checkout_code
# Only runs on vX.X.X tags if all tests are green # Only runs on vX.X.X tags if all tests are green
- publish_npm_package: - publish_npm_package:
filters: filters:
@ -687,8 +698,7 @@ workflows:
- test_javascript - test_javascript
- test_objc - test_objc
- test_android - test_android
- test_end_to_end - test_objc_end_to_end
- analyze
# Only runs on PRs # Only runs on PRs
analyze: analyze: