Skip to content

E2E Tests (Internal) #16

E2E Tests (Internal)

E2E Tests (Internal) #16

name: E2E Tests (Internal)
on:
workflow_dispatch:
inputs:
branch:
description: 'The branch to run the workflow on'
required: true
default: 'main' # Default to 'main' branch
env:
java_version: "17"
jobs:
build:
runs-on: ubuntu-latest
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_TEST_WEBHOOK }}
environment:
name: Autotests
url: https://concordium.testmo.net/automation/runs/2
strategy:
fail-fast: false
matrix:
api-level: [ 31 ]
profile: [ pixel_7_pro ]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Slack Post
uses: devtk0582/slack-post-action@v1.2
with:
SLACK_WEBHOOK: ${{ secrets.SLACK_TEST_WEBHOOK }}
MESSAGE: "📱 Test Started on device set :${{ matrix.profile }} You can find results and logs here: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
- name: Slack Post
uses: devtk0582/slack-post-action@v1.2
with:
SLACK_WEBHOOK: ${{ secrets.SLACK_TEST_WEBHOOK }}
MESSAGE: 🚀 Starting Stagenet Debug Build
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: "${{ env.java_version }}"
distribution: corretto
- name: Build project (Stagenet)
run: chmod +x ./gradlew && ./gradlew app:assembleStagenetDebug --stacktrace
# Log APK Path and store it as an environment variable
- name: Log APK Path
id: log_apk
run: |
echo "Listing APK files..."
APK_PATH=$(find app/build/outputs/apk -type f -name "*.apk")
echo "APK_PATH=$APK_PATH"
echo "APK_PATH=$APK_PATH" >> $GITHUB_ENV
- name: Slack Post
uses: devtk0582/slack-post-action@v1.2
with:
SLACK_WEBHOOK: ${{ secrets.SLACK_TEST_WEBHOOK }}
MESSAGE: 📱 Test Started on device set :${{ matrix.profile }}
- name: Enable KVM
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-${{ 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 }}
arch: x86_64
profile: ${{ matrix.profile }}
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none -no-snapshot
disable-animations: false
script: echo "Generated AVD snapshot for caching."
- name: Install Appium Dependencies
run: npm install -g appium # Install Appium globally
- name: Install uiautomator2
run: appium driver install uiautomator2 # Install Appium driver globally
- name: Start Appium
run: |
appium --log-level debug & # Start Appium in the background
sleep 10 # Wait for Appium to initialize
- name: Run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
arch: x86_64
profile: ${{ matrix.profile }}
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: avdmanager list device && adb devices && adb -s emulator-5554 shell 'settings delete global hidden_api_policy_pre_p_apps; settings delete global hidden_api_policy_p_apps; settings delete global hidden_api_policy' && sleep 10 && adb install "$APK_PATH" && cd cryptox-android-autotests && mvn clean install # Run tests
- name: Upload Screenshots on Failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: failed-test-screenshots
path: cryptox-android-autotests/screenshots/