tui

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TUITestHarness

type TUITestHarness = TestHarness

func NewTUITestHarnessWithSize

func NewTUITestHarnessWithSize(t *testing.T, width, height int) *TUITestHarness

NewTUITestHarnessWithSize creates a new TUI test harness with custom screen dimensions

type TestHarness

type TestHarness struct {
	// contains filtered or unexported fields
}

TestHarness provides a test harness for TUI testing using SimulationScreen

func NewTUITestHarness

func NewTUITestHarness(t *testing.T) *TestHarness

NewTUITestHarness creates a new TUI test harness with a simulated screen

func (*TestHarness) AssertContainsText

func (h *TestHarness) AssertContainsText(expected string)

AssertContainsText asserts that the screen contains the specified text

func (*TestHarness) AssertCurrentView

func (h *TestHarness) AssertCurrentView(expected string)

AssertCurrentView asserts that the current view matches the expected view name

func (*TestHarness) AssertModalClosed

func (h *TestHarness) AssertModalClosed()

AssertModalClosed asserts that no modal is open

func (*TestHarness) AssertModalOpen

func (h *TestHarness) AssertModalOpen()

AssertModalOpen asserts that a modal is open

func (*TestHarness) AssertNotContainsText

func (h *TestHarness) AssertNotContainsText(expected string)

AssertNotContainsText asserts that the screen does not contain the specified text

func (*TestHarness) AssertWaitForText

func (h *TestHarness) AssertWaitForText(text string, timeout time.Duration)

AssertWaitForText asserts that text appears within the timeout

func (*TestHarness) Cleanup

func (h *TestHarness) Cleanup()

Cleanup stops the application and cleans up resources

func (*TestHarness) ContainsText

func (h *TestHarness) ContainsText(expected string) bool

ContainsText checks if the screen contains the specified text

func (*TestHarness) ContainsTextCaseInsensitive

func (h *TestHarness) ContainsTextCaseInsensitive(expected string) bool

ContainsTextCaseInsensitive checks if the screen contains the text (case-insensitive)

func (*TestHarness) DumpScreen

func (h *TestHarness) DumpScreen()

DumpScreen dumps the screen contents to the test log for debugging

func (*TestHarness) GetApp

func (h *TestHarness) GetApp() *app.S9s

GetApp returns the underlying app instance for advanced testing

func (*TestHarness) GetCellAt

func (h *TestHarness) GetCellAt(x, y int) (rune, tcell.Style)

GetCellAt returns the character and style at the specified position

func (*TestHarness) GetCurrentView

func (h *TestHarness) GetCurrentView() string

GetCurrentView returns the name of the current view

func (*TestHarness) GetModalName

func (h *TestHarness) GetModalName() string

GetModalName returns the name of the currently open modal

func (*TestHarness) GetScreen

func (h *TestHarness) GetScreen() tcell.SimulationScreen

GetScreen returns the simulation screen for low-level testing

func (*TestHarness) GetScreenLines

func (h *TestHarness) GetScreenLines() []string

GetScreenLines returns the screen content as a slice of lines

func (*TestHarness) GetScreenText

func (h *TestHarness) GetScreenText() string

GetScreenText returns all text on the screen as a single string

func (*TestHarness) IsCmdVisible

func (h *TestHarness) IsCmdVisible() bool

IsCmdVisible checks if the command line is visible

func (*TestHarness) IsModalOpen

func (h *TestHarness) IsModalOpen() bool

IsModalOpen checks if a modal is currently open

func (*TestHarness) SendBacktab

func (h *TestHarness) SendBacktab()

SendBacktab sends the Shift+Tab key

func (*TestHarness) SendCtrlC

func (h *TestHarness) SendCtrlC()

SendCtrlC sends Ctrl+C

func (*TestHarness) SendEnter

func (h *TestHarness) SendEnter()

SendEnter sends the Enter key

func (*TestHarness) SendEsc

func (h *TestHarness) SendEsc()

SendEsc sends the Escape key

func (*TestHarness) SendKey

func (h *TestHarness) SendKey(key tcell.Key, r rune, mod tcell.ModMask)

SendKey sends a key event to the application

func (*TestHarness) SendRune

func (h *TestHarness) SendRune(r rune)

SendRune sends a rune (character) to the application

func (*TestHarness) SendTab

func (h *TestHarness) SendTab()

SendTab sends the Tab key

func (*TestHarness) Start

func (h *TestHarness) Start()

Start starts the application in a goroutine

func (*TestHarness) String

func (h *TestHarness) String() string

String provides a string representation useful for debugging

func (*TestHarness) WaitForText

func (h *TestHarness) WaitForText(text string, timeout time.Duration) bool

WaitForText waits for the specified text to appear on screen, with a timeout

func (*TestHarness) WaitForTextToDisappear

func (h *TestHarness) WaitForTextToDisappear(text string, timeout time.Duration) bool

WaitForTextToDisappear waits for text to disappear from screen, with a timeout

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL