Skip to content

Android UI tests

Android UI tests #72

Workflow file for this run

name: Android UI tests
on:
schedule:
- cron: '0 0 * * *' # Every day at midnight UTC
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
instrumentation-tests:
runs-on: [ self-hosted, Android ]
env:
ENV_PATH: "app/src/androidTest/java/com/infomaniak/mail/utils/Env.kt"
UI_TEST_ACCOUNT_EMAIL: ${{ secrets.UI_TEST_ACCOUNT_EMAIL }}
UI_TEST_ACCOUNT_PASSWORD: ${{ secrets.UI_TEST_ACCOUNT_PASSWORD }}
steps:
- name: Checkout the code
uses: actions/[email protected]
with:
token: ${{ github.token }}
submodules: recursive
- name: Create test env
run: |
mkdir -p "$(dirname "$ENV_PATH")"
touch $ENV_PATH
echo "package com.infomaniak.mail.utils; object Env { const val UI_TEST_ACCOUNT_EMAIL: String = \"$UI_TEST_ACCOUNT_EMAIL\"; const val UI_TEST_ACCOUNT_PASSWORD: String = \"$UI_TEST_ACCOUNT_PASSWORD\" }" > $ENV_PATH
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Clean gradle cache
run: ./gradlew clean
- name: Run UI tests
run: |
./gradlew ui-testStandardDebugAndroidTest
- name: Upload Test Report
if: failure()
uses: actions/upload-artifact@v4
with:
name: ui-test-report
path: app/build/reports/androidTests/managedDevice/debug/flavors/standard/allDevices
- name: Create Github issue with tests failure
if: failure()
uses: actions/[email protected]
with:
script: |
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: 'UI tests failure',
body: 'Workflow run: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} failed.',
})