# xacli-testing
Testing utilities for XaCLI framework.
## Features
- **Keyboard Event Simulation**: Build keyboard events programmatically for testing interactive components
- **VHS Tape Parser**: Parse VHS `.tape` files and convert them to event sequences
- **Output Capture**: Capture and assert terminal output with ANSI escape sequence handling
- **Test Builders**: Helper functions for building test contexts and parsing arguments
## Usage
```rust
use xacli_testing::prelude::*;
#[test]
fn test_confirm_component() {
let events = vec![
EventBuilder::char('y'),
EventBuilder::enter(),
];
// Setup test event source
let (tx, _) = setup_test_events(events);
// Run component
let result = Confirm::new("Continue?").run().unwrap();
assert!(result);
}
#[test]
fn test_from_tape() {
let events = events_from_tape("tapes/components/input.tape").unwrap();
setup_test_events(events);
let result = Input::new("Name:").default("Alice").run().unwrap();
assert_eq!(result, "John Doe");
}
```
## VHS Tape Support
Supported instructions:
- `Type "text"` - Type characters
- `Enter` - Press Enter key
- `Backspace` / `Backspace N` - Press Backspace N times
- `Up` / `Down` / `Left` / `Right` - Arrow keys
- `Space` - Space key
- `Escape` - Escape key
Ignored instructions: `Output`, `Set`, `Hide`, `Show`, `Sleep`, `Screenshot`