Revert "refactor: enhance screen recording and cleanup logic in Maestro tests"

This reverts commit aa4223bec2.
This commit is contained in:
skalthoff
2025-11-10 23:34:11 -08:00
parent aa4223bec2
commit cba817770e

View File

@@ -191,7 +191,6 @@ jobs:
disable-animations: false
avd-name: e2e_emulator
script: |
set -eo pipefail
echo "🔎 Listing downloaded artifacts"
ls -R artifacts || true
@@ -200,42 +199,22 @@ jobs:
echo "📦 Installing APK: $(cat apk_path.txt)"
adb install -r "$(cat apk_path.txt)"
# Prepare video filename for this matrix test
VIDEO_FILE="${{ matrix.test }}.mp4"
# Start screen recording and persist device path + pid to files.
DEVICE_VIDEO_PATH="/sdcard/${{ matrix.test }}.mp4"; echo "${DEVICE_VIDEO_PATH}" > device_video_path.txt; echo "🎥 Starting screen recording at ${DEVICE_VIDEO_PATH}"; adb shell screenrecord --time-limit=1800 "${DEVICE_VIDEO_PATH}" & echo $! > rec.pid
# Always stop and pull recording even if tests fail
cleanup() {
echo "⏹ Stopping screen recording"
if [ -f rec.pid ]; then
kill -INT "$(cat rec.pid)" || true
fi
# Give time to finalize file
sleep 3
echo "📥 Pulling video"
if [ -f device_video_path.txt ]; then
adb pull "$(cat device_video_path.txt)" "${VIDEO_FILE}" || true
adb shell rm "$(cat device_video_path.txt)" || true
fi
}
trap cleanup EXIT
echo "🚀 Logging in via Maestro"
set +e
"$HOME"/.maestro/bin/maestro test maestro/tests/1-login.yaml --env server_address="${SERVER_ADDRESS}" --env username="${USERNAME}"
LOGIN_EXIT=$?
echo "🧪 Running test: ${{ matrix.test }}"
"$HOME"/.maestro/bin/maestro test "maestro/tests/${{ matrix.test }}" --env server_address="${SERVER_ADDRESS}" --env username="${USERNAME}"
TEST_EXIT=$?
set -e
# Propagate failure while ensuring cleanup runs via trap
if [ "$LOGIN_EXIT" -ne 0 ] || [ "$TEST_EXIT" -ne 0 ]; then
exit 1
fi
echo "⏹ Stopping screen recording"
kill -INT "$(cat rec.pid)" || true
# Give time to finalize file
sleep 3
echo "📥 Pulling video"
adb pull "$(cat device_video_path.txt)" "${{ matrix.test }}.mp4" || true
adb shell rm "$(cat device_video_path.txt)" || true
env:
SERVER_ADDRESS: "https://jellyfin.jellify.app"
USERNAME: "jerry"
@@ -244,4 +223,5 @@ jobs:
if: always()
with:
name: TestResult-${{ matrix.test }}
path: ${{ matrix.test }}.mp4
path: |
*.mp4