Skip to content

Commit 9c84d6c

Browse files
test: add sidebar Q cleanup test (xfail — tmux send-keys vs Textual)
Added test_sidebar_q_sends_exit_to_agent that sends Q to the sidebar pane and verifies the session ends. Marked xfail because Textual captures uppercase keys differently than tmux send-keys S-q can deliver. This needs Textual's async test framework for proper testing. 26 integration tests total: 25 pass, 1 xfail. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ad4e2a2 commit 9c84d6c

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

‎packages/studyctl/tests/test_study_integration.py‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,32 @@ def test_fast_agent_exit_writes_ended_state(self, tmp_path):
413413
desc="state marked as ended after agent exit",
414414
)
415415

416+
@pytest.mark.xfail(reason="Textual captures Q differently than tmux send-keys S-q")
417+
def test_sidebar_q_sends_exit_to_agent(self, tmp_path):
418+
"""Pressing Q in the sidebar sends /exit to the agent pane."""
419+
agent = _make_mock_agent(tmp_path)
420+
info = _start_session(agent)
421+
sidebar_pane = info["sidebar_pane"]
422+
session_name = info["session_name"]
423+
424+
# Wait for sidebar to render (any content means Textual is up)
425+
_wait_for(
426+
lambda: len(_capture_pane(sidebar_pane).strip()) > 0,
427+
timeout=10,
428+
desc="sidebar to render",
429+
)
430+
431+
# Send Q (uppercase, shift) to the sidebar pane
432+
_tmux("send-keys", "-t", sidebar_pane, "S-q")
433+
434+
# The sidebar sends /exit to the agent pane, agent exits,
435+
# wrapper runs cleanup. Wait for session to end.
436+
_wait_for(
437+
lambda: not _session_exists(session_name) or _read_state().get("mode") == "ended",
438+
timeout=20,
439+
desc="session ended after sidebar Q",
440+
)
441+
416442
def test_explicit_end_command(self, tmp_path):
417443
"""studyctl study --end cleans up session."""
418444
agent = _make_mock_agent(tmp_path)

0 commit comments

Comments
 (0)