Skip to content

Commit 1aab538

Browse files
committed
fix(ci): retry each maestro flow once on failure (both platforms)
Stability re-run 2 hit a different Maestro flake on the 5th-or-so Android flow: "Enter your email or username" extendedWaitUntil timed out at 25s after launchApp clearState even though the AuthView's Welcome header was visible (Android Compose accessibility tree lags visual render on some boots). We've now fixed three separate timing flakes; each one was a real defect that needed a real fix, but the underlying pattern is that any individual maestro test invocation has a non-trivial chance of losing a single-shot timing race on the CI emulator. Maestro doesn't expose a --retries flag in the version we ship. Wrap the per-flow xargs invocation in a 2-attempt retry loop via `xargs -I FLOW bash -c '...'`: first failure forces-stop the app, sleeps 10s, retries; second consecutive failure is a real failure and propagates the non-zero. Catches single-shot timing flakes without masking genuine regressions (a real bug fails both attempts). Applied symmetrically on iOS and Android.
1 parent 293598f commit 1aab538

1 file changed

Lines changed: 20 additions & 5 deletions

File tree

.github/workflows/mobile-e2e.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ jobs:
586586
find flows -type f -name '*.yaml' ! -path '*/common/*' ${FLOWS_FILTER:+-path "*$FLOWS_FILTER*"}
587587
| sort
588588
| while read f; do grep -qE "^[[:space:]]*-[[:space:]]*(${pattern})[[:space:]]*$" "$f" || printf '%s\n' "$f"; done
589-
| xargs -n 1 maestro test --env CLERK_TEST_EMAIL="$CLERK_TEST_EMAIL" --env CLERK_TEST_PASSWORD="$CLERK_TEST_PASSWORD" --flatten-debug-output
589+
| xargs -n 1 -I FLOW bash -c 'flow="$1"; for a in 1 2; do if maestro test --env CLERK_TEST_EMAIL="$CLERK_TEST_EMAIL" --env CLERK_TEST_PASSWORD="$CLERK_TEST_PASSWORD" --flatten-debug-output "$flow"; then exit 0; fi; if [ "$a" -eq 2 ]; then echo "::error::Flow $flow failed after 2 attempts"; exit 1; fi; echo "::warning::Flow $flow failed attempt $a, retrying after 10s..."; adb shell am force-stop com.clerk.clerkexpoquickstart >/dev/null 2>&1 || true; sleep 10; done' _ FLOW
590590
591591
- name: Upload Maestro artifacts on failure or cancel
592592
if: failure() || cancelled()
@@ -1001,10 +1001,25 @@ jobs:
10011001
printf '%s\n' "$f"
10021002
fi
10031003
done | \
1004-
xargs -n 1 maestro test \
1005-
--env CLERK_TEST_EMAIL="$CLERK_TEST_EMAIL" \
1006-
--env CLERK_TEST_PASSWORD="$CLERK_TEST_PASSWORD" \
1007-
--flatten-debug-output
1004+
xargs -n 1 -I FLOW bash -c '
1005+
flow="$1"
1006+
for a in 1 2; do
1007+
if maestro test \
1008+
--env CLERK_TEST_EMAIL="$CLERK_TEST_EMAIL" \
1009+
--env CLERK_TEST_PASSWORD="$CLERK_TEST_PASSWORD" \
1010+
--flatten-debug-output \
1011+
"$flow"; then
1012+
exit 0
1013+
fi
1014+
if [ "$a" -eq 2 ]; then
1015+
echo "::error::Flow $flow failed after 2 attempts"
1016+
exit 1
1017+
fi
1018+
echo "::warning::Flow $flow failed attempt $a, retrying after 10s..."
1019+
xcrun simctl terminate "'"$SIM_UDID"'" com.clerk.clerkexpoquickstart >/dev/null 2>&1 || true
1020+
sleep 10
1021+
done
1022+
' _ FLOW
10081023
10091024
- name: Upload Maestro artifacts on failure or cancel
10101025
if: failure() || cancelled()

0 commit comments

Comments
 (0)