Android E2E Tests (Maestro) #473
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: Android E2E Tests (Maestro) | |
| on: | |
| workflow_run: | |
| workflows: ["Build Android QA App for Maestro"] | |
| types: | |
| - completed | |
| workflow_dispatch: # Allows you to trigger the workflow manually from the Actions tab | |
| jobs: | |
| e2e-tests: | |
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
| runs-on: ubuntu-latest # Use ubuntu-latest for better Android emulator support | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false # Don't cancel other jobs if one fails | |
| matrix: | |
| node_index: [0, 1, 2] | |
| total_nodes: [3] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Set up Java 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: "zulu" | |
| java-version: "17" | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: "3.1.7" | |
| bundler-cache: true | |
| - name: Install Ruby dependencies | |
| run: bundle install | |
| - name: Enable KVM group perms | |
| run: | | |
| echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
| sudo udevadm control --reload-rules | |
| sudo udevadm trigger --name-match=kvm | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: us-east-1 | |
| - name: Set up env for ci | |
| run: touch .env.shared && touch keys.shared.json && scripts/setup/setup-env-for-ci | |
| - name: Set up maestro env | |
| run: ./scripts/setup/setup-env-for-maestro android | |
| - name: Download Android App (APK) | |
| run: aws s3 cp s3://artsy-citadel/eigen/builds/android/Artsy-latest.apk ./Artsy.apk | |
| - name: Install Maestro | |
| run: export MAESTRO_VERSION=1.40.0; curl -Ls "https://get.maestro.mobile.dev" | bash | |
| - name: Add Maestro to PATH | |
| run: echo "$HOME/.maestro/bin" >> $GITHUB_PATH | |
| - name: Free Disk Space | |
| uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be | |
| with: | |
| tool-cache: false | |
| android: false | |
| dotnet: true | |
| haskell: true | |
| large-packages: true | |
| docker-images: true | |
| swap-storage: true | |
| - name: Run tests with Android emulator | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| api-level: 34 | |
| arch: x86_64 | |
| ram-size: "8192M" | |
| heap-size: "4096M" | |
| disk-size: "8G" | |
| cores: 4 | |
| disable-animations: false | |
| disable-spellchecker: true | |
| disable-linux-hw-accel: false | |
| enable-hw-keyboard: true | |
| emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim | |
| script: | | |
| echo "🔍 Emulator started, verifying..." | |
| adb devices -l | |
| echo "📋 System info:" | |
| adb shell getprop ro.build.version.release | |
| adb shell getprop ro.build.version.sdk | |
| echo "🔓 Unlocking device..." | |
| adb shell input keyevent 82 | |
| echo "📱 Installing app..." | |
| adb install Artsy.apk | |
| echo "🧪 Testing app launch before running Maestro tests..." | |
| echo "🚀 Launching app manually..." | |
| adb shell am start -n net.artsy.app/.MainActivity | |
| echo "🧪 Running maestro test..." | |
| ./scripts/utils/run_maestro_shard android ${{ matrix.node_index }} ${{ matrix.total_nodes }} |