|
| 1 | +name: Maestro E2E Tests |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + |
| 6 | +jobs: |
| 7 | + test-android: |
| 8 | + runs-on: ubuntu-latest |
| 9 | + timeout-minutes: 30 |
| 10 | + |
| 11 | + steps: |
| 12 | + - name: Checkout code |
| 13 | + uses: actions/checkout@v4 |
| 14 | + |
| 15 | + - name: Set up Node.js |
| 16 | + uses: actions/setup-node@v4 |
| 17 | + with: |
| 18 | + node-version: "20" |
| 19 | + cache: "npm" |
| 20 | + |
| 21 | + - name: Install root dependencies |
| 22 | + run: npm ci |
| 23 | + |
| 24 | + - name: Build SDK |
| 25 | + run: npm run build |
| 26 | + |
| 27 | + - name: Install example app dependencies |
| 28 | + working-directory: example |
| 29 | + run: npm ci |
| 30 | + |
| 31 | + - name: Set up JDK 17 |
| 32 | + uses: actions/setup-java@v4 |
| 33 | + with: |
| 34 | + java-version: "17" |
| 35 | + distribution: "temurin" |
| 36 | + cache: "gradle" |
| 37 | + |
| 38 | + - name: Setup Android SDK |
| 39 | + uses: android-actions/setup-android@v3 |
| 40 | + |
| 41 | + - name: Enable Gradle Wrapper |
| 42 | + working-directory: example/android |
| 43 | + run: chmod +x ./gradlew |
| 44 | + |
| 45 | + - name: Accept Android licenses |
| 46 | + run: yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses || true |
| 47 | + |
| 48 | + - name: Install Maestro CLI |
| 49 | + run: | |
| 50 | + curl -Ls "https://get.maestro.mobile.dev" | bash |
| 51 | + echo "$HOME/.maestro/bin" >> $GITHUB_PATH |
| 52 | +
|
| 53 | + - name: Set up Android Emulator and run tests |
| 54 | + uses: reactivecircus/android-emulator-runner@v2 |
| 55 | + with: |
| 56 | + api-level: 33 |
| 57 | + target: google_apis |
| 58 | + arch: x86_64 |
| 59 | + profile: pixel_6 |
| 60 | + force-avd-creation: false |
| 61 | + emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none |
| 62 | + disable-animations: true |
| 63 | + script: | |
| 64 | + cd example |
| 65 | + npm run android:e2e & |
| 66 | + APP_PID=$! |
| 67 | +
|
| 68 | + echo "Waiting for app to build and install..." |
| 69 | + timeout 300 bash -c 'until adb shell pm list packages | grep -q "com.anonymous.example"; do sleep 5; done' || exit 1 |
| 70 | +
|
| 71 | + echo "Running Maestro tests..." |
| 72 | + ~/.maestro/bin/maestro test ./maestro/ |
| 73 | +
|
| 74 | + kill $APP_PID || true |
| 75 | +
|
| 76 | + - name: Upload Maestro test results |
| 77 | + if: always() |
| 78 | + uses: actions/upload-artifact@v4 |
| 79 | + with: |
| 80 | + name: maestro-results |
| 81 | + path: | |
| 82 | + example/maestro/**/*.mp4 |
| 83 | + example/maestro/**/*.log |
| 84 | + retention-days: 7 |
| 85 | + |
| 86 | + test-ios: |
| 87 | + runs-on: macos-14 |
| 88 | + timeout-minutes: 45 |
| 89 | + |
| 90 | + steps: |
| 91 | + - name: Checkout code |
| 92 | + uses: actions/checkout@v4 |
| 93 | + |
| 94 | + - name: Set up Node.js |
| 95 | + uses: actions/setup-node@v4 |
| 96 | + with: |
| 97 | + node-version: "20" |
| 98 | + cache: "npm" |
| 99 | + |
| 100 | + - name: Install root dependencies |
| 101 | + run: npm ci |
| 102 | + |
| 103 | + - name: Build SDK |
| 104 | + run: npm run build |
| 105 | + |
| 106 | + - name: Install example app dependencies |
| 107 | + working-directory: example |
| 108 | + run: npm ci |
| 109 | + |
| 110 | + - name: Set up Ruby |
| 111 | + uses: ruby/setup-ruby@v1 |
| 112 | + with: |
| 113 | + ruby-version: "3.2" |
| 114 | + bundler-cache: true |
| 115 | + |
| 116 | + - name: Install CocoaPods dependencies |
| 117 | + working-directory: example/ios |
| 118 | + run: pod install |
| 119 | + |
| 120 | + - name: Install Maestro CLI |
| 121 | + run: | |
| 122 | + curl -Ls "https://get.maestro.mobile.dev" | bash |
| 123 | + echo "$HOME/.maestro/bin" >> $GITHUB_PATH |
| 124 | +
|
| 125 | + - name: Boot iOS Simulator |
| 126 | + run: | |
| 127 | + SIMULATOR_ID=$(xcrun simctl create "iPhone 15 Pro" "iPhone 15 Pro") |
| 128 | + xcrun simctl boot "$SIMULATOR_ID" |
| 129 | + echo "SIMULATOR_ID=$SIMULATOR_ID" >> $GITHUB_ENV |
| 130 | +
|
| 131 | + - name: Build and run iOS app |
| 132 | + working-directory: example |
| 133 | + run: | |
| 134 | + npm run ios:e2e & |
| 135 | + APP_PID=$! |
| 136 | + echo "APP_PID=$APP_PID" >> $GITHUB_ENV |
| 137 | +
|
| 138 | + echo "Waiting for app to build and install..." |
| 139 | + sleep 120 |
| 140 | +
|
| 141 | + - name: Run Maestro tests |
| 142 | + working-directory: example |
| 143 | + run: ~/.maestro/bin/maestro test ./maestro/ |
| 144 | + |
| 145 | + - name: Cleanup |
| 146 | + if: always() |
| 147 | + run: | |
| 148 | + kill $APP_PID || true |
| 149 | + xcrun simctl shutdown $SIMULATOR_ID || true |
| 150 | + xcrun simctl delete $SIMULATOR_ID || true |
| 151 | +
|
| 152 | + - name: Upload Maestro test results |
| 153 | + if: always() |
| 154 | + uses: actions/upload-artifact@v4 |
| 155 | + with: |
| 156 | + name: maestro-results-ios |
| 157 | + path: | |
| 158 | + example/maestro/**/*.mp4 |
| 159 | + example/maestro/**/*.log |
| 160 | + retention-days: 7 |
0 commit comments