Testing Requirements

This document defines testing requirements for the first version of YAAW - Yet Another Agent Wrapper.

The testing strategy is behavior-first. Tests should validate what a user can do and what the app visibly produces. Tests should avoid asserting private functions, implementation details, or framework-specific internals.

Requirements use:

Testing Principles

E2E Scope

E2E tests MUST cover the primary user workflows:

Full User Journey Test

The suite MUST include one high-level no-mock E2E test that navigates through the app like a real user.

This test MUST:

  1. Launch a real app build.
  2. Create or use a real temporary project directory.
  3. Initialize real files in that directory.
  4. Initialize a real Git repository when Git behavior is tested.
  5. Create a project in the app.
  6. Create a thread and choose codex when prompted.
  7. Verify the thread name matches the Codex session’s reported name, title, or id.
  8. Use the agent CLI session terminal.
  9. Close and reopen the thread.
  10. Verify reopening resumes the stored Codex session identity.
  11. Open the right panel in Files mode.
  12. Search for a file.
  13. Open a supported preview file in Browser mode.
  14. Open that file in editor mode.
  15. Switch to Git mode.
  16. Launch lazygit or git diff.
  17. Toggle the selected-thread bottom terminal.
  18. Resize or collapse panels.
  19. Archive the thread.
  20. Quit and relaunch the app.
  21. Verify durable app state is restored where required.

The full user journey test MUST NOT mock app storage, terminal surfaces, file browser behavior, or right-panel mode switching.

The full user journey test MAY skip live lazygit assertions when lazygit is not installed, but it MUST verify fallback to git diff.

The full user journey test MAY use test-safe command doubles or controlled CLI fixtures so session names and resume identities can be asserted deterministically.

Inputs And Outputs

Tests MUST be written around explicit inputs and observable outputs.

Examples of valid inputs:

Examples of valid outputs:

Tests SHOULD assert stable user-visible labels, state, and outputs rather than view hierarchy names or private object identifiers.

Screenshot Requirements

The E2E test harness MUST be able to capture screenshots.

Screenshots MUST be captured:

Screenshots SHOULD be written to a deterministic test artifact directory.

Screenshot filenames SHOULD include:

Screenshot tests MUST NOT replace behavioral assertions. They are supporting evidence for debugging and review.

Normal E2E Tests

The suite SHOULD include smaller E2E tests in addition to the full user journey.

Recommended tests:

Test Required behavior
Project creation A selected directory becomes a named project in the sidebar.
Project sidebar nesting Project rows expand and collapse to show active and archived thread history.
Project row thread creation A project-row new-thread action creates the thread under that project.
Project pin and reorder Pinned projects sort first, and manual project reorder persists.
Codex thread creation A new Codex thread appears under the selected project and gets an agent CLI session terminal.
Claude thread creation A new Claude thread appears under the selected project and gets an agent CLI session terminal.
CLI choice prompt Creating a thread asks which available CLI family to invoke.
Optional thread naming Creating a thread accepts an optional user-entered name and falls back to CLI-derived naming when blank.
Thread pinning Pinned threads sort above unpinned project threads and persist after relaunch.
Thread naming The visible thread name matches the bound CLI session name, title, or id.
Thread resume Closing and reopening a thread resumes the stored CLI session identity.
Thread switching Switching threads changes the active agent CLI session terminal and right-panel context.
Thread activity Agent helper and OSC notifications update the selected thread status, preview, unread state, focus-based read clearing, and persisted latest activity after relaunch.
Right-panel modes Files, Browser, nvim, and Git modes can be selected by icon/tab.
Right-panel shortcuts Cmd+Shift+[ and Cmd+Shift+] cycle right-panel modes.
Settings key bindings Settings exposes a searchable key binding list, edits write through to YAML, unbound actions remain unbound, and duplicate active bindings in a scope are reported.
Native shortcut defaults Cmd+,, Cmd+N, Cmd+Shift+N, Cmd+1, Cmd+2, Cmd+3, and Cmd+R route to their documented app or Settings-scope actions.
Global navigation Cmd+[ and Cmd+] move through app navigation history.
Bottom terminal Cmd+J expands and collapses the selected-thread bottom terminal.
File search Hidden files are visible and fuzzy search returns expected matches.
Browser preview Supported local preview files open in Browser mode from the file browser context menu.
Browser URL A typed URL opens inside the right panel without a separate app window.
nvim open Opening a file launches nvim in the right panel.
External open The selected project and file external-open actions use detected destinations and configured defaults without depending on real installed editors.
Git open Git mode launches lazygit or falls back to git diff.
Persistence Project/thread/agent CLI session/layout metadata survive app relaunch.

Mocking Policy

E2E tests MUST use a real app process.

E2E tests MUST use real local directories and files.

E2E tests SHOULD use real SQLite storage in an isolated test location.

E2E tests SHOULD use real embedded terminal surfaces when practical.

Mocks MAY be used only for:

Mocks MUST NOT replace the full user journey test.

Unit Test Policy

Unit tests are allowed when they are high value and input/output based.

Good unit test targets:

Poor unit test targets:

Unit tests MUST use public APIs or stable module boundaries.

Unit tests MUST assert outputs for given inputs.

Unit tests SHOULD use real temporary files and databases where that improves confidence without making the test brittle.

Test Data

Tests SHOULD create temporary project directories with deterministic content.

Recommended fixture structure:

sample-project/
  README.md
  .env.example
  package.json
  src/
    auth.ts
    index.ts
  docs/
    guide.md

Git-mode tests SHOULD initialize a real Git repository and create at least one modified file so lazygit has visible state.

Tests MUST clean up temporary files after completion unless artifacts are intentionally retained for failure investigation.

Artifacts

E2E runs MUST produce artifacts for failed tests.

Artifacts SHOULD include:

Artifacts MUST NOT include sensitive terminal output unless explicitly enabled for a local debugging run.

Acceptance Criteria