CircleCI에서 네이티브 엔드 투 엔드 테스트에 반응
디톡스 설정
해독 설정 방법에 대한 ⚡이 있으며 방법을 알고 있습니다.
이제 Detox가 설정되어 분기에 푸시가 있을 때마다 실행되기를 원합니다. 마스터라고 합시다.
이를 위해 우리가 해야 할 일은 리포지토리를 CircleCI에 연결하고 📝 시작하기 위해 약간의 구성을 작성하는 것입니다.
CircleCI 구성
version: 2.1
commands:
node-version:
description: "Install node version 12"
steps:
- run:
name: 'Install Project Node'
command: |
set +x
source ~/.bashrc
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
nvm install 12.13.0
NODE_DIR=$(dirname $(which node))
echo "export PATH=$NODE_DIR:\$PATH" >> $BASH_ENV
npm-dependencies:
description: "Get JavaScript dependencies"
steps:
- run:
name: Executing node version check
command: node -v
- restore_cache:
name: Restore npm cache
key: v1-npm-{{ checksum "./package-lock.json" }}-{{ arch }}
- run:
working_directory: .
name: Installing JavaScript dependencies
command: npm install
- save_cache:
name: Save npm cache
key: v1-npm-{{ checksum "./package-lock.json" }}-{{ arch }}
paths:
- ././node_modules
bundle-dependencies:
description: "Get bundle dependencies"
steps:
- restore_cache:
name: Restore Fastlane cache
key: v1-gems-{{ checksum "Gemfile.lock" }}-{{ arch }}
- run:
working_directory: .
name: Download Fastlane dependencies
command: bundle install --path ./vendor/bundle
- save_cache:
name: Save Fastlane cache
key: v1-gems-{{ checksum "Gemfile.lock" }}-{{ arch }}
paths:
- ./vendor/bundle
pods-dependencies:
description: "Get cocoapods dependencies"
steps:
- restore_cache:
name: Restore cocoapods specs and pods
key: v1-cocoapods-{{ checksum "./ios/Podfile.lock" }}-{{ arch }}
- run:
name: Getting cocoapods dependencies
working_directory: ./ios
command: bundle exec pod install --deployment
- save_cache:
name: Save cocoapods specs and pods cache
key: v1-cocoapods-{{ checksum "./ios/Podfile.lock" }}-{{ arch }}
paths:
- ./ios/Pods
- ~/.cocoapods
gradle-dependencies:
description: "Get Gradle dependencies"
steps:
- run:
working_directory: ./android
name: Chmod permissions
command: sudo chmod +x ./gradlew
- restore_cache:
name: Restore Gradle cache
key: v1-gradle-{{ checksum "./android/build.gradle" }}-{{ checksum "./android/app/build.gradle" }}-{{ arch }}
- run:
working_directory: ./android
name: Download Gradle dependencies
command: ./gradlew dependencies
- save_cache:
name: Save Gradle cache
paths:
- ~/.gradle
key: v1-gradle-{{ checksum "./android/build.gradle" }}-{{ checksum "./android/app/build.gradle" }}-{{ arch }}
android-sdk-dependencies:
description: "Install and set android SDK"
steps:
- run:
name: set ANDROID_SDK_ROOT
command: |
echo 'export ANDROID_SDK_ROOT=$HOME/android-tools' >> $BASH_ENV
- restore_cache:
key: android=tools-v1-{{ checksum "scripts/install-android-tools.sh" }}-{{ arch }}
- run:
name: install android tools
command: |
sh scripts/install-android-tools.sh
echo 'export PATH=$ANDROID_SDK_ROOT/tools/bin:$PATH' >> $BASH_ENV
echo 'export PATH=$ANDROID_SDK_ROOT/tools:$PATH' >> $BASH_ENV
echo 'export PATH=$ANDROID_SDK_ROOT/platform-tools:$PATH' >> $BASH_ENV
echo 'export PATH=$ANDROID_SDK_ROOT/emulator:$PATH' >> $BASH_ENV
source $BASH_ENV
sdkmanager --list
- save_cache:
key: android=tools-v1-{{ checksum "scripts/install-android-tools.sh" }}-{{ arch }}
paths:
- /Users/distiller/android-tools
react-native-dependencies:
description: "Install RN dependencies"
steps:
- run:
name: "Install watchman"
command: |
HOMEBREW_NO_AUTO_UPDATE=1 brew install watchman
simulator-dependencies:
description: "Install iOS simulator dependencies"
steps:
- run:
name: "Install applesimutils"
command: |
HOMEBREW_NO_AUTO_UPDATE=1 brew tap wix/brew
HOMEBREW_NO_AUTO_UPDATE=1 brew install applesimutils
create-launch-android-emulator:
description: "create and launch android emulators"
steps:
- run:
name: create AVD
command: echo "no" | avdmanager --verbose create avd --force --name "Pixel_3a_API_29" --package "system-images;android-29;google_apis;x86_64"
- run:
name: start AVD
command: emulator @Pixel_3a_API_29 -no-window -no-audio
background: true
- run:
name: wait for emulator
command: adb wait-for-device shell 'while [[ -z $(getprop dev.bootcomplete) ]]; do sleep 1; done;'
clear-detox-cache:
description: "Clears detox framework cache"
steps:
- run:
working_directory: .
name: Clear detox cache
command: |
npx detox clean-framework-cache
npx detox build-framework-cache
jobs:
android-test:
macos:
xcode: 11.3.1
steps:
- attach_workspace:
at: .
- checkout
- node-version
- bundle-dependencies
- npm-dependencies
- react-native-dependencies
- gradle-dependencies
- android-sdk-dependencies
- create-launch-android-emulator
- clear-detox-cache
- run:
working_directory: .
name: Run android detox build
command: npx detox build -c android.emu.release
- run:
working_directory: .
name: Run android detox test
command: npx detox test -c android.emu.release --headless --record-logs all
- store_artifacts:
path: ././artifacts
destination: ./jest-logs
- store_artifacts:
path: ././reports
destination: ./reports
ios-test:
macos:
xcode: 11.3.1
steps:
- attach_workspace:
at: .
- checkout
- node-version
- bundle-dependencies
- npm-dependencies
- pods-dependencies
- react-native-dependencies
- simulator-dependencies
- clear-detox-cache
- run:
working_directory: .
name: Run iOS detox build
command: npx detox build -c ios.sim.release
- run:
working_directory: .
name: Run iOS detox test
command: npx detox test -c ios.sim.release --record-logs all > test-summary.txt
- store_artifacts:
path: ././artifacts
destination: ./jest-logs
- store_artifacts:
path: ././reports
destination: ./reports
workflows:
version: 2
run_detox_tests:
jobs:
- android-test
- ios-test
무슨 일이 일어나고 있는지 더 나은 컨텍스트를 얻기 위해 몇 가지 명령을 살펴보겠습니다.
- attach_workspace:
at: .
Attach the workspace to the current directory
- checkout
Pull the repo and checkout to the current branch
- node-version
Install node package and check for adequate versions
- bundle-dependencies
Install and cache gem bundle dependencies such as cocoapods
- npm-dependencies
Install and cache npm depdendencies
- pods-dependencies
Install and cache cocoapods dependencies
- react-native-dependencies
Install and cache RN dependencies
- simulator-dependencies
Install simulator dependencies (android)
- clear-detox-cache
Clear existing cache of detox for every boot
작동 데모를 보려면 repo을 방문하십시오.
질문이 있는 경우 댓글로 알려주시면 피드백을 기다리겠습니다 🍻
Reference
이 문제에 관하여(CircleCI에서 네이티브 엔드 투 엔드 테스트에 반응), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/jeevankishore/react-native-end-to-end-testing-on-circleci-2dib텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)