workflow error fix #16
Workflow file for this run
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 Appium Tests | |
| on: | |
| push: | |
| branches: [ main, develop, Appiumexamples ] | |
| pull_request: | |
| branches: [ main, develop, Appiumexamples ] | |
| workflow_dispatch: | |
| inputs: | |
| appium2BetaVersionNumber: | |
| description: 'Appium2 Axe UIAutomator2 beta version' | |
| required: false | |
| type: 'string' | |
| default: '2.2.0-beta.e207d54' | |
| appium3BetaVersionNumber: | |
| description: 'Appium3 Axe UIAutomator2 beta version' | |
| required: false | |
| type: 'string' | |
| default: '1.1.0-beta.e207d54' | |
| env: | |
| AGORA_NPM_EMAIL: ${{ secrets.AGORA_NPM_EMAIL }} | |
| AXE_APIKEY: ${{ secrets.AXE_APIKEY }} | |
| DQ_AGORA_IDENTITY_TOKEN: ${{ secrets.DQ_AGORA_IDENTITY_TOKEN }} | |
| AGORA_REGISTRY_URL: //agora.dequecloud.com/artifactory/api/npm/axe-devtools-mobile-appium-qa/ | |
| APPIUM_SKIP_CHROMEDRIVER_INSTALL: 1 | |
| APPIUM_TEST_SERVER_PORT: 4723 | |
| APPIUM_TEST_SERVER_HOST: 127.0.0.1 | |
| APPIUM2_BETA_VERSION: ${{ inputs.appium2BetaVersionNumber || '2.2.0-beta.e207d54' }} | |
| APPIUM3_BETA_VERSION: ${{ inputs.appium3BetaVersionNumber || '1.1.0-beta.e207d54' }} | |
| jobs: | |
| appium2-tests: | |
| name: Appium 2 - Android API ${{ matrix.api-level }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 45 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - api-level: 30 | |
| target: google_apis | |
| arch: x86_64 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| cache: gradle | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: appium-tests/package-lock.json | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Build Android app | |
| run: ./gradlew assembleDebug --stacktrace | |
| - name: Verify APK exists | |
| run: | | |
| ls -la app/build/outputs/apk/debug/ | |
| if [ ! -f "app/build/outputs/apk/debug/app-debug.apk" ]; then | |
| echo "APK not found!" | |
| exit 1 | |
| fi | |
| echo "APK Size: $(du -h app/build/outputs/apk/debug/app-debug.apk | cut -f1)" | |
| - name: Install Appium test dependencies | |
| run: | | |
| cd appium-tests | |
| npm ci | |
| mkdir -p screenshots test-reports/html-reports test-reports/logs | |
| - name: Install Appium 2 and Axe Driver | |
| run: | | |
| # Install Appium 2.x | |
| npm install -g appium@2 | |
| echo "Appium version:" | |
| appium --version | |
| # Configure npm registry for @axe-devtools packages | |
| git config user.name "deque-mobileteam" | |
| git config user.email "mobileteam@deque.com" | |
| npm config set "@deque:registry" "https:$AGORA_REGISTRY_URL" | |
| npm config set "@axe-devtools:registry" "https:$AGORA_REGISTRY_URL" | |
| npm config set "$AGORA_REGISTRY_URL:email" "$AGORA_NPM_EMAIL" | |
| npm config set "$AGORA_REGISTRY_URL:_authToken" "$DQ_AGORA_IDENTITY_TOKEN" | |
| # Install Axe UiAutomator2 driver for Appium 2 | |
| appium driver install --source=npm @axe-devtools/axe-appium-uiautomator2-driver@${APPIUM2_BETA_VERSION} | |
| # Verify driver installation | |
| echo "Installed drivers:" | |
| appium driver list --installed | |
| - name: Enable KVM (for Android Emulator) | |
| 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: AVD cache | |
| uses: actions/cache@v4 | |
| id: avd-cache | |
| with: | |
| path: | | |
| ~/.android/avd/* | |
| ~/.android/adb* | |
| key: avd-appium2-${{ matrix.api-level }} | |
| - 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: ${{ matrix.api-level }} | |
| target: ${{ matrix.target }} | |
| arch: ${{ matrix.arch }} | |
| force-avd-creation: false | |
| emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -memory 4096 | |
| disable-animations: true | |
| disable-spellchecker: true | |
| script: echo "Generated AVD snapshot for caching." | |
| - name: Start Appium Server and Run Tests with Emulator | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| api-level: ${{ matrix.api-level }} | |
| target: ${{ matrix.target }} | |
| arch: ${{ matrix.arch }} | |
| force-avd-creation: false | |
| emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -memory 4096 | |
| disable-animations: true | |
| disable-spellchecker: true | |
| emulator-boot-timeout: 600 | |
| script: | | |
| set +e | |
| cat > /tmp/run_appium2_tests.sh << 'SCRIPT_END' | |
| #!/bin/bash | |
| set +e | |
| echo "Starting Appium 2 test execution..." | |
| npm install -g wait-on | |
| echo "Waiting for device to be fully ready..." | |
| adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done; input keyevent 82' || true | |
| sleep 3 | |
| adb devices -l | |
| echo "Starting Appium server..." | |
| nohup appium server --port=4723 --address=127.0.0.1 --relaxed-security --log-no-colors --log-timestamp > appium2.log 2>&1 & | |
| APPIUM_PID=$! | |
| echo "Appium server started with PID: $APPIUM_PID" | |
| wait-on tcp:4723 --timeout 60000 | |
| echo "Appium 2 server is running on port 4723!" | |
| curl -f http://127.0.0.1:4723/status | |
| cd appium-tests | |
| export AXE_APIKEY="${{ secrets.AXE_APIKEY }}" | |
| echo "=== Running Navigation Tests ===" | |
| npm run test:navigation || true | |
| echo "=== Running Menu Tests ===" | |
| npm run test:menu || true | |
| echo "=== Running Catalog Tests ===" | |
| npm run test:catalog || true | |
| echo "=== Running Cart Tests ===" | |
| npm run test:cart || true | |
| echo "=== Test execution finished ===" | |
| echo "Stopping Appium server (PID: $APPIUM_PID)..." | |
| kill -TERM $APPIUM_PID 2>/dev/null || true | |
| sleep 2 | |
| kill -KILL $APPIUM_PID 2>/dev/null || true | |
| echo "Script completed successfully" | |
| SCRIPT_END | |
| chmod +x /tmp/run_appium2_tests.sh | |
| /tmp/run_appium2_tests.sh | |
| - name: Print Appium Logs | |
| if: always() | |
| run: | | |
| cat appium2.log || echo "No Appium logs found" | |
| - name: Generate test summary | |
| if: always() | |
| run: | | |
| echo "## Appium 2 Test Results" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| if [ -f "appium-tests/test-reports/html-reports/report.html" ]; then | |
| echo "✅ HTML test report generated successfully" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "📊 Download the HTML report artifact to view detailed test results" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "⚠️ HTML test report not found" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Test Execution Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "- **API Level**: ${{ matrix.api-level }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Appium Version**: 2.x" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Driver Version**: ${APPIUM2_BETA_VERSION}" >> $GITHUB_STEP_SUMMARY | |
| - name: Upload test screenshots | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: appium2-screenshots-api-${{ matrix.api-level }} | |
| path: appium-tests/screenshots/**/*.png | |
| retention-days: 14 | |
| - name: Upload HTML test report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: appium2-test-report-api-${{ matrix.api-level }} | |
| path: appium-tests/test-reports/html-reports/ | |
| retention-days: 30 | |
| - name: Upload test logs | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: appium2-logs-api-${{ matrix.api-level }} | |
| path: | | |
| appium2.log | |
| appium-tests/*.log | |
| ~/.npm/_logs/*.log | |
| retention-days: 7 | |
| if-no-files-found: ignore | |
| - name: Upload APK | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: appium2-app-debug-apk-api-${{ matrix.api-level }} | |
| path: app/build/outputs/apk/debug/app-debug.apk | |
| retention-days: 7 | |
| appium3-tests: | |
| name: Appium 3 - Android API ${{ matrix.api-level }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 45 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - api-level: 30 | |
| target: google_apis | |
| arch: x86_64 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| cache: gradle | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'npm' | |
| cache-dependency-path: appium-tests/package-lock.json | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Build Android app | |
| run: ./gradlew assembleDebug --stacktrace | |
| - name: Verify APK exists | |
| run: | | |
| ls -la app/build/outputs/apk/debug/ | |
| if [ ! -f "app/build/outputs/apk/debug/app-debug.apk" ]; then | |
| echo "APK not found!" | |
| exit 1 | |
| fi | |
| echo "APK Size: $(du -h app/build/outputs/apk/debug/app-debug.apk | cut -f1)" | |
| - name: Install Appium test dependencies | |
| run: | | |
| cd appium-tests | |
| npm ci | |
| mkdir -p screenshots test-reports/html-reports test-reports/logs | |
| - name: Install Appium 3 and Axe Driver | |
| run: | | |
| # Install Appium 3.x (latest) | |
| npm install -g appium | |
| echo "Appium version:" | |
| appium --version | |
| # Configure npm registry for @axe-devtools packages | |
| git config user.name "deque-mobileteam" | |
| git config user.email "mobileteam@deque.com" | |
| npm config set "@deque:registry" "https:$AGORA_REGISTRY_URL" | |
| npm config set "@axe-devtools:registry" "https:$AGORA_REGISTRY_URL" | |
| npm config set "$AGORA_REGISTRY_URL:email" "$AGORA_NPM_EMAIL" | |
| npm config set "$AGORA_REGISTRY_URL:_authToken" "$DQ_AGORA_IDENTITY_TOKEN" | |
| # Install Axe UiAutomator2 driver for Appium 3 | |
| appium driver install --source=npm @axe-devtools/axe-appium3-uiautomator2-driver@${APPIUM3_BETA_VERSION} | |
| # Verify driver installation | |
| echo "Installed drivers:" | |
| appium driver list --installed | |
| - name: Enable KVM (for Android Emulator) | |
| 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: AVD cache | |
| uses: actions/cache@v4 | |
| id: avd-cache | |
| with: | |
| path: | | |
| ~/.android/avd/* | |
| ~/.android/adb* | |
| key: avd-appium3-${{ matrix.api-level }} | |
| - 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: ${{ matrix.api-level }} | |
| target: ${{ matrix.target }} | |
| arch: ${{ matrix.arch }} | |
| force-avd-creation: false | |
| emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -memory 4096 | |
| disable-animations: true | |
| disable-spellchecker: true | |
| script: echo "Generated AVD snapshot for caching." | |
| - name: Start Appium Server and Run Tests with Emulator | |
| uses: reactivecircus/android-emulator-runner@v2 | |
| with: | |
| api-level: ${{ matrix.api-level }} | |
| target: ${{ matrix.target }} | |
| arch: ${{ matrix.arch }} | |
| force-avd-creation: false | |
| emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -memory 4096 | |
| disable-animations: true | |
| disable-spellchecker: true | |
| emulator-boot-timeout: 600 | |
| script: | | |
| set +e | |
| cat > /tmp/run_appium3_tests.sh << 'SCRIPT_END' | |
| #!/bin/bash | |
| set +e | |
| echo "Starting Appium 3 test execution..." | |
| npm install -g wait-on | |
| echo "Waiting for device to be fully ready..." | |
| adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done; input keyevent 82' || true | |
| sleep 3 | |
| adb devices -l | |
| echo "Starting Appium server..." | |
| nohup appium server --port=4723 --address=127.0.0.1 --relaxed-security --log-no-colors --log-timestamp > appium3.log 2>&1 & | |
| APPIUM_PID=$! | |
| echo "Appium server started with PID: $APPIUM_PID" | |
| wait-on tcp:4723 --timeout 60000 | |
| echo "Appium 3 server is running on port 4723!" | |
| curl -f http://127.0.0.1:4723/status | |
| cd appium-tests | |
| export AXE_APIKEY="${{ secrets.AXE_APIKEY }}" | |
| echo "=== Running Navigation Tests ===" | |
| npm run test:navigation || true | |
| echo "=== Running Menu Tests ===" | |
| npm run test:menu || true | |
| echo "=== Running Catalog Tests ===" | |
| npm run test:catalog || true | |
| echo "=== Running Cart Tests ===" | |
| npm run test:cart || true | |
| echo "=== Test execution finished ===" | |
| echo "Stopping Appium server (PID: $APPIUM_PID)..." | |
| kill -TERM $APPIUM_PID 2>/dev/null || true | |
| sleep 2 | |
| kill -KILL $APPIUM_PID 2>/dev/null || true | |
| echo "Script completed successfully" | |
| SCRIPT_END | |
| chmod +x /tmp/run_appium3_tests.sh | |
| /tmp/run_appium3_tests.sh | |
| - name: Print Appium Logs | |
| if: always() | |
| run: | | |
| cat appium3.log || echo "No Appium logs found" | |
| - name: Generate test summary | |
| if: always() | |
| run: | | |
| echo "## Appium 3 Test Results" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| if [ -f "appium-tests/test-reports/html-reports/report.html" ]; then | |
| echo "✅ HTML test report generated successfully" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "📊 Download the HTML report artifact to view detailed test results" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "⚠️ HTML test report not found" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Test Execution Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "- **API Level**: ${{ matrix.api-level }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Appium Version**: 3.x" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Driver Version**: ${APPIUM3_BETA_VERSION}" >> $GITHUB_STEP_SUMMARY | |
| - name: Upload test screenshots | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: appium3-screenshots-api-${{ matrix.api-level }} | |
| path: appium-tests/screenshots/**/*.png | |
| retention-days: 14 | |
| - name: Upload HTML test report | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: appium3-test-report-api-${{ matrix.api-level }} | |
| path: appium-tests/test-reports/html-reports/ | |
| retention-days: 30 | |
| - name: Upload test logs | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: appium3-logs-api-${{ matrix.api-level }} | |
| path: | | |
| appium3.log | |
| appium-tests/*.log | |
| ~/.npm/_logs/*.log | |
| retention-days: 7 | |
| if-no-files-found: ignore | |
| - name: Upload APK | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: appium3-app-debug-apk-api-${{ matrix.api-level }} | |
| path: app/build/outputs/apk/debug/app-debug.apk | |
| retention-days: 7 |