-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
180 additions
and
26 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
name: Android E2E (Genymotion Cloud) | ||
|
||
on: [push, pull_request] | ||
|
||
env: | ||
GMSAAS_INSTANCE_NAME: android-e2e-${{ github.run_number }} | ||
ACTIONS_STEP_DEBUG: true | ||
|
||
jobs: | ||
run_android_e2e: | ||
timeout-minutes: 45 | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
max-parallel: 10 | ||
matrix: | ||
recipe_uuid: [95016679-8f8d-4890-b026-e4ad889aadf1] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Setup Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: temurin | ||
java-version: 11 | ||
|
||
- name: Install Maestro | ||
run: MAESTRO_VERSION=1.30.4 curl -Ls 'https://get.maestro.mobile.dev' | bash | ||
|
||
- name: Install genymotion | ||
run: | | ||
pip3 install gmsaas | ||
gmsaas config set android-sdk-path "$ANDROID_HOME" | ||
- name: Auth genymotion | ||
run: gmsaas auth login ${{ secrets.GMSAAS_EMAIL }} ${{ secrets.GMSAAS_PASSWORD }} | ||
|
||
- name: Start an Instance | ||
id: start_instance | ||
run: | | ||
gmsaas recipes list # List available recipes | ||
INSTANCE_UUID=$(gmsaas instances start "${{ matrix.recipe_uuid }}" "${{ env.GMSAAS_INSTANCE_NAME }}") | ||
echo "INSTANCE_UUID=$INSTANCE_UUID" >> "$GITHUB_OUTPUT" | ||
- name: Connect an Instance to ADB | ||
run: | | ||
gmsaas instances adbconnect "${{ steps.start_instance.outputs.INSTANCE_UUID }}" | ||
$ANDROID_HOME/platform-tools/adb devices | ||
- name: Run Android E2E | ||
run: | | ||
$ANDROID_HOME/platform-tools/adb install app-release.apk | ||
./run_android_e2e.sh | ||
- name: Stop an Instance | ||
if: always() | ||
continue-on-error: true | ||
run: | | ||
gmsaas instances stop --no-wait "${{ steps.start_instance.outputs.INSTANCE_UUID }}" | ||
gmsaas instances list | ||
- name: Upload report | ||
if: always() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: e2e-report-${{ matrix.recipe_uuid }} | ||
path: | | ||
${{ github.workspace }}/*.mp4 | ||
${{ github.workspace }}/*.png | ||
${{ github.workspace }}/report*.xml | ||
- name: Upload debug logs | ||
if: always() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: e2e-debug-logs-${{ matrix.recipe_uuid }} | ||
path: ~/.maestro/tests/**/* |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
# Maestor e2e report | ||
/*.mp4 | ||
/*.png | ||
/*.xml |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
|
||
set -x # all executed commands are printed to the terminal | ||
|
||
TMP_FILE=_fail_proccess | ||
|
||
# Start video record | ||
$ANDROID_HOME/platform-tools/adb shell screenrecord /sdcard/video_record.mp4 & echo $! > video_record.pid | ||
sleep 3 | ||
|
||
APP_ID=com.retyui.myapp | ||
|
||
# Retry 3 times before the steps actually fails | ||
(echo "===== Run E2E Attempt: 1 ====" && $HOME/.maestro/bin/maestro test .maestro/ --env=APP_ID="$APP_ID" --format=junit --output report1.xml) || \ | ||
(echo "===== Run E2E Attempt: 2 ====" && sleep 20 && $HOME/.maestro/bin/maestro test .maestro/ --env=APP_ID="$APP_ID" --format=junit --output report2.xml) || \ | ||
(echo "===== Run E2E Attempt: 3 ====" && sleep 60 && $HOME/.maestro/bin/maestro test .maestro/ --env=APP_ID="$APP_ID" --format=junit --output report3.xml) || \ | ||
(echo "===== Run E2E Step Failed ====" && touch "$TMP_FILE") | ||
|
||
# Stop video record process | ||
kill -SIGINT "$(cat video_record.pid)" | ||
sleep 3 | ||
rm -rf video_record.pid | ||
|
||
# Take screenshot | ||
$ANDROID_HOME/platform-tools/adb shell screencap -p /sdcard/last_img.png | ||
$ANDROID_HOME/platform-tools/adb pull /sdcard/last_img.png | ||
|
||
# Move the video from Emulator to Host filesystem | ||
$ANDROID_HOME/platform-tools/adb pull /sdcard/video_record.mp4 | ||
$ANDROID_HOME/platform-tools/adb shell rm /sdcard/video_record.mp4 | ||
|
||
# Debug | ||
$HOME/.maestro/bin/maestro hierarchy | ||
|
||
if [ -f "$TMP_FILE" ]; then | ||
rm -rf "$TMP_FILE" | ||
echo "3 tries have failed..." | ||
exit 1 | ||
esle | ||
echo "Success..." | ||
fi |