test(tui): TestBackend render tests for colibri-tui dashboard #171

Merged
clawdie merged 3 commits from test/tui-render-backend into main 2026-06-24 14:46:06 +02:00
Owner

Adds TestBackend headless render tests for colibri-tui — the dashboard had unit tests on its helper logic but zero coverage of actual rendering. Now verified it draws without panic and shows the right content.

Tests (10 total, 5 new render tests):

  • connecting state shows "connecting…" + title
  • populated snapshot shows host / pane id / agent / state / icon
  • empty snapshot → no panic
  • stalled pane → icon (distinct render branch)
  • tiny terminal (20×5) → no panic (cramped-layout guard)

Uses the idiomatic ratatui TestBackend + a buffer-to-text flatten so assertions are on content, not exact cell coordinates.

Still not covered (needs a one-time manual smoke, not automatable here): the live DaemonClient connect → poll → snapshot-parse path. These tests set app.snapshot directly. So this proves rendering, not the end-to-end connection.

Verified: cargo test -p colibri-glasspane-tui → 10 passed; fmt clean.

🤖 Generated with Claude Code

Adds `TestBackend` headless render tests for `colibri-tui` — the dashboard had unit tests on its helper logic but **zero** coverage of actual rendering. Now verified it draws without panic and shows the right content. Tests (10 total, 5 new render tests): - **connecting** state shows "connecting…" + title - **populated** snapshot shows host / pane id / agent / state / `●` icon - **empty** snapshot → no panic - **stalled** pane → `⚠` icon (distinct render branch) - **tiny terminal** (20×5) → no panic (cramped-layout guard) Uses the idiomatic ratatui `TestBackend` + a buffer-to-text flatten so assertions are on content, not exact cell coordinates. **Still not covered** (needs a one-time manual smoke, not automatable here): the live `DaemonClient` connect → poll → snapshot-parse path. These tests set `app.snapshot` directly. So this proves *rendering*, not the end-to-end connection. Verified: `cargo test -p colibri-glasspane-tui` → 10 passed; fmt clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
clawdie added 3 commits 2026-06-24 14:45:59 +02:00
Closes the 'compiles but never verified to draw' gap:
- render_connecting_state_shows_connecting_text — asserts 'connecting…'
  and 'colibri-harness' title render before daemon connects
- render_with_snapshot_shows_panes_and_agent — asserts pane id, agent
  name, state label, and state icon appear in rendered buffer
- render_does_not_panic_on_empty_snapshot — smoke test for the
  snapshot=None path

All three use ratatui::TestBackend (no terminal needed, CI-friendly).
test(tui): add stalled-pane + tiny-terminal render tests
Some checks failed
CI / rust (pull_request) Has been cancelled
CI / markdown (pull_request) Has been cancelled
CI / port (pull_request) Has been cancelled
CI / agent-jail-pkgs (pull_request) Has been cancelled
57e3f30f9c
Two more TestBackend render tests on top of the connecting/populated/empty set:
- render_stalled_pane_shows_warning_icon — covers the distinct stalled branch
  (state_icon → ⚠), which the healthy-Working test (●) didn't exercise.
- render_does_not_panic_on_tiny_terminal — renders at 20x5 to guard against
  cramped-layout panics (a classic ratatui footgun).

10 tests pass; fmt clean.
clawdie merged commit ffa588d785 into main 2026-06-24 14:46:06 +02:00
clawdie deleted branch test/tui-render-backend 2026-06-24 14:46:06 +02:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: clawdie/colibri#171
No description provided.