Skip to content

Add regex support and negative assertions #7

Description

@gnodet

Summary

The current assertion/wait toolset has gaps that make it hard to test dynamic TUI content and verify that transient states (like loading spinners) have cleared.

Scope

1. Regex support in wait_for_text

Currently wait_for_text only does plain string matching (text in display). expect_text already supports regex patterns. For TUIs with dynamic content (timestamps, counters, IDs), regex matching on the live screen buffer would be useful.

Proposed API:

wait_for_text(text="Status: (OK|READY)", session_id="default", regex=True)

2. assert_not_contains tool

Negative assertion — verify that specific text is not present on screen. Useful for confirming error messages were cleared, dialogs were dismissed, etc.

Proposed API:

assert_not_contains(text="Error", session_id="default", use_buffer=None)

3. wait_for_text_gone tool

Wait for text to disappear from the screen buffer. Useful for testing loading states, progress indicators, and transient notifications.

Proposed API:

wait_for_text_gone(text="Loading...", session_id="default", timeout=10.0, poll_interval=0.2)

Acceptance criteria

  • All three features implemented with proper docstrings
  • Each feature has unit tests
  • README and docs updated with examples

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions