Skip to content

test(pty): cover add-note keyboard actions#336

Open
benvinegar wants to merge 1 commit into
mainfrom
test/add-note-keyboard-save-cancel
Open

test(pty): cover add-note keyboard actions#336
benvinegar wants to merge 1 commit into
mainfrom
test/add-note-keyboard-save-cancel

Conversation

@benvinegar
Copy link
Copy Markdown
Member

Summary

  • add a Tuistory coverage path for clicked [+] draft notes
  • verify Esc cancels a clicked draft
  • verify Ctrl-S saves a clicked draft

Tests

  • bun test test/pty/ui-integration.test.ts -t "clicked add-note drafts can cancel and save with keyboard shortcuts"
  • bun run typecheck
  • bun run lint

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 20, 2026

Greptile Summary

Adds a PTY integration test that verifies keyboard shortcut behaviour (Esc to cancel, Ctrl-S to save) for draft notes opened by clicking the [+] affordance. The new test is modelled directly on the existing mouse-click test and reuses the same waitForSnapshot / waitForText idioms.

  • Moves the mouse to reveal [+], clicks to open a draft, types text, presses Escape, then uses waitForSnapshot (throws on timeout) to confirm the draft is dismissed and no note was persisted.
  • Repeats the flow, pressing Ctrl-S instead, and asserts that "Your note" appears containing the typed content.

Confidence Score: 5/5

Test-only change that adds keyboard-shortcut coverage for an existing UI flow; no production code is touched.

The new test faithfully mirrors the established mouse-click test pattern, uses the same waitForSnapshot-throws-on-timeout guarantee for the cancel branch, and properly asserts note content for the save branch. No logic gaps or false-positive paths were found.

No files require special attention.

Important Files Changed

Filename Overview
test/pty/ui-integration.test.ts New test covering Escape-to-cancel and Ctrl+S-to-save keyboard shortcuts for clicked draft notes; mirrors the existing mouse-click test pattern using the same waitForSnapshot/assertion structure.

Sequence Diagram

sequenceDiagram
    participant T as Test
    participant S as Session (PTY)
    participant H as Harness

    Note over T,H: Cancel flow (Escape)
    T->>S: moveMouse(8, 5)
    S-->>T: waitForText([+])
    T->>S: click([+])
    S-->>T: waitForText("Draft note")
    T->>S: type("Cancel this shortcut draft.")
    T->>S: press("escape")
    T->>H: waitForSnapshot
    H-->>T: cancelled snapshot
    T->>T: expect not "Your note"

    Note over T,H: Save flow (Ctrl+S)
    T->>S: moveMouse(8, 5)
    S-->>T: waitForText([+])
    T->>S: click([+])
    S-->>T: waitForText("Draft note")
    T->>S: type("Save this shortcut draft.")
    T->>S: press ctrl+s
    S-->>T: waitForText("Your note")
    T->>T: expect note content
Loading

Reviews (1): Last reviewed commit: "test(pty): cover add-note keyboard actio..." | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant