diff --git a/org/system-integration-tests.org b/org/system-integration-tests.org index 9c5c88b..8f4395a 100644 --- a/org/system-integration-tests.org +++ b/org/system-integration-tests.org @@ -330,10 +330,36 @@ tmux new-session -d -s tui-test "passepartout tui 2>&1 | tee $TUI_LOG" sleep 4 # ---- Tests ---- -test_renders_input() { - tmux send-keys -t tui-test "hello world" Enter - sleep 2 - grep -q 'hello world' "$TUI_LOG" + +test_handshake() { + # The TUI receives a handshake from the daemon on connect + # and renders "Connected v" in the log/chat area. + grep -q 'Connected v[0-9]' "$TUI_LOG" +} + +test_agent_responds() { + # Send text to the TUI and wait for an agent (⬇) response. + # This proves the full round-trip: TUI → daemon → pipeline → TUI. + # The response may be a cascade failure message (no API key) + # or a real LLM reply — either way, ⬇ proves the daemon responded. + local before_ts + before_ts=$(date +%s) + + tmux send-keys -t tui-test "hello" Enter + + # Wait up to 20 seconds for ⬇ to appear + while true; do + if grep -q '⬇.*[a-zA-Z]\{3,\}' "$TUI_LOG"; then + return 0 + fi + local now_ts + now_ts=$(date +%s) + if (( now_ts - before_ts > 20 )); then + echo "TIMEOUT: no agent response in log" >&2 + return 1 + fi + sleep 1 + done } test_eval_command() { @@ -354,9 +380,10 @@ test_connection_drop() { grep -qi 'connection.*lost\|ERROR.*Connection' "$TUI_LOG" } -run_test "renders-input" test_renders_input -run_test "eval-command" test_eval_command -run_test "status-bar" test_status_bar +run_test "handshake" test_handshake +run_test "agent-responds" test_agent_responds +run_test "eval-command" test_eval_command +run_test "status-bar" test_status_bar run_test "connection-drop" test_connection_drop # ---- Summary ---- diff --git a/test/integration-tui.sh b/test/integration-tui.sh index 588aea5..e25c246 100755 --- a/test/integration-tui.sh +++ b/test/integration-tui.sh @@ -35,10 +35,36 @@ tmux new-session -d -s tui-test "passepartout tui 2>&1 | tee $TUI_LOG" sleep 4 # ---- Tests ---- -test_renders_input() { - tmux send-keys -t tui-test "hello world" Enter - sleep 2 - grep -q 'hello world' "$TUI_LOG" + +test_handshake() { + # The TUI receives a handshake from the daemon on connect + # and renders "Connected v" in the log/chat area. + grep -q 'Connected v[0-9]' "$TUI_LOG" +} + +test_agent_responds() { + # Send text to the TUI and wait for an agent (⬇) response. + # This proves the full round-trip: TUI → daemon → pipeline → TUI. + # The response may be a cascade failure message (no API key) + # or a real LLM reply — either way, ⬇ proves the daemon responded. + local before_ts + before_ts=$(date +%s) + + tmux send-keys -t tui-test "hello" Enter + + # Wait up to 20 seconds for ⬇ to appear + while true; do + if grep -q '⬇.*[a-zA-Z]\{3,\}' "$TUI_LOG"; then + return 0 + fi + local now_ts + now_ts=$(date +%s) + if (( now_ts - before_ts > 20 )); then + echo "TIMEOUT: no agent response in log" >&2 + return 1 + fi + sleep 1 + done } test_eval_command() { @@ -59,9 +85,10 @@ test_connection_drop() { grep -qi 'connection.*lost\|ERROR.*Connection' "$TUI_LOG" } -run_test "renders-input" test_renders_input -run_test "eval-command" test_eval_command -run_test "status-bar" test_status_bar +run_test "handshake" test_handshake +run_test "agent-responds" test_agent_responds +run_test "eval-command" test_eval_command +run_test "status-bar" test_status_bar run_test "connection-drop" test_connection_drop # ---- Summary ----