testutil

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StartupDelay     = 3 * time.Second
	DialogTransition = 500 * time.Millisecond
)

Timing constants for tests.

Variables

This section is empty.

Functions

func AssertAltScreen

func AssertAltScreen(t *testing.T, snap vttest.Snapshot, active bool)

AssertAltScreen checks if alternate screen is active.

func AssertCursorPosition

func AssertCursorPosition(t *testing.T, snap vttest.Snapshot, x, y int)

AssertCursorPosition checks the cursor is at the expected position.

func AssertCursorVisible

func AssertCursorVisible(t *testing.T, snap vttest.Snapshot, visible bool)

AssertCursorVisible checks the cursor visibility.

func AssertDimensions

func AssertDimensions(t *testing.T, snap vttest.Snapshot, cols, rows int)

AssertDimensions checks the terminal dimensions.

func AssertTitle

func AssertTitle(t *testing.T, snap vttest.Snapshot, title string)

AssertTitle checks the terminal title.

func ContainsText

func ContainsText(snap vttest.Snapshot, text string) bool

ContainsText checks if the terminal output contains the given text.

func CrushBinary

func CrushBinary() string

CrushBinary returns the path to the crush binary. Checks CRUSH_BINARY env var first, then falls back to ../dist/crush.

func NewIsolatedTerminal

func NewIsolatedTerminal(t *testing.T, cols, rows int) *vttest.Terminal

NewIsolatedTerminal creates a terminal with isolated config environment. Uses the default TestConfigJSON for configuration.

func NewIsolatedTerminalWithConfig

func NewIsolatedTerminalWithConfig(t *testing.T, cols, rows int, configJSON string) *vttest.Terminal

NewIsolatedTerminalWithConfig creates a terminal with isolated config environment using the provided config JSON string.

func NewIsolatedTerminalWithConfigAndEnv

func NewIsolatedTerminalWithConfigAndEnv(t *testing.T, cols, rows int, configJSON string, tmpDir string) *vttest.Terminal

NewIsolatedTerminalWithConfigAndEnv creates a terminal with isolated config environment using the provided config JSON string and a pre-created tmpDir for full control over the environment (e.g., for creating agent files before starting).

func NewTestTerminal

func NewTestTerminal(t *testing.T, args []string, cols, rows int) *vttest.Terminal

NewTestTerminal creates a new terminal running the crush binary with given args.

func RequireSnapshot

func RequireSnapshot(t *testing.T, term *vttest.Terminal, name string)

RequireSnapshot compares the terminal state against a golden JSON snapshot. Use -update flag to regenerate snapshots.

func RequireTextSnapshot

func RequireTextSnapshot(t *testing.T, term *vttest.Terminal, name string)

RequireTextSnapshot compares just the text content against a golden file. This is more lenient than full snapshot comparison - ignores colors/styles.

func SkipIfE2EDisabled

func SkipIfE2EDisabled(t *testing.T)

SkipIfE2EDisabled skips the test if E2E_SKIP is set.

func SnapshotText

func SnapshotText(snap vttest.Snapshot) string

SnapshotText returns the text content of the terminal snapshot.

func TestConfigJSON

func TestConfigJSON() string

TestConfigJSON returns the config JSON for isolated test environments.

func WaitForCondition

func WaitForCondition(t *testing.T, term *vttest.Terminal, condition func(vttest.Snapshot) bool, timeout time.Duration) bool

WaitForCondition waits for a condition on the snapshot to be true.

func WaitForText

func WaitForText(t *testing.T, term *vttest.Terminal, text string, timeout time.Duration) bool

WaitForText waits for the terminal to contain the given text.

Types

This section is empty.

Directories

Path Synopsis
Package mockllm provides a mock LLM server for E2E testing.
Package mockllm provides a mock LLM server for E2E testing.

Jump to

Keyboard shortcuts

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