agentleFS
masonhuemmermasonhuemmer/dops/.claude/skills/tui-testing/SKILL.md

tui-testing

Skill3 starsChanged 8 months agoMITView on GitHub

Visual testing of TUI and CLI output using VHS and Freeze. Use when making changes to TUI views, CLI output formatting, theme styling, layout, or any visual component. Must be used after any change to View() functions, lipgloss styles, footer, sidebar, metadata, output pane, wizard overlay, or CLI error formatting.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

10 rules. About 0 are common, 6 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    After any change to visual output (TUI or CLI), verify the result using VHS or Freeze before considering the change complete.

    line 9
  2. Very specific:

    IMPORTANT: Always prefix with DOPS_NO_ALT_SCREEN=1 in VHS tapes.

    line 58
  3. Very specific:

    Always Sleep 2s after launching the TUI to let it render

    line 64
  4. Very specific:

    Write or update a .tape file targeting the changed behavior

    line 74
  5. Distinctive:

    Read the screenshot(s) to verify

    line 76
  6. Distinctive:

    If wrong, fix and repeat from step 2

    line 77
  7. Distinctive:

    Run the CLI command piped to freeze

    line 98
  8. Distinctive:

    Read the screenshot to verify

    line 99
  9. Distinctive:

    If wrong, fix and repeat

    line 100
  10. Very specific:

    Run mouse tests with: go test ./internal/tui/sidebar/ -run "Mouse" -v

    line 111

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Visual Testing with VHS and Freeze

After any change to visual output (TUI or CLI), verify the result using VHS or Freeze before considering the change complete.

When to Use Which

ToolUse For
VHSTUI testing — interactive flows, navigation, execution, wizard, multi-step sequences
FreezeCLI output testing — static command output, error formatting, config list

VHS — TUI Testing

VHS records terminal sessions from .tape scripts and produces screenshots/GIFs.

Directory structure:

  • tapes/ — tape scripts (.tape files)
  • tapes/screenshots/ — output screenshots (.png) and GIFs (.gif)

Write tapes in tapes/, output to tapes/screenshots/:

Output tapes/screenshots/test-name.gif

Set Shell "zsh"
Set Width 1200
Set Height 800
Set FontSize 14
Set Theme "Catppuccin Mocha"

Type "DOPS_NO_ALT_SCREEN=1 ./dops"
Enter
Sleep 2s

Screenshot tapes/screenshots/test-name.png

Type "q"
Sleep 500ms

Run: vhs tapes/test-name.tape

Then read the screenshot to verify the visual result matches expectations.

Key VHS commands:

  • Type "text" — type characters
  • Enter, Up, Down, Left, Right, Escape, Tab — key presses
  • Sleep 500ms / Sleep 2s — wait for rendering/execution
  • Screenshot tapes/name.png — capture current state
  • Output tapes/name.gif — set GIF output

IMPORTANT: Always prefix with DOPS_NO_ALT_SCREEN=1 in VHS tapes. The real app uses alt screen (full terminal takeover), but VHS can't capture BubbleTea v2 declarative alt screen.

Type "DOPS_NO_ALT_SCREEN=1 ./dops"

Best practices:

  • Always Sleep 2s after launching the TUI to let it render
  • Sleep 500ms after navigation for state to update
  • Sleep 2s or more after Enter that triggers script execution
  • Take screenshots at each meaningful state change
  • Name screenshots descriptively: tapes/sidebar-collapse.png, tapes/wizard-form.png
  • End tapes with Type "q" and Sleep 500ms to cleanly exit

Testing flow for TUI changes:

  1. Make the code change
  2. go build -o ./dops .
  3. Write or update a .tape file targeting the changed behavior
  4. vhs tapes/the-tape.tape
  5. Read the screenshot(s) to verify
  6. If wrong, fix and repeat from step 2

Freeze — CLI Output Testing

Freeze captures static terminal output as styled screenshots.

Usage (output to tapes/screenshots/):

./dops run unknown.runbook 2>&1 | freeze -o tapes/screenshots/cli-error.png
./dops config list 2>&1 | freeze -o tapes/screenshots/cli-config.png
./dops version 2>&1 | freeze -o tapes/screenshots/cli-version.png

With custom styling:

./dops config list 2>&1 | freeze -o tapes/screenshots/output.png --theme "Catppuccin Mocha"

Testing flow for CLI changes:

  1. Make the code change
  2. go build -o ./dops .
  3. Run the CLI command piped to freeze
  4. Read the screenshot to verify
  5. If wrong, fix and repeat

Limitations

VHS does not support mouse events. Mouse click behavior must be tested via unit tests using synthetic tea.MouseClickMsg messages. VHS can only test keyboard-driven interactions.

For mouse testing, write unit tests like:

m, cmd := m.Update(tea.MouseClickMsg{X: 5, Y: 2, Button: tea.MouseLeft})

Run mouse tests with: go test ./internal/tui/sidebar/ -run "Mouse" -v

What to Verify

After sidebar changes: collapse/expand indicators, risk badges, selection cursor, tree connectors, scrollbar, search filtering

After metadata changes: runbook name, description, risk badge color, version, ID, border alignment

After output pane changes: header background fill, command text visibility, stderr coloring, log path readability, placeholder text, scrollbar

After footer changes: keybind key colors, description text, background fill, all states (normal, wizard, running, palette)

After theme changes: border visibility, color contrast, dark/light variant selection

After layout changes: panel proportions, no dead space, responsive to window size, borders aligned

Do NOT Skip Visual Testing

Even if unit tests pass, visual bugs (invisible borders, wrong colors, layout overflow, text wrapping) are only caught by looking at the rendered output. Always verify visually after changes to view code.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.