diff --git a/.github/actions/maestro-ios/action.yml b/.github/actions/maestro-ios/action.yml index ae5fcd61397..8b6e86c5125 100644 --- a/.github/actions/maestro-ios/action.yml +++ b/.github/actions/maestro-ios/action.yml @@ -33,6 +33,10 @@ runs: id: run-tests shell: bash run: | + # Avoid exit from the job if one of the command returns an error. + # Maestro can fail in case of flakyness, we have some retry logic. + set +e + echo "Launching iOS Simulator: iPhone 15 Pro" xcrun simctl boot "iPhone 15 Pro" @@ -46,13 +50,10 @@ runs: echo "Bring simulator in foreground" open -a simulator - - echo "Launch the app" xcrun simctl launch $UDID ${{ inputs.app-id }} echo "Running tests with Maestro" - export MAESTRO_DRIVER_STARTUP_TIMEOUT=1500000 # 25 min. CI is extremely slow # Add retries for flakyness @@ -60,7 +61,7 @@ runs: CURR_ATTEMPT=0 RESULT=1 - while [[ $CURR_ATTEMPT -lt $MAX_ATTEMPT ]] && [[ $RESULT -ne 0 ]]; do + while [[ $CURR_ATTEMPT -lt $MAX_ATTEMPTS ]] && [[ $RESULT -ne 0 ]]; do CURR_ATTEMPT=$((CURR_ATTEMPT+1)) echo "Attempt number $CURR_ATTEMPT" diff --git a/.github/actions/test-ios-rntester/action.yml b/.github/actions/test-ios-rntester/action.yml index 2a6642005fa..2829309dd94 100644 --- a/.github/actions/test-ios-rntester/action.yml +++ b/.github/actions/test-ios-rntester/action.yml @@ -28,6 +28,10 @@ inputs: react-native-version: description: The version of react-native required: true + run-e2e-tests: + description: Whether we want to run E2E tests or not + required: false + default: false runs: using: composite @@ -114,17 +118,32 @@ runs: bundle install bundle exec pod install - name: Build RNTester - if: ${{ inputs.run-unit-tests != 'true' }} + if: ${{ inputs.run-unit-tests != 'true' && inputs.run-e2e-tests == 'false' }} shell: bash run: | xcodebuild build \ -workspace packages/rn-tester/RNTesterPods.xcworkspace \ -scheme RNTester \ -sdk iphonesimulator + - name: Build RNTester (E2E Tests) + shell: bash + if: ${{ inputs.run-e2e-tests == 'true' }} + run: | + xcrun xcodebuild \ + -scheme "RNTester" \ + -workspace packages/rn-tester/RNTesterPods.xcworkspace \ + -configuration "Release" \ + -sdk "iphonesimulator" \ + -destination "generic/platform=iOS Simulator" \ + -derivedDataPath "/tmp/RNTesterBuild" + + echo "Print path to *.app file" + find "/tmp/RNTesterBuild" -type d -name "*.app" - name: "Run Tests: iOS Unit and Integration Tests" if: ${{ inputs.run-unit-tests == 'true' }} shell: bash run: yarn test-ios + - name: Zip Derived data folder if: ${{ inputs.run-unit-tests == 'true' }} shell: bash diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index fc88181c964..792dd3eb0a6 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -179,6 +179,40 @@ jobs: hermes-version: ${{ needs.prepare_hermes_workspace.outputs.hermes-version }} react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }} + test_e2e_ios_rntester: + runs-on: macos-13 + needs: + [build_apple_slices_hermes, prepare_hermes_workspace, build_hermes_macos] + env: + HERMES_WS_DIR: /tmp/hermes + HERMES_TARBALL_ARTIFACTS_DIR: /tmp/hermes/hermes-runtime-darwin + continue-on-error: true + strategy: + fail-fast: false + matrix: + jsengine: [Hermes, JSC] + architecture: [NewArch] + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Run it + uses: ./.github/actions/test-ios-rntester + with: + jsengine: ${{ matrix.jsengine }} + architecture: ${{ matrix.architecture }} + run-unit-tests: "false" + use-frameworks: StaticLibraries + hermes-version: ${{ needs.prepare_hermes_workspace.outputs.hermes-version }} + react-native-version: ${{ needs.prepare_hermes_workspace.outputs.react-native-version }} + run-e2e-tests: "true" + - name: Run E2E Tests + uses: ./.github/actions/maestro-ios + with: + app-path: "/tmp/RNTesterBuild/Build/Products/Release-iphonesimulator/RNTester.app" + app-id: com.meta.RNTester.localDevelopment + jsengine: ${{ matrix.jsengine }} + maestro-flow: ./packages/rn-tester/.maestro/ + build_hermesc_linux: runs-on: ubuntu-latest needs: prepare_hermes_workspace