1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//! Automation primitives for programmatic UI interaction.
//!
//! This module provides production-capable building blocks for
//! driving plushie apps from external agents, accessibility
//! harnesses, test frameworks, or automation scripts. It is NOT
//! test-only infrastructure.
//!
//! # Key types
//!
//! - [`Selector`] identifies widgets by ID, text, role, label, or
//! focus state. Supports window-qualified IDs (`"main#save"`).
//! - [`Element`] is a typed wrapper over tree nodes with accessors
//! for text content, accessibility properties, and widget props.
//!
//! # Usage
//!
//! ```ignore
//! use plushie::automation::{Selector, Element};
//!
//! // Find a widget by role
//! let sel = Selector::role("button");
//! if let Some(elem) = sel.find(&tree).map(Element::new) {
//! println!("Found button: {:?}", elem.text());
//! }
//!
//! // Find by visible text
//! let all = Selector::text("Save").find_all(&tree);
//! ```
pub use Element;
pub use Selector;
/// Renderer backend an automation script runs against.
///
/// Mirrors the `backend:` header field parsed by
/// [`file::Header::backend`] and the equivalent routing in Elixir's
/// `Plushie.Automation.Runner`:
///
/// - [`Backend::Mock`] runs the script against a headless
/// [`crate::test::TestSession`], no renderer subprocess. Same
/// semantics as Elixir's `--mock` pool.
/// - [`Backend::Headless`] runs against a [`crate::test::TestSession`]
/// too. A real headless renderer (tiny-skia, no display server) is
/// only needed for screenshot capture; the MVU-exercise path is
/// identical to mock.
/// - [`Backend::Windowed`] spawns the real `plushie-renderer` binary
/// in windowed mode so the user can watch the script execute. The
/// runner drives the MVU loop locally and mirrors tree snapshots to
/// the renderer subprocess.