class

Tui::Testing::Harness

Inherits Reference / Object

Test harness for running TUI apps in headless mode

Constructors

new(app : App, width : Int32 = 80, height : Int32 = 24)
Source

Instance methods

alt(char : Char) : Nil

Send Alt+key

Source
buffer
Source
cell(x : Int32, y : Int32) : Cell

Get content of specific cell

Source
click(x : Int32, y : Int32, button : MouseButton = MouseButton::Left) : Nil

Send mouse click

Source
ctrl(char : Char) : Nil

Send Ctrl+key

Source
debug_dump

Debug dump of current screen

Source
find_text(text : String) : Tuple(Int32, Int32) | Nil

Find text position (returns first match or nil)

Source
has_text?(text : String) : Bool

Check if text is present on screen

Source
height
Source
mock_input
Source
press(key : Key, modifiers : Modifiers = Modifiers::None) : Nil

Send a key press

Source
render

Render current state to buffer

Source
render_grid

Render and return as grid of strings

Source
render_text

Render and return as single string

Source
resize(width : Int32, height : Int32) : Nil

Resize the test screen

Source
row(y : Int32) : String

Get content of a specific row

Source
save_ansi(path : String) : Nil

Save ANSI screenshot

Source
save_screenshots(path : String) : Nil

Save all screenshots to a file

Source
screenshot(label : String = "") : String

Take a screenshot (save current render to screenshots array)

Source
screenshots
Source
scroll_down(x : Int32 = 0, y : Int32 = 0, amount : Int32 = 1) : Nil
Source
scroll_up(x : Int32 = 0, y : Int32 = 0, amount : Int32 = 1) : Nil

Send mouse wheel

Source
type(char : Char, modifiers : Modifiers = Modifiers::None) : Nil

Send a character

Source
type_string(str : String) : Nil

Send a string (multiple characters)

Source
width
Source