Ruby testing for Zaniah
Drive the interface. Assert what users see.
Syrma locates rendered elements, sends input through Zaniah’s real event path, waits for redraws, and compares the result—from text and trees to pixels and screenshots.
# Mount the real interface
zaniah_session(width: 480, height: 320) do |window|
Editor.mount(window)
end
ui.test_id("document").type("Hello")
ui.button("Save").click
assert_ui_text "Saved"
assert_tree_snapshot "editor"
A test follows the same path as a user.
No private callbacks. No skipped frames. The assertion begins with the rendered interface and ends with its observable output.
-
Locate
Resolve text, role, test ID, or a nested query against the latest frame.
-
Act
Click, type, drag, scroll, paste, or compose through
Window#input. -
Settle
Wait for redraws and advance a session-scoped virtual clock when timing matters.
-
Inspect
Assert text, trees, terminal output, pixels, screenshots, menus, and tooltips.
Observe the whole surface.
Start with semantic assertions. Reach for snapshots and pixels only when the visual result is the behavior under test.
-
Structure
Rendered text, element trees, visibility, clickability, and backgrounds.
-
Interaction
Pointer, keyboard, IME composition, clipboard, file drop, scroll, and resize.
-
Visuals
Deterministic text rendering, pixel checks, regions, masks, and image snapshots.
-
Diagnostics
Screenshots, hit regions, text runs, recent events, and a focused failure summary.
Start with one test.
Add Syrma beside your test framework, mount the same UI your application runs, then interact with it.
View the gem on RubyGemsgroup :test do
gem "minitest", "~> 5.0"
gem "syrma"
end
Failures leave evidence.
When a UI test fails, Syrma writes the frame, element tree, hit regions, text runs, and recent events below tmp/syrma. Missing snapshot goldens fail on CI instead of being accepted silently.
Ruby 3.1+
Minitest and RSpec
Zaniah ~> 0.2.0
Test the interface you ship.
Syrma is open source under the MIT License.