Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

End-to-End (E2E) & Functional Testing

To ensure that releases do not introduce regressions (especially regarding terminal rendering, PTY initialization, and UI interactivity across different terminals), mantis uses a combination of automated and manual E2E/functional testing.


1. Test Dataset (e2e/data/)

A dedicated test dataset is located in the e2e/data/ directory. It contains static sample files representing different edge cases and supported file types:


2. Automated E2E Testing

Automated E2E tests are split into two parts:

A. Cargo Integration Tests (tests/e2e_tests.rs)

Runs programmatically using a simulated App state and a TestBackend to verify file parsing, encoding detection, search matching, and folding logic.

B. Whole-Binary TUI Smoke Test (scripts/ci-e2e.py)

Spawns the compiled mantis binary under a pseudo-terminal (PTY) in Python, sets the terminal size, waits for it to render the TUI screen, verifies file tree listings, and exits cleanly with a simulated q keystroke. This verifies real-world raw-mode terminal initialization.

Running Automated E2E Tests

To run all automated E2E tests locally:

just test-e2e

These tests are also run automatically in CI on every Pull Request (in ci.yml) and push to main (in main.yml).


3. Manual Testing Checklist

Run through these verification steps on your target terminals before a release:

  • Windows Terminal (PowerShell & WSL)
  • iTerm2
  • Ghostty
  • Alacritty

Launch Command

Launch mantis targeting the test dataset directory:

cargo run -- ./e2e/data

Checklist Steps

CategorySteps to ExecuteExpected Behavior
1. File Tree & NavNavigate tree with Up/Down arrows or mouse scroll wheel. Double-click or press Enter on directories.Smooth movement without cursor drift or overlaps.
2. Binary FilesSelect binary_sample.bin.Displays the binary placeholder: [binary file — BIN file, 125 B] and shows instructions.
3. JSON Pretty PrintSelect json_sample.json.The minified JSON is pretty-printed across multiple lines, highlighted, and supports folding.
4. YAML FoldingSelect yaml_sample.yml. Focus content pane (Tab). Move cursor to a parent line (e.g. production:) and press Space.The block collapses. Gutter shows folding indicators (+ / -). Scrolling is adjusted correctly.
5. Word WrapSelect long_lines.txt. Toggle word wrap via the command palette (Ctrl+P and type wrap) or by pressing its keybinding (if configured).Long lines wrap cleanly at terminal edge, line numbers align to physical lines, no horizontal scroll needed.
6. SearchSelect rust_sample.rs. Press / to open search. Type Rectangle. Press Enter. Press n/N to cycle.Selection highlights and cursor jumps to each matching keyword.
7. Status BarCheck status bar while cycling files.Correct file names, encoding (e.g., UTF-8 BOM for bom_utf8_sample.txt), line endings (CRLF for crlf_sample.txt), and syntax names.
8. Git DiffsPress Ctrl+D to enter git mode (if in git repository) or view diff history by pressing H (from the tree). Toggle side-by-side diff via the command palette.Displays diff correctly. Side-by-side mode splits left/right panels.
9. ResizingResize the terminal window while running mantis.Viewport adapts immediately without crashing or breaking layout boundary lines.