From 6c99b618d0366cd7d3db517824ab548e287e542a Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Fri, 13 Dec 2024 14:31:13 +0000 Subject: [PATCH] Improve E2E testing for Android by retrying single tests --- .github/actions/maestro-android/action.yml | 6 ++++-- .github/actions/maestro-ios/action.yml | 2 +- .github/workflow-scripts/maestro-android.js | 6 +++--- .github/workflows/test-all.yml | 7 ++++--- packages/rn-tester/.maestro/flatlist.yml | 4 ++-- packages/rn-tester/.maestro/text.yml | 6 +++++- 6 files changed, 19 insertions(+), 12 deletions(-) diff --git a/.github/actions/maestro-android/action.yml b/.github/actions/maestro-android/action.yml index 99a8c0733098af..8330174991fabd 100644 --- a/.github/actions/maestro-android/action.yml +++ b/.github/actions/maestro-android/action.yml @@ -35,7 +35,7 @@ runs: steps: - name: Installing Maestro shell: bash - run: export MAESTRO_VERSION=1.36.0; curl -Ls "https://get.maestro.mobile.dev" | bash + run: export MAESTRO_VERSION=1.39.5; curl -Ls "https://get.maestro.mobile.dev" | bash - name: Set up JDK 17 if: ${{ inputs.install-java == 'true' }} uses: actions/setup-java@v4 @@ -61,8 +61,10 @@ runs: with: api-level: 24 arch: x86 - ram-size: '4096M' + ram-size: '8192M' + heap-size: '2048M' disk-size: '10G' + cores: '4' disable-animations: false avd-name: e2e_emulator script: node .github/workflow-scripts/maestro-android.js ${{ inputs.app-path }} ${{ inputs.app-id }} ${{ inputs.maestro-flow }} ${{ inputs.flavor }} ${{ inputs.working-directory }} diff --git a/.github/actions/maestro-ios/action.yml b/.github/actions/maestro-ios/action.yml index e5dd927bec32ed..c8e0c7a7cd2949 100644 --- a/.github/actions/maestro-ios/action.yml +++ b/.github/actions/maestro-ios/action.yml @@ -31,7 +31,7 @@ runs: steps: - name: Installing Maestro shell: bash - run: export MAESTRO_VERSION=1.36.0; curl -Ls "https://get.maestro.mobile.dev" | bash + run: export MAESTRO_VERSION=1.39.5; curl -Ls "https://get.maestro.mobile.dev" | bash - name: Installing Maestro dependencies shell: bash run: | diff --git a/.github/workflow-scripts/maestro-android.js b/.github/workflow-scripts/maestro-android.js index f6533bd0933cdc..add4e4568915e8 100644 --- a/.github/workflow-scripts/maestro-android.js +++ b/.github/workflow-scripts/maestro-android.js @@ -57,10 +57,10 @@ async function main() { }); metroProcess.unref(); console.info(`- Metro PID: ${metroProcess.pid}`); - } - console.info('Wait For Metro to Start'); - await sleep(5000); + console.info('Wait For Metro to Start'); + await sleep(5000); + } console.info('Start the app'); childProcess.execSync(`adb shell monkey -p ${APP_ID} 1`, {stdio: 'ignore'}); diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 317fdbc49f4fec..c89e85e48c44cf 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -432,13 +432,13 @@ jobs: uses: ./.github/actions/build-android with: release-type: ${{ needs.set_release_type.outputs.RELEASE_TYPE }} - run-e2e-tests: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') || inputs.run-e2e-tests }} + run-e2e-tests: true #${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') || inputs.run-e2e-tests }} test_e2e_android_rntester: # Temporarily disable RNTester tests on Android as they are quite flaky and they make CI always red # if: ${{ github.ref == 'refs/heads/main' || contains(github.ref, 'stable') || inputs.run-e2e-tests }} - if: ${{ contains(github.ref, 'stable') || inputs.run-e2e-tests }} - runs-on: ubuntu-latest + # if: ${{ contains(github.ref, 'stable') || inputs.run-e2e-tests }} + runs-on: 4-core-ubuntu needs: [build_android] strategy: fail-fast: false @@ -461,6 +461,7 @@ jobs: run: ls -lR ./packages/rn-tester/android/app/build/outputs/apk/${{ matrix.jsengine }}/${{ matrix.flavor }}/ - name: Run E2E Tests uses: ./.github/actions/maestro-android + timeout-minutes: 120 with: app-path: ./packages/rn-tester/android/app/build/outputs/apk/${{ matrix.jsengine }}/${{ matrix.flavor }}/app-${{ matrix.jsengine }}-x86-${{ matrix.flavor }}.apk app-id: com.facebook.react.uiapp diff --git a/packages/rn-tester/.maestro/flatlist.yml b/packages/rn-tester/.maestro/flatlist.yml index 6db8d028cebf2b..17587f86a14533 100644 --- a/packages/rn-tester/.maestro/flatlist.yml +++ b/packages/rn-tester/.maestro/flatlist.yml @@ -11,8 +11,8 @@ appId: ${APP_ID} # iOS: com.meta.RNTester.localDevelopment | Android: com.facebo id: "Flatlist" - tapOn: id: "Basic" -# - assertVisible: -# id: "item_550" +- assertVisible: + id: "item_550" # - repeat: # while: # notVisible: diff --git a/packages/rn-tester/.maestro/text.yml b/packages/rn-tester/.maestro/text.yml index db74042e66bf0a..bdbcad3a95a756 100644 --- a/packages/rn-tester/.maestro/text.yml +++ b/packages/rn-tester/.maestro/text.yml @@ -7,14 +7,18 @@ appId: ${APP_ID} # iOS: com.meta.RNTester.localDevelopment | Android: com.facebo id: "Text" direction: DOWN speed: 60 + timeout: 60000 + visibilityPercentage: 100 - tapOn: id: "Text" +- assertVisible: "Text" - scrollUntilVisible: element: id: "background-border-width" direction: DOWN - speed: 10 + speed: 20 visibilityPercentage: 100 + timeout: 60000 - assertVisible: "Text with background color only" - assertVisible: "Text with background color and uniform borderRadii" - assertVisible: "Text with background color and non-uniform borders"