Skip to content

Android Klaatu Tests #13

Android Klaatu Tests

Android Klaatu Tests #13

name: Android Klaatu Tests
on:
workflow_dispatch:
inputs:
branch:
description: 'Experiment Branch'
default: 'control'
required: true
type: string
slug:
description: 'Experiment Slug'
default: 'an-awesome-experiment'
required: true
type: string
firefox-version:
description: 'The Firefox Version(s) you want to test'
default: "['123.0']"
required: false
type: string
feature-name:
description: 'The Feature you want to test'
default: 'smoke'
required: true
type: choice
options:
- smoke
- messaging_survey
- messaging_homescreen
extra-arguments:
description: 'Additional testing arguments'
default: ''
required: false
type: string
jobs:
android-klaatu-tests:
runs-on: ubuntu-latest
strategy:
matrix:
firefox: ${{ fromJSON(inputs.firefox-version) }}
name: ${{ inputs.feature-name }} tests for ${{ inputs.slug }} on firefox android ${{ matrix.firefox }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Setup JDK
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
- name: Cache Gradle dependencies
uses: actions/cache@v2
with:
path: ~/.gradle/caches
key: firefox-${{ matrix.firefox }}-gradle-${{ hashFiles('**/*.gradle*', '**/*.kts') }}
restore-keys: |
firefox-${{ matrix.firefox }}-gradle-
- name: Setup Android SDK
id: android-actions
uses: ./.github/actions/android_actions/
- name: Clone android branch
run: |
firefox_version=$(echo "${{ matrix.firefox }}" | tr '.' '_')
curl -sSL https://hg.mozilla.org/releases/mozilla-release/archive/FIREFOX-ANDROID_${firefox_version}_BUILD1.zip -o firefox-android.zip
- name: Setup files
run: |
unzip -q -o firefox-android.zip -d firefox-android
- name: Setup build
run: |
cd firefox-android/**/mobile/android/fenix
- name: Start emulator
run: |
echo no | android create avd --force -n test -k "system-images;android-34;google_apis;x86" --device "Pixel 3a"
emulator -avd test -no-audio -no-window -gpu swiftshader -no-snapshot -no-accel &
- name: Wait for emulator to start
run: |
adb devices
- name: Build Test files
run: |
./gradlew clean app:assembleFenixDebugAndroidTest
adb install app/build/outputs/apk/androidTest/fenix/debug/app-fenix-debug-androidTest.apk
- name: Build Fenix App
run: |
adb uninstall org.mozilla.fenix.debug
./gradlew clean app:assembleFenixDebug
adb install app/build/outputs/apk/fenix/debug/app-fenix-x86_64-debug.apk
- name: Install Nimbus CLI
run: curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/mozilla/application-services/main/install-nimbus-cli.sh | bash
- name: Run Tests
run: |
cd app/src/androidTest/java/org/mozilla/fenix/experimentintegration
pip3 install virtualenv poetry
poetry install
poetry run python generate_smoke_tests.py
poetry run pytest --experiment ${{ inputs.slug }} --experiment-branch ${{ inputs.branch }} --experiment-feature ${{ inputs.feature-name }} ${{ inputs.extra-arguments }}
- name: HTML Test Report
if: ${{ always() }}
run: zip -r results.zip ~/gecko-dev/mobile/android/fenix/app/src/androidTest/java/org/mozilla/fenix/experimentintegration/results/index.html