test(interactive): replace blind y-loops with accept_until helper

Add an accept_until helper that only sends "y" when a new [Y/n] prompt
appears in the tmux pane, replacing the fixed-count blind send loops that
could race ahead of prompts or send stray input. Resilient to changes in
the number of apply-phase prompts.

Relates to #51

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Flo
2026-06-09 23:54:55 +02:00
parent c3eb339cb2
commit e27bbaaa43
5 changed files with 37 additions and 67 deletions
+2 -13
View File
@@ -34,19 +34,8 @@ main() {
wait_for "Proceed with hardening"
send "y" Enter
# Accept settings until signing wizard (v0.2.0 adds more prompts)
local pane_content
for _ in $(seq 1 50); do
sleep 0.3
pane_content="$(tmux capture-pane -t "$TMUX_SESSION" -p 2>/dev/null || true)"
if printf '%s' "$pane_content" | grep -qF "Signing key options"; then
break
fi
if printf '%s' "$pane_content" | grep -qF "Hardening complete"; then
break
fi
send "y" Enter
done
# Accept all [Y/n] prompts until signing wizard
accept_until "Signing key options"
# Signing wizard — option 1: generate ed25519
wait_for "Signing key options" 20