Add automation testing for full binary#54
Merged
CSRessel merged 10 commits intofork/acp-with-geminifrom Nov 22, 2025
Merged
Conversation
Add comprehensive TUI integration testing infrastructure: - New tui-integration-tests crate with PTY session management - Test coverage for startup, prompt flow, input handling, and cancellation - Enhanced mock-acp-agent with configurable responses and delays - Support for simulating realistic streaming behavior via env vars The testing framework uses portable-pty and vt100 parser to drive the TUI programmatically and verify screen contents, enabling reliable end-to-end testing of terminal interactions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Crossterm queries cursor position during initialization via ESC[6n control sequence, but the PTY emulator doesn't automatically respond. This caused tests to timeout waiting for the response. Added intercept_control_sequences() to detect cursor position queries in the PTY output stream and write back ESC[1;1R responses, enabling the TUI to initialize properly in the test environment. Updated test expectations to match the initial welcome screen that now appears, and added snapshot for regression detection. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…imeout hangs Previously, tests using wait_for_text() would hang indefinitely when the expected text never appeared, because the PTY reader was in blocking mode. This caused read() to block forever waiting for data, preventing the timeout mechanism from executing. Changes: - Set PTY master to non-blocking mode using fcntl(O_NONBLOCK) on Unix - Add helper function set_nonblocking() using libc for low-level fcntl ops - read() now returns WouldBlock immediately when no data is available - Timeout checks in wait_for() can now execute, failing tests cleanly after 5s - Add test_poll_does_not_block_when_no_data to verify non-blocking behavior - Convert debug logging to conditional (DEBUG_TUI_PTY env var) - Uncomment and fix previously disabled tests in startup.rs - Update documentation with PTY non-blocking details and debugging info Dependencies added (Unix only): - nix = "0.27" (features: fs) - libc = "0.2" The fix ensures test timeouts work correctly, with tests failing cleanly rather than hanging indefinitely when conditions are not met. 🤖 Generated with [Nori](https://nori.ai) Co-Authored-By: Nori <noreply@tilework.tech>
…ession testing Adds snapshot assertions to 4 startup tests to capture final screen states: - startup_shows_welcome: Welcome screen with logo and /tmp/ path - startup_welcome_dimensions_40x120: Welcome screen at 40x120 dimensions - runs_in_temp_directory: Verification of /tmp/ directory usage - trust_screen_skipped: Main prompt without trust screen Excludes test_poll_does_not_block_when_no_data as it tests timing behavior, not UI. 🤖 Generated with [Nori](https://nori.ai) Co-Authored-By: Nori <noreply@tilework.tech>
…overage Move normalize_for_snapshot() and TIMEOUT constant from test modules to library exports for consistent reuse across all tests. Consolidate streaming/cancellation tests into a unified streaming.rs module. Add Drop trait implementation to TuiSession that prints screen state on panic, improving debugging of PTY timing issues. Expand snapshot testing coverage to input handling scenarios (ctrl-c, typing, arrow navigation). Add 100ms sleep delays after PTY input operations in tests to prevent race conditions between sending input and TUI processing. Update documentation to reflect new exported utilities, debugging aids, and PTY timing patterns.
Collaborator
Author
|
1st in stack |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Key Features
Technical Details
Test Plan