Skip to content

Wes/maestro e2 e tests #1

Wes/maestro e2 e tests

Wes/maestro e2 e tests #1

Workflow file for this run

name: Maestro E2E Tests
on:
pull_request:
jobs:
test-android:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- name: Install root dependencies
run: npm ci
- name: Build SDK
run: npm run build
- name: Install example app dependencies
working-directory: example
run: npm ci
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: "17"
distribution: "temurin"
cache: "gradle"
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Enable Gradle Wrapper
working-directory: example/android
run: chmod +x ./gradlew
- name: Accept Android licenses
run: yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses || true
- name: Install Maestro CLI
run: |
curl -Ls "https://get.maestro.mobile.dev" | bash
echo "$HOME/.maestro/bin" >> $GITHUB_PATH
- name: Set up Android Emulator and run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 33
target: google_apis
arch: x86_64
profile: pixel_6
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: |
cd example
npm run android:e2e &
APP_PID=$!
echo "Waiting for app to build and install..."
timeout 300 bash -c 'until adb shell pm list packages | grep -q "com.anonymous.example"; do sleep 5; done' || exit 1
echo "Running Maestro tests..."
~/.maestro/bin/maestro test ./maestro/
kill $APP_PID || true
- name: Upload Maestro test results
if: always()
uses: actions/upload-artifact@v4
with:
name: maestro-results
path: |
example/maestro/**/*.mp4
example/maestro/**/*.log
retention-days: 7
test-ios:
runs-on: macos-14
timeout-minutes: 45
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- name: Install root dependencies
run: npm ci
- name: Build SDK
run: npm run build
- name: Install example app dependencies
working-directory: example
run: npm ci
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.2"
bundler-cache: true
- name: Install CocoaPods dependencies
working-directory: example/ios
run: pod install
- name: Install Maestro CLI
run: |
curl -Ls "https://get.maestro.mobile.dev" | bash
echo "$HOME/.maestro/bin" >> $GITHUB_PATH
- name: Boot iOS Simulator
run: |
SIMULATOR_ID=$(xcrun simctl create "iPhone 15 Pro" "iPhone 15 Pro")
xcrun simctl boot "$SIMULATOR_ID"
echo "SIMULATOR_ID=$SIMULATOR_ID" >> $GITHUB_ENV
- name: Build and run iOS app
working-directory: example
run: |
npm run ios:e2e &
APP_PID=$!
echo "APP_PID=$APP_PID" >> $GITHUB_ENV
echo "Waiting for app to build and install..."
sleep 120
- name: Run Maestro tests
working-directory: example
run: ~/.maestro/bin/maestro test ./maestro/
- name: Cleanup
if: always()
run: |
kill $APP_PID || true
xcrun simctl shutdown $SIMULATOR_ID || true
xcrun simctl delete $SIMULATOR_ID || true
- name: Upload Maestro test results
if: always()
uses: actions/upload-artifact@v4
with:
name: maestro-results-ios
path: |
example/maestro/**/*.mp4
example/maestro/**/*.log
retention-days: 7