From 26d917dbc47b785e0cabba6e7e754c9a54a472f6 Mon Sep 17 00:00:00 2001 From: Amr Gharbeia Date: Tue, 5 May 2026 13:41:57 -0400 Subject: [PATCH] =?UTF-8?q?tests:=20flexible=20TUI=20handshake=20test=20(v?= =?UTF-8?q?[0-9]=20not=20v0.x),=20true=20agent=20round-trip=20with=20?= =?UTF-8?q?=E2=AC=87=20marker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- org/system-integration-tests.org | 41 ++++++++++++++++++++++++++------ test/integration-tui.sh | 41 ++++++++++++++++++++++++++------ 2 files changed, 68 insertions(+), 14 deletions(-) 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 ----