|
21 | 21 |
|
22 | 22 | Use tmux to test CLI behavior in a controlled, scriptable way. This is especially useful for testing UI updates, authentication flows, and time-dependent behavior. |
23 | 23 |
|
| 24 | +### Local Development End-to-End Testing |
| 25 | + |
| 26 | +**Running the Local CLI Build** |
| 27 | + |
| 28 | +Always test using the local development build to validate your changes: |
| 29 | + |
| 30 | +```bash |
| 31 | +# From the project root, navigate to cli directory |
| 32 | +cd cli |
| 33 | + |
| 34 | +# Run the local development version with a test query |
| 35 | +bun run dev "your test query here" |
| 36 | +``` |
| 37 | + |
| 38 | +**Comprehensive E2E Testing in tmux** |
| 39 | + |
| 40 | +For full end-to-end validation that tests UI rendering, agent output, and interactions: |
| 41 | + |
| 42 | +```bash |
| 43 | +# Test basic file listing (read-only, safe) |
| 44 | +tmux new-session -d -s cli-test 'cd cli && bun run dev "list files in src/components"' && \ |
| 45 | + sleep 15 && \ |
| 46 | + tmux capture-pane -t cli-test -p -S -100 | tail -60 && \ |
| 47 | + tmux kill-session -t cli-test |
| 48 | + |
| 49 | +# Test code search functionality |
| 50 | +tmux new-session -d -s cli-search 'cd cli && bun run dev "find uses of useChatTheme"' && \ |
| 51 | + sleep 18 && \ |
| 52 | + tmux capture-pane -t cli-search -p -S -100 | tail -60 && \ |
| 53 | + tmux kill-session -t cli-search |
| 54 | + |
| 55 | +# Test with explanation query |
| 56 | +tmux new-session -d -s cli-explain 'cd cli && bun run dev "explain the ChatThemeProvider"' && \ |
| 57 | + sleep 18 && \ |
| 58 | + tmux capture-pane -t cli-explain -p -S -100 | tail -50 && \ |
| 59 | + tmux kill-session -t cli-explain |
| 60 | + |
| 61 | +# Interactive session for manual testing |
| 62 | +tmux new-session -s cli-interactive 'cd cli && bun run dev' |
| 63 | +# Use Ctrl+B then D to detach |
| 64 | +# Use tmux attach -t cli-interactive to reattach |
| 65 | +# Use tmux kill-session -t cli-interactive when done |
| 66 | +``` |
| 67 | + |
| 68 | +**Recommended Test Queries (Non-Destructive)** |
| 69 | + |
| 70 | +```bash |
| 71 | +# Safe queries for validation: |
| 72 | +"list the main components in src/components" |
| 73 | +"what files are in the hooks directory?" |
| 74 | +"explain the purpose of MessageActionsProvider" |
| 75 | +"find all uses of useMessageActions" |
| 76 | +"what is the ChatThemeProvider used for?" |
| 77 | +"show me the keyboard handlers" |
| 78 | +``` |
| 79 | + |
| 80 | +**Pre-Deployment Validation Checklist** |
| 81 | + |
| 82 | +After major refactorings or changes, run this full validation: |
| 83 | + |
| 84 | +```bash |
| 85 | +# 1. Typecheck |
| 86 | +cd cli && bun run typecheck |
| 87 | + |
| 88 | +# 2. Run test suite |
| 89 | +bun test |
| 90 | + |
| 91 | +# 3. Build for production |
| 92 | +bun run build |
| 93 | + |
| 94 | +# 4. Verify build artifacts |
| 95 | +ls -lh dist/index.js |
| 96 | + |
| 97 | +# 5. E2E test with multiple query types (see tmux commands above) |
| 98 | + |
| 99 | +# 6. Verify UI elements: |
| 100 | +# - Borders render correctly |
| 101 | +# - Status indicators show ("working...", elapsed time) |
| 102 | +# - Agent output displays properly |
| 103 | +# - Input prompt appears at bottom |
| 104 | +# - Mode indicator (DEFAULT/MAX/etc) shows |
| 105 | + |
| 106 | +# 7. Test keyboard interactions: |
| 107 | +# - Up/Down arrow for history navigation |
| 108 | +# - Shift+Tab for mode toggle |
| 109 | +# - Escape to exit/cancel |
| 110 | +``` |
| 111 | + |
24 | 112 | ### Basic Pattern |
25 | 113 |
|
26 | 114 | ```bash |
|
0 commit comments