Add job to run maestro tests using the Android template (#45710)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45710

## Context
Running manual tests when preparing a release, it's time consuming.
We have to do the cherry picks, wait for CI to finish, and then manually test 8 configurations.

Maestro is a tool that allow us to run E2E tests automatically, and we can wire it to CI.

## Change

Add job to create a new Android app from the template and run maestro test on it

Changelog:
[Internal] - Exploration to integrate maestro

Reviewed By: cortinico

Differential Revision: D60282836

fbshipit-source-id: 0c3b4c1bbacfd6c8695f987c86b7e615a3cef026
This commit is contained in:
Riccardo Cipolleschi 2024-07-26 09:57:46 -07:00 committed by Facebook GitHub Bot
parent 806e5ffadc
commit c595e3da74

View File

@ -279,6 +279,65 @@ jobs:
jsengine: ${{ matrix.jsengine }}
maestro-flow: ./scripts/e2e/.maestro/
test_e2e_android_templateapp:
runs-on: ubuntu-latest
needs: build_npm_package
continue-on-error: true
strategy:
fail-fast: false
matrix:
jsengine: [Hermes, JSC]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup node.js
uses: ./.github/actions/setup-node
- name: Run yarn
uses: ./.github/actions/yarn-install-with-cache
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'zulu'
- name: Download Maven Local
uses: actions/download-artifact@v4
with:
name: maven-local
path: /tmp/react-native-tmp/maven-local
- name: Download React Native Package
uses: actions/download-artifact@v4
with:
name: react-native-package
path: /tmp/react-native-tmp
- name: Print /tmp folder
run: ls -lR /tmp/react-native-tmp
- name: Prepare artifacts
run: |
REACT_NATIVE_PKG=$(find /tmp/react-native-tmp -type f -name "*.tgz")
echo "React Native tgs is $REACT_NATIVE_PKG"
MAVEN_LOCAL=/tmp/react-native-tmp/maven-local
echo "Maven local path is $MAVEN_LOCAL"
# TODO: from next/latest/main convert to branch
node ./scripts/e2e/init-project-e2e.js --projectName RNTestProject --currentBranch 0.75-stable --directory /tmp/RNTestProject --pathToLocalReactNative $REACT_NATIVE_PKG
echo "Feed maven local to gradle.properties"
cd /tmp/RNTestProject
echo "react.internal.mavenLocalRepo=$MAVEN_LOCAL" >> android/gradle.properties
# Build
cd android
./gradlew assembleRelease --no-daemon -PreactNativeArchitectures=x86
- name: Run E2E Tests
uses: ./.github/actions/maestro-android
with:
app-path: /tmp/RNTestProject/android/app/build/outputs/apk/release/app-release.apk
app-id: com.rntestproject
jsengine: ${{ matrix.jsengine }}
maestro-flow: ./scripts/e2e/.maestro/
install-java: 'false'
build_hermesc_linux:
runs-on: ubuntu-latest
needs: prepare_hermes_workspace