plushie/testing/helpers
Interaction helpers for test sessions.
These functions simulate user interactions by constructing the appropriate Event and dispatching it through the session’s update cycle. Each returns a new TestSession with updated state.
Values
pub fn click(
session: session.TestSession(model, event.Event),
id: String,
) -> session.TestSession(model, event.Event)
Simulate a click on a widget by ID. Dispatches WidgetClick.
pub fn display_available() -> Bool
Check whether a display server is available (DISPLAY or WAYLAND_DISPLAY). Use this to guard tests that spawn the actual plushie renderer so they skip gracefully in headless CI environments without Xvfb.
pub fn select(
session: session.TestSession(model, event.Event),
id: String,
value: String,
) -> session.TestSession(model, event.Event)
Simulate selection on a widget by ID. Dispatches WidgetSelect.
pub fn slide(
session: session.TestSession(model, event.Event),
id: String,
value: Float,
) -> session.TestSession(model, event.Event)
Simulate a slider change by ID. Dispatches WidgetSlide.
pub fn submit(
session: session.TestSession(model, event.Event),
id: String,
) -> session.TestSession(model, event.Event)
Simulate form submission on a widget by ID. Reads the current text value from the tree and dispatches WidgetSubmit.
pub fn toggle(
session: session.TestSession(model, event.Event),
id: String,
) -> session.TestSession(model, event.Event)
Simulate a checkbox/toggler toggle by ID. Reads the current value from the tree and dispatches the inverse.
pub fn type_text(
session: session.TestSession(model, event.Event),
id: String,
text: String,
) -> session.TestSession(model, event.Event)
Simulate text input on a widget by ID. Dispatches WidgetInput.