class
Opal::Testing::Pilot
- Opal::Testing::Pilot
- Reference
- Object
Overview
Python Textual-inspired Pilot test harness. Programmatically simulates user interactions (keystrokes, mouse gestures, resize events) against interactive TUI applications, screen hierarchies, and control engines.
Defined in:
opal/testing/pilot.crConstructors
-
.for(engine : UI::Engine, driver : Terminal::MockDriver = Terminal::MockDriver.new(80, 24)) : self
Factory method to create a Pilot for an Engine
-
.for(screen : UI::Screen, driver : Terminal::MockDriver = Terminal::MockDriver.new(80, 24)) : self
Factory method to create a Pilot for a Screen or ScreenStack
-
.for(stack : UI::ScreenStack, driver : Terminal::MockDriver = Terminal::MockDriver.new(80, 24)) : self
Factory method to create a Pilot for a ScreenStack
-
.for(prog : TEA::Program, driver : Terminal::MockDriver) : self
Factory method to create a Pilot for a TEA Program
- .new(driver : Terminal::MockDriver = Terminal::MockDriver.new(80, 24), engine : UI::Engine | Nil = nil, screen_stack : UI::ScreenStack | Nil = nil, program : TEA::Program | Nil = nil)
Instance Method Summary
-
#click(x : Int32, y : Int32, button : Terminal::MouseButton = Terminal::MouseButton::Left) : self
Simulates a mouse click at the given terminal coordinates.
-
#click(control : UI::Control) : self
Simulates clicking on a managed UI control.
- #driver : Terminal::MockDriver
- #engine : UI::Engine | Nil
- #engine=(engine : UI::Engine | Nil)
-
#hover(x : Int32, y : Int32) : self
Simulates mouse hover over the given terminal coordinates.
-
#pause(duration : Time::Span = 5.milliseconds) : self
Yields execution to let pending background fibers, timers, or animations settle.
-
#press(*keys : String) : self
Simulates pressing one or more keys in sequential order.
- #program : TEA::Program | Nil
- #program=(program : TEA::Program | Nil)
-
#resize_terminal(width : Int32, height : Int32) : self
Resizes the mock terminal and dispatches resize events.
- #screen_stack : UI::ScreenStack | Nil
- #screen_stack=(screen_stack : UI::ScreenStack | Nil)
- #scroll_down(x : Int32 = 0, y : Int32 = 0) : self
-
#scroll_up(x : Int32 = 0, y : Int32 = 0) : self
Simulates mouse scroll wheel movements.
-
#type(text : String) : self
Types a string character-by-character as synthetic key events.
-
#wait_for(timeout : Time::Span = 1.second, interval : Time::Span = 5.milliseconds, message : String = "Condition timed out waiting for Pilot assertion", &block : -> Bool) : self
Waits until the condition block evaluates to true, raising TimeoutError if duration exceeded.
-
#wait_for_idle : self
Drains any pending event queue in the mock driver.
Constructor Detail
Factory method to create a Pilot for an Engine
Factory method to create a Pilot for a Screen or ScreenStack
Factory method to create a Pilot for a ScreenStack
Factory method to create a Pilot for a TEA Program
Instance Method Detail
Simulates a mouse click at the given terminal coordinates.
Yields execution to let pending background fibers, timers, or animations settle.
Simulates pressing one or more keys in sequential order. Automatically resolves special key representations ("tab", "shift+tab", "enter", "esc", "ctrl+c", etc.).
Resizes the mock terminal and dispatches resize events.
Simulates mouse scroll wheel movements.
Waits until the condition block evaluates to true, raising TimeoutError if duration exceeded.