Skip to content

Mobile Demo Test Run #752

Mobile Demo Test Run

Mobile Demo Test Run #752

name: Mobile Demo Test Run
env:
DEVICE_NAME: vividus-test-device
ANDROID_EMU_ABI: x86
ANDROID_EMU_TARGET: android-29
ANDROID_EMU_TAG: default
IOS_DEVICE_TYPE_ID: iPhone 14 Pro Max
on:
workflow_dispatch:
schedule:
- cron: '30 4 * * MON-FRI'
push:
branches:
- main
paths:
- '**/mobile_app/**'
- '**/android/**'
- '**/ios/**'
- '.github/workflows/mobile-test-run.yml'
pull_request:
branches:
- main
paths:
- '**/mobile_app/**'
- '**/android/**'
- '**/ios/**'
- '.github/workflows/mobile-test-run.yml'
jobs:
mobile-test-run:
runs-on: macos-latest
strategy:
matrix:
platform: [Android, iOS]
fail-fast: false
steps:
- name: Checkout (including submodules)
uses: actions/checkout@v4
with:
submodules: recursive
- name: Cache tests history
uses: actions/cache@v4
with:
save-always: true
path: output/history
key: tests-history-cache
restore-keys: |
tests-history-cache
- name: Spin-up Android emulator
if: matrix.platform == 'Android'
run: |
echo "y" | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --install "system-images;$ANDROID_EMU_TARGET;$ANDROID_EMU_TAG;$ANDROID_EMU_ABI"
echo "no" | $ANDROID_HOME/cmdline-tools/latest/bin/avdmanager create avd -n "$DEVICE_NAME" -k "system-images;$ANDROID_EMU_TARGET;$ANDROID_EMU_TAG;$ANDROID_EMU_ABI" --force
echo $ANDROID_HOME/emulator/emulator -list-avds
echo "Starting emulator"
nohup $ANDROID_HOME/emulator/emulator -avd "$DEVICE_NAME" -no-snapshot -delay-adb > /dev/null 2>&1 &
$ANDROID_HOME/platform-tools/adb wait-for-device
$ANDROID_HOME/platform-tools/adb devices -l
echo "Emulator started"
- name: Spin-up iOS simulator
if: matrix.platform == 'iOS'
run: xcrun simctl create "$DEVICE_NAME" "$IOS_DEVICE_TYPE_ID" | xargs xcrun simctl boot
- name: Set up JDK
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 21
cache: 'gradle'
- name: Install node
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Install Appium
run: npm i -g appium@2.5.4
- name: Install XCUITest driver
if: matrix.platform == 'iOS'
run: appium driver install xcuitest
- name: Install UiAutomator2 driver
if: matrix.platform == 'Android'
run: appium driver install uiautomator2
- name: Start appium server
run: appium --relaxed-security --log-timestamp --log appium.log &
- name: Run iOS tests
if: matrix.platform == 'iOS'
run: |
./gradlew runStories -Pvividus.configuration.suites=mobile_app/ios \
-Pvividus.configuration.profiles=mobile_app/local2,mobile_app/ios \
-Pvividus.allure.history-directory=output/history/ios \
-Pvividus.selenium.grid.capabilities.showXcodeLog=true \
-Pvividus.selenium.grid.capabilities.wdaLaunchTimeout=360000 \
-Pvividus.selenium.grid.capabilities.appium\:simulatorStartupTimeout=600000 \
-Pvividus.selenium.grid.capabilities.udid="$(xcrun simctl list | grep "$DEVICE_NAME" | sed 's/[^(]*(\([^()]*\)).*/\1/g')" \
-Pvividus.selenium.grid.capabilities.deviceName="$DEVICE_NAME" \
-Pvividus.selenium.grid.http.read-timeout=PT15M
- name: Run Android tests
if: matrix.platform == 'Android'
run: |
./gradlew runStories -Pvividus.configuration.suites=mobile_app/android \
-Pvividus.configuration.profiles=mobile_app/local2,mobile_app/android \
-Pvividus.allure.history-directory=output/history/android \
-Pvividus.selenium.grid.capabilities.deviceName="$DEVICE_NAME"
- name: Publish ${{ matrix.platform }} tests report
if: always()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform }} tests report
path: output/reports/allure
- name: Print appium logs
if: always()
run: cat ./appium.log