Mobile App Maestro E2E Tests (Android) #2297
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Mobile App Maestro E2E Tests (Android) | |
| on: | |
| workflow_run: | |
| workflows: ["Mobile App Android Build"] | |
| types: | |
| - completed | |
| workflow_dispatch: | |
| jobs: | |
| maestro-test: | |
| runs-on: self-hosted | |
| # Temporarily disabled - Maestro tests are flaky on self-hosted runners | |
| if: false | |
| # Original condition: if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Java | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: "17" | |
| distribution: "temurin" | |
| - name: Setup Android SDK | |
| uses: android-actions/setup-android@v2 | |
| - name: Download APK from build workflow | |
| uses: dawidd6/action-download-artifact@v3 | |
| with: | |
| workflow: mentraos-manager-android-build.yml | |
| workflow_conclusion: success | |
| name: app-debug | |
| path: ./ | |
| - name: Install Maestro | |
| run: | | |
| curl -Ls "https://get.maestro.mobile.dev" | bash | |
| echo "$HOME/.maestro/bin" >> $GITHUB_PATH | |
| - name: AVD cache | |
| uses: actions/cache@v3 | |
| id: avd-cache | |
| with: | |
| path: | | |
| ~/.android/avd/* | |
| ~/.android/adb* | |
| key: avd-34 | |
| - name: Create AVD and generate snapshot for caching | |
| if: steps.avd-cache.outputs.cache-hit != 'true' | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| api-level: 34 | |
| arch: x86_64 | |
| force-avd-creation: false | |
| emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
| disable-animations: false | |
| script: echo "Generated AVD snapshot for caching." | |
| - name: Run Maestro E2E tests | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| api-level: 34 | |
| arch: x86_64 | |
| force-avd-creation: false | |
| emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none | |
| disable-animations: true | |
| script: | | |
| # Wait for emulator to boot | |
| adb wait-for-device | |
| adb shell input keyevent 82 | |
| # Install the APK | |
| adb install app-debug.apk | |
| # Run Maestro tests | |
| cd mobile | |
| maestro test .maestro/flows \ | |
| --env MAESTRO_APP_ID=com.mentra.mentra \ | |
| --format junit \ | |
| --output maestro-results.xml | |
| - name: Upload test results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: maestro-test-results | |
| path: mobile/maestro-results.xml | |
| - name: Publish test results | |
| if: always() | |
| uses: EnricoMi/publish-unit-test-result-action@v2 | |
| with: | |
| files: mobile/maestro-results.xml | |
| check_name: Maestro E2E Test Results |