From 5ea37a07d9b8a3cec99b45aa5faf3a3c321c151e Mon Sep 17 00:00:00 2001 From: riteshshukla04 Date: Tue, 11 Nov 2025 22:39:12 +0530 Subject: [PATCH] fix: tests --- .github/workflows/maestro-test.yml | 31 +------------------- scripts/maestro-android-retry.sh | 46 ++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+), 30 deletions(-) create mode 100755 scripts/maestro-android-retry.sh diff --git a/.github/workflows/maestro-test.yml b/.github/workflows/maestro-test.yml index 3fb029e2..1c4b7dc2 100644 --- a/.github/workflows/maestro-test.yml +++ b/.github/workflows/maestro-test.yml @@ -122,36 +122,7 @@ jobs: cores: '4' disable-animations: false avd-name: e2e_emulator - script: | - attempt=1 - max_attempts=3 - success=false - - while [ $attempt -le $max_attempts ]; do - echo "Attempt $attempt of $max_attempts..." - - if node scripts/maestro-android.js "https://jellyfin.jellify.app" "jerry"; then - echo "Tests passed on attempt $attempt" - success=true - break - else - echo "Tests failed on attempt $attempt" - - if [ $attempt -lt $max_attempts ]; then - echo "Cleaning up and retrying..." - rm -rf *.mp4 || true - pkill -f maestro || true - sleep 5 - fi - - attempt=$((attempt + 1)) - fi - done - - if [ "$success" = false ]; then - echo "All $max_attempts attempts failed" - exit 1 - fi + script: bash scripts/maestro-android-retry.sh "https://jellyfin.jellify.app" "jerry" - name: 🗣️ Notify Success on Discord diff --git a/scripts/maestro-android-retry.sh b/scripts/maestro-android-retry.sh new file mode 100755 index 00000000..0ff098b9 --- /dev/null +++ b/scripts/maestro-android-retry.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +# Script to run Maestro Android tests with retry logic +# Usage: ./maestro-android-retry.sh + +if [ -z "$1" ] || [ -z "$2" ]; then + echo "Error: Missing required arguments" + echo "Usage: $0 " + exit 1 +fi + +JELLYFIN_URL="$1" +USERNAME="$2" + +attempt=1 +max_attempts=3 +success=false + +while [ $attempt -le $max_attempts ]; do + echo "Attempt $attempt of $max_attempts..." + + if node scripts/maestro-android.js "$JELLYFIN_URL" "$USERNAME"; then + echo "Tests passed on attempt $attempt" + success=true + break + else + echo "Tests failed on attempt $attempt" + + if [ $attempt -lt $max_attempts ]; then + echo "Cleaning up and retrying..." + rm -rf *.mp4 || true + pkill -f maestro || true + sleep 5 + fi + + attempt=$((attempt + 1)) + fi +done + +if [ "$success" = false ]; then + echo "All $max_attempts attempts failed" + exit 1 +fi + +echo "Tests completed successfully!" +