Documentation
¶
Overview ¶
Package tuitest drives terminal programs through the in-process tui-test engine.
Index ¶
- func CloseAll() error
- func Ptr[Value any](value Value) *Value
- func Recording(session string) (string, error)
- func Sessions() ([]string, error)
- type ArtifactMode
- type ArtifactOptions
- type AutomaticRecording
- type Backend
- type BellEvent
- type Cell
- type Client
- func (client *Client) Cells(x, y, width, height uint16) ([]Cell, error)
- func (client *Client) Close(options ...CloseOptions) error
- func (client *Client) CloseQuiet() bool
- func (client *Client) ExpectBellCount(count uint64, options WaitOptions) error
- func (client *Client) ExpectExitCode(code int32, options WaitOptions) error
- func (client *Client) ExpectOutput(text string, options OutputOptions) error
- func (client *Client) ExpectSnapshot(name string, options SnapshotOptions) (SnapshotResult, error)
- func (client *Client) ExpectTitle(text string, options TitleOptions) error
- func (client *Client) GetBellCount() (uint64, error)
- func (client *Client) GetBellEvents() ([]BellEvent, error)
- func (client *Client) GetByLink(uri string, options LinkSelectorOptions) *Locator
- func (client *Client) GetByStyle(style TextStyle, options StyleSelectorOptions) *Locator
- func (client *Client) GetByText(text string, options TextSelectorOptions) *Locator
- func (client *Client) GetClipboard() (string, error)
- func (client *Client) GetCommand() (*string, error)
- func (client *Client) GetCursor() (Cursor, error)
- func (client *Client) GetCwd() (*string, error)
- func (client *Client) GetExitCode() (*int32, error)
- func (client *Client) GetOutput() (*string, error)
- func (client *Client) GetSize() (Size, error)
- func (client *Client) GetTitle() (*string, error)
- func (client *Client) GetViewport() (Viewport, error)
- func (client *Client) Kill() error
- func (client *Client) Open(options OpenOptions) (OpenResult, error)
- func (client *Client) Press(keys ...string) error
- func (client *Client) Resize(cols, rows uint16) error
- func (client *Client) Restart(values ...RestartOptions) (OpenResult, error)
- func (client *Client) Run(program string, args []string, options SpawnOptions) (OpenResult, error)
- func (client *Client) Screenshot(path string, options ScreenshotOptions) (string, error)
- func (client *Client) Scroll(lines int32) error
- func (client *Client) ScrollToBottom() error
- func (client *Client) ScrollToTop() error
- func (client *Client) Session() string
- func (client *Client) Signal(name string) error
- func (client *Client) StartRecording(path string, options RecordingOptions) error
- func (client *Client) State() (State, error)
- func (client *Client) StopRecording() (string, error)
- func (client *Client) Submit(text *string) error
- func (client *Client) Text(options TextOptions) (string, error)
- func (client *Client) Type(text string) error
- func (client *Client) WaitBell(options WaitOptions) error
- func (client *Client) WaitClipboard(options ClipboardWaitOptions) error
- func (client *Client) WaitCommand(options WaitOptions) error
- func (client *Client) WaitExit(options WaitOptions) error
- func (client *Client) WaitIdle(options WaitOptions) error
- func (client *Client) WaitReady(options WaitOptions) error
- func (client *Client) WaitTitle(text string, options TitleOptions) error
- func (client *Client) Write(data string) error
- type ClientOptions
- type ClipboardWaitOptions
- type CloseOptions
- type Color
- type Colors
- type Cursor
- type Direction
- type EffectiveTimeouts
- type Error
- type ErrorKind
- type FailureArtifactRef
- type FailureArtifactStatus
- type FailureCellMismatch
- type FailureComparison
- type FailureDetails
- type FailureLocatorDetails
- type FailureReason
- type Keyboard
- type LinkSelectorOptions
- type Locator
- func (locator *Locator) All() ([]*Locator, error)
- func (locator *Locator) And(other *Locator) (*Locator, error)
- func (locator *Locator) Any() *Locator
- func (locator *Locator) Click(options LocatorClickOptions) error
- func (locator *Locator) Count() (int, error)
- func (locator *Locator) Expect(options LocatorExpectOptions) error
- func (locator *Locator) Filter(options LocatorFilterOptions) (*Locator, error)
- func (locator *Locator) First() *Locator
- func (locator *Locator) GetByLink(uri string, options LinkSelectorOptions) *Locator
- func (locator *Locator) GetByStyle(style TextStyle, options StyleSelectorOptions) *Locator
- func (locator *Locator) GetByText(text string, options TextSelectorOptions) *Locator
- func (locator *Locator) Highlight(options WaitOptions) error
- func (locator *Locator) Last() *Locator
- func (locator *Locator) Location() (TextMatch, error)
- func (locator *Locator) Locations() ([]TextMatch, error)
- func (locator *Locator) Nth(index uint32) *Locator
- func (locator *Locator) Or(other *Locator) (*Locator, error)
- func (locator *Locator) Unique() *Locator
- func (locator *Locator) Wait(options LocatorWaitOptions) error
- type LocatorClickOptions
- type LocatorExpectOptions
- type LocatorFailureReason
- type LocatorFilterOptions
- type LocatorWaitOptions
- type Mouse
- func (mouse *Mouse) Click(options MouseClickOptions) error
- func (mouse *Mouse) Down(x, y uint16, options MouseButtonOptions) error
- func (mouse *Mouse) Drag(x1, y1, x2, y2 uint16, options MouseButtonOptions) error
- func (mouse *Mouse) Move(x, y uint16) error
- func (mouse *Mouse) Scroll(direction ScrollDirection, amount uint32) error
- func (mouse *Mouse) Up(x, y uint16, options MouseButtonOptions) error
- type MouseButton
- type MouseButtonOptions
- type MouseClickOptions
- type OpenOptions
- type OpenResult
- type OutputOptions
- type Profile
- type RecordingFormat
- type RecordingMode
- type RecordingOptions
- type RestartOptions
- type ScreenshotOptions
- type ScrollDirection
- type Shell
- type Size
- type SnapshotOptions
- type SnapshotResult
- type SpawnOptions
- type State
- type StyleSelectorOptions
- type TerminalColors
- type TextMatch
- type TextOptions
- type TextPosition
- type TextSelectorOptions
- type TextSpan
- type TextStyle
- type Timeouts
- type TitleOptions
- type TraceMode
- type TraceOptions
- type UnderlineStyle
- type Viewport
- type Visibility
- type WaitOptions
- type Whitespace
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ArtifactMode ¶
type ArtifactMode string
const ( ArtifactAll ArtifactMode = "all" ArtifactHTML ArtifactMode = "html" ArtifactText ArtifactMode = "text" ArtifactNone ArtifactMode = "none" )
type ArtifactOptions ¶
type ArtifactOptions struct {
Dir string
OnFailure ArtifactMode
IncludeRecording bool
}
type AutomaticRecording ¶
type AutomaticRecording struct {
Mode RecordingMode
Directory string
}
type Client ¶
Client is a named handle. Handles with the same name share a session and can be reused after that session closes. Its synchronous methods may run in goroutines.
func Ephemeral ¶
func Ephemeral(prefix string, options ClientOptions) (*Client, error)
Ephemeral creates a handle with a unique, filename-safe session name.
func New ¶
func New(session string, options ClientOptions) (*Client, error)
New resolves an empty session from TUI_TEST_SESSION, then "default".
func (*Client) Close ¶
func (client *Client) Close(options ...CloseOptions) error
func (*Client) CloseQuiet ¶
CloseQuiet attempts cleanup and reports success without returning diagnostics.
func (*Client) ExpectBellCount ¶
func (client *Client) ExpectBellCount(count uint64, options WaitOptions) error
func (*Client) ExpectExitCode ¶
func (client *Client) ExpectExitCode(code int32, options WaitOptions) error
func (*Client) ExpectOutput ¶
func (client *Client) ExpectOutput(text string, options OutputOptions) error
func (*Client) ExpectSnapshot ¶
func (client *Client) ExpectSnapshot(name string, options SnapshotOptions) (SnapshotResult, error)
func (*Client) ExpectTitle ¶
func (client *Client) ExpectTitle(text string, options TitleOptions) error
func (*Client) GetBellCount ¶
func (*Client) GetBellEvents ¶
func (*Client) GetByLink ¶
func (client *Client) GetByLink(uri string, options LinkSelectorOptions) *Locator
func (*Client) GetByStyle ¶
func (client *Client) GetByStyle(style TextStyle, options StyleSelectorOptions) *Locator
func (*Client) GetByText ¶
func (client *Client) GetByText(text string, options TextSelectorOptions) *Locator
func (*Client) GetClipboard ¶
func (*Client) GetCommand ¶
func (*Client) GetExitCode ¶
func (*Client) GetViewport ¶
func (*Client) Open ¶
func (client *Client) Open(options OpenOptions) (OpenResult, error)
func (*Client) Restart ¶
func (client *Client) Restart(values ...RestartOptions) (OpenResult, error)
func (*Client) Run ¶
func (client *Client) Run(program string, args []string, options SpawnOptions) (OpenResult, error)
func (*Client) Screenshot ¶
func (client *Client) Screenshot(path string, options ScreenshotOptions) (string, error)
Screenshot returns terminal text when path is empty, otherwise the written path.
func (*Client) ScrollToBottom ¶
ScrollToBottom returns to the live screen.
func (*Client) ScrollToTop ¶
ScrollToTop shows the oldest available output.
func (*Client) StartRecording ¶
func (client *Client) StartRecording(path string, options RecordingOptions) error
func (*Client) StopRecording ¶
func (*Client) WaitBell ¶
func (client *Client) WaitBell(options WaitOptions) error
func (*Client) WaitClipboard ¶
func (client *Client) WaitClipboard(options ClipboardWaitOptions) error
func (*Client) WaitCommand ¶
func (client *Client) WaitCommand(options WaitOptions) error
func (*Client) WaitExit ¶
func (client *Client) WaitExit(options WaitOptions) error
func (*Client) WaitIdle ¶
func (client *Client) WaitIdle(options WaitOptions) error
func (*Client) WaitReady ¶
func (client *Client) WaitReady(options WaitOptions) error
type ClientOptions ¶
type ClientOptions struct {
Backend Backend
Profile *Profile
Timeouts Timeouts
ScreenHistoryLimit *uint16
Recording *AutomaticRecording
Artifacts *ArtifactOptions
Trace *TraceOptions
}
type ClipboardWaitOptions ¶
type CloseOptions ¶
type CloseOptions struct{ Failed *bool }
type Color ¶
type Color string
Color is "default", a named or RGB color, or an indexed decimal color.
type EffectiveTimeouts ¶
type Error ¶
type Error struct {
Kind ErrorKind
Message string
Operation string
Details *FailureDetails
Artifact *FailureArtifactRef
}
Error retains the engine's category and diagnostic message for errors.As.
type FailureArtifactRef ¶
type FailureArtifactRef struct {
Status FailureArtifactStatus `json:"status"`
Directory string `json:"directory"`
Manifest *string `json:"manifest,omitempty"`
Report *string `json:"report,omitempty"`
ReportHTML *string `json:"report_html,omitempty"`
Timeline *string `json:"timeline,omitempty"`
ScreenText *string `json:"screen_text,omitempty"`
ScreenSVG *string `json:"screen_svg,omitempty"`
Recording *string `json:"recording,omitempty"`
Errors []string `json:"errors,omitempty"`
}
type FailureArtifactStatus ¶
type FailureArtifactStatus string
type FailureCellMismatch ¶
type FailureCellMismatch struct {
Location TextPosition `json:"location"`
Grapheme string `json:"grapheme"`
Property string `json:"property"`
Operator string `json:"operator"`
Expected string `json:"expected"`
Actual string `json:"actual"`
Resolved *string `json:"resolved,omitempty"`
Reason string `json:"reason"`
}
type FailureComparison ¶
type FailureDetails ¶
type FailureDetails struct {
SchemaVersion uint32 `json:"schema_version"`
Operation string `json:"operation"`
Reason FailureReason `json:"reason"`
Summary string `json:"summary"`
Locator *FailureLocatorDetails `json:"locator,omitempty"`
Comparison *FailureComparison `json:"comparison,omitempty"`
Truncated bool `json:"truncated"`
}
type FailureLocatorDetails ¶
type FailureLocatorDetails struct {
Reason *LocatorFailureReason `json:"reason,omitempty"`
Selectors []string `json:"selectors"`
StageIndex *uint32 `json:"stage_index,omitempty"`
Locations []TextPosition `json:"locations"`
Mismatches []FailureCellMismatch `json:"mismatches"`
}
type FailureReason ¶
type FailureReason string
type Keyboard ¶
type Keyboard struct {
// contains filtered or unexported fields
}
Keyboard sends terminal key events, including separate press and release events.
type LinkSelectorOptions ¶
type Locator ¶
type Locator struct {
// contains filtered or unexported fields
}
Locator is an immutable query, resolved against the current grid on each operation. Invalid selector options are reported when an operation resolves the locator.
func (*Locator) Click ¶
func (locator *Locator) Click(options LocatorClickOptions) error
func (*Locator) Expect ¶
func (locator *Locator) Expect(options LocatorExpectOptions) error
func (*Locator) Filter ¶
func (locator *Locator) Filter(options LocatorFilterOptions) (*Locator, error)
func (*Locator) GetByLink ¶
func (locator *Locator) GetByLink(uri string, options LinkSelectorOptions) *Locator
func (*Locator) GetByStyle ¶
func (locator *Locator) GetByStyle(style TextStyle, options StyleSelectorOptions) *Locator
func (*Locator) GetByText ¶
func (locator *Locator) GetByText(text string, options TextSelectorOptions) *Locator
func (*Locator) Highlight ¶
func (locator *Locator) Highlight(options WaitOptions) error
func (*Locator) Wait ¶
func (locator *Locator) Wait(options LocatorWaitOptions) error
type LocatorClickOptions ¶
type LocatorClickOptions struct {
MouseButtonOptions
Clicks *uint32
Timeout *time.Duration
}
type LocatorExpectOptions ¶
type LocatorFailureReason ¶
type LocatorFailureReason string
type LocatorFilterOptions ¶
type LocatorWaitOptions ¶
type LocatorWaitOptions struct {
State Visibility
Timeout *time.Duration
}
type Mouse ¶
type Mouse struct {
// contains filtered or unexported fields
}
Mouse sends coordinates in terminal cells.
func (*Mouse) Click ¶
func (mouse *Mouse) Click(options MouseClickOptions) error
type MouseButton ¶
type MouseButton string
const ( Left MouseButton = "left" Middle MouseButton = "middle" Right MouseButton = "right" )
type MouseButtonOptions ¶
type MouseButtonOptions struct {
Button MouseButton
Alt, Ctrl, Shift bool
}
type MouseClickOptions ¶
type MouseClickOptions struct {
MouseButtonOptions
X, Y *uint16
OnText *string
Clicks *uint32
}
type OpenOptions ¶
type OpenOptions struct {
SpawnOptions
Shell Shell
}
type OpenResult ¶
type OutputOptions ¶
type OutputOptions struct{ Regex bool }
type RecordingFormat ¶
type RecordingFormat string
const ( APNG RecordingFormat = "apng" GIF RecordingFormat = "gif" MP4 RecordingFormat = "mp4" Cast RecordingFormat = "cast" )
type RecordingMode ¶
type RecordingMode string
const ( RecordingDisabled RecordingMode = "disabled" RecordingOnFailure RecordingMode = "on-failure" RecordingAlways RecordingMode = "always" )
type RecordingOptions ¶
type RecordingOptions struct {
Format RecordingFormat
FPS *uint32
Speed, IdleTimeLimit, Zoom *float64
Background string
Transparent bool
}
type RestartOptions ¶
type ScreenshotOptions ¶
type ScrollDirection ¶
type ScrollDirection string
const ( Up ScrollDirection = "up" Down ScrollDirection = "down" )
type SnapshotOptions ¶
type SnapshotResult ¶
type SnapshotResult string
const ( SnapshotPassed SnapshotResult = "passed" SnapshotWritten SnapshotResult = "written" SnapshotUpdated SnapshotResult = "updated" )
type SpawnOptions ¶
type StyleSelectorOptions ¶
type TerminalColors ¶
type TextMatch ¶
type TextMatch struct {
Text string
Start, End TextPosition
Spans []TextSpan
}
type TextOptions ¶
type TextOptions struct{ Full bool }
type TextPosition ¶
type TextPosition struct{ Row, Column uint32 }
type TextSelectorOptions ¶
type TextSelectorOptions struct {
Regex, Full bool
Whitespace Whitespace
Direction Direction
}
type TextStyle ¶
type TextStyle struct {
Foreground, Background *string
Bold, Dim, Italic *bool
UnderlineStyle *UnderlineStyle
UnderlineColor *string
Inverse, Hidden, Strikethrough, Blink *bool
}
type TitleOptions ¶
type TraceOptions ¶
type UnderlineStyle ¶
type UnderlineStyle string
const ( UnderlineNone UnderlineStyle = "none" UnderlineSingle UnderlineStyle = "single" UnderlineDouble UnderlineStyle = "double" UnderlineCurly UnderlineStyle = "curly" UnderlineDotted UnderlineStyle = "dotted" UnderlineDashed UnderlineStyle = "dashed" )
type Viewport ¶
type Viewport struct{ Offset, History uint64 }
Viewport reports the rows above the live screen and the available history.
type Visibility ¶
type Visibility string
const ( Visible Visibility = "visible" Hidden Visibility = "hidden" )
type WaitOptions ¶
type Whitespace ¶
type Whitespace string
const ( Exact Whitespace = "exact" Normalize Whitespace = "normalize" )
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
smoke
command
The smoke consumer runs itself in child mode, so it needs no external shell.
|
The smoke consumer runs itself in child mode, so it needs no external shell. |
|
internal
|
|
|
native
Generated by cargo run -p tui-test-bindgen.
|
Generated by cargo run -p tui-test-bindgen. |
|
Package tuitesttest integrates terminal sessions with Go test cleanup.
|
Package tuitesttest integrates terminal sessions with Go test cleanup. |