Skip to main content

Crate ashlar_debug

Crate ashlar_debug 

Source
Expand description

ashlar-debug: drive a running ashlar app’s UI from the shell, the way a browser automation CLI drives a web page: snapshot the UI as an outline with short refs (@e3), act on refs, wait, read values, take (annotated) screenshots, and run scripts of these as UI tests.

ashlar-debug open ./target/debug/notes        # launch with a control port, remember the session
ashlar-debug snapshot -i                      # - button "Save" [ref=e3] …
ashlar-debug click @e3
ashlar-debug fill @e2 "Groceries" --submit
ashlar-debug wait --text "Saved"
ashlar-debug screenshot --annotate            # prints the PNG's path
ashlar-debug batch ui-test.txt                # one command per line, plus `assert …` lines
ashlar-debug close

Every command is one control-protocol call (docs/control-protocol.md) over ashlar_control::Client. Human output by default, --json for one {"ok":…} line; exit codes 0 (ok), 1 (failed: the app said no, an assertion failed, nothing answers), 2 (usage).

The library is the whole CLI (run) so tests and other tools can embed it; demo is a deterministic stand-in app that answers the same methods.

Re-exports§

pub use session::Env;

Modules§

demo
A tiny app without a window that answers the debugger methods (ui.snapshot, ui.click, …) over a real control port, deterministically: ashlar-debug demo --control <port>. It is what the tests drive, and a way to try the CLI without building an app.
session
Sessions: which app successive commands talk to, kept in a small file between invocations; the control-key discovery that lets connect and --app find a running app; and open, which launches one.
target
Element targets as written on the command line, and as the control protocol takes them.
words
Words: splitting a script line like a shell does (quotes, escapes, comments) and a small argument parser (flags, options and positionals in any order).

Structs§

Io
The streams a command uses (real stdio in main, buffers in tests).

Enums§

Exit
How a command ended.

Functions§

main
main for the binary: process arguments, real stdio, the OS environment.
run
Run one invocation (args without the program name).