Skip to main content

Crate smix_adapter_maestro

Crate smix_adapter_maestro 

Source
Expand description

smix-adapter-maestro — Maestro YAML adapter for smix.

Parses Maestro test flow YAML and translates each Step into a smix-sdk action call. See README.md for the design rationale.

parse_flow_yaml does single-file parsing; parse_flow_file adds recursive runFlow expansion with cycle detection.

Structs§

Adapter
Stateful step dispatcher. Holds a borrow of the AppLike surface plus the current base directory for resolving relative runFlow paths. last_bundle is updated by Step::LaunchApp and consumed by Step::StopApp.
AndroidApp
Android-specific app coords.
AppEntry
Per-app platform stanzas.
AppsConfig
Top-level config shape — apps: map of logical-key → platform table.
Flow
A parsed maestro YAML flow — a sequence of Steps plus an appId header.
FlowArgs
All inputs to a single flow run.
IosApp
iOS-specific app coords.
MaskRegion
v5.5 c5 — normalized bbox for assertScreenshot.mask regions. Coordinates are 0..1 fractions of the captured screenshot; the same convention maestro’s mapping form uses. Surface-only in v5.5: the adapter parses + carries the regions but the runtime currently emits a warning and skips region exclusion (R2-tier algorithm change deferred to v6+ when SSIM/pHash replaces the dhash backbone).
RunReport
Aggregate report for one Adapter::run invocation.
SignalMatch
v0.3.0 Phase A — sub-field of Step::ExpectSignals.
StepDebugRecord
v1.0.4 — per-step trace record populated when --debug-output is set. Feeds an enriched run-summary.json and separately-written step-<N>-<verb>.tree.json on failure. See RFC 1.0.4 §D11.

Enums§

AnnotationPos
v1.0 Phase C2 — position spec for an annotation. Three shapes:
AnnotationSpec
v1.0 Phase C2 — one annotation composed onto a screenshot output. Position resolves against pixel/normalized coords or a smix Selector (adapter runtime resolves selector → pixel at screenshot time via a11y tree).
ExprValue
v5.2 c4 — yaml expression engine 的 Value 类型. 用于 Adapter::with_output seeding 调用方构造 output store. 表面 stable subset (Null / Bool / Number / String). Runtime value within the expr engine. Minimal subset (Null / Bool / Number / String) — the full serde_json value is not pulled in; a From<&serde_json::Value> blanket conversion is sufficient since the output store is BTreeMap<String, Value>.
FlowPlatform
Target platform for a flow run.
MaestroPermissionAction
v5.2 c2 — maestro yaml permissions: action 字面值. Allow → simctl grant, Deny → simctl revoke, Unset → simctl reset.
OutputFormat
Output format for smix run.
ParseError
Adapter parse / dispatch errors.
RepeatMode
v5.2 c4 — Step::Repeat mode. Parser 编译期 dispatch (yaml repeat.times xor repeat.while), runtime 无运行时分叉.
ResetAppDataWaitFor
v0.3.0 Phase A — window shape for signal await. Mirrors smix_metro_log::Window at the yaml level. Runtime translates SinceStep to Window::SinceMs using the tail’s ms cursor captured at each step-end. v1.0.14 Cluster A — completion-signal wait strategy for the resetAppData verb (URL-scheme JS-wipe). See .claude/rfcs/1.0.14-*.md §Cluster A. The runtime executor (smix-adapter-maestro) is responsible for interpreting these variants; smix-sdk owns the type so the adapter’s Step and the runtime’s dispatch stay in agreement.
ResolveError
Resolver errors.
ResolvedApp
Resolved platform-specific app identifier returned by AppsConfig::resolve.
RunError
Runtime dispatch errors.
RunStepReport
Outcome of a single Step dispatch.
SignalOrderKind
v0.3.0 Phase A — ordering semantics for Step::ExpectSignals.
SignalWindow
Sliding-window spec for expect.signal / expect.signals verbs. Selects the segment of the metro log tail that a signal search scans against. Restored above pub enum SignalWindow in v1.0.14 after the earlier ResetAppData placement shuffled its docstring.
Step
One parsed yaml step. See the maestro-compat command table in the module docs above for the yaml shapes each variant corresponds to.
TapDispatch
A maestro YAML command. Each variant corresponds to one or more smix-sdk action calls (the mapping is the c3 job — for now the enum is a structural representation of the parsed yaml node).

Traits§

AppLike
Subset of smix_sdk::App needed by Adapter::run. The blanket impl below forwards 1:1 to the real App; mock impls in tests substitute capturing recorders for unit isolation.

Functions§

parse_flow_file
Parse a maestro YAML file and recursively expand unconditional runFlow references inline.
parse_flow_yaml
Parse a maestro YAML string into a Flow.
resolve_app_into_flow
Resolve flow.app (logical key) into flow.app_id literal in place. No-op when the flow already has app_id set or no app logical key. Recursively patches embedded Step::LaunchApp { app_id } inheritors that were left blank by the parser.
run_flow
Run a flow file end-to-end. Async because runner / sdk calls are async. Returns an ExitCode suitable for direct return from main. Exit codes:
text_to_pattern
Infer a Pattern from a text body. Maestro treats | as regex alternation (mirrors maestro Kotlin TestRunner.kt / XPathSelector.kt Regex(text) semantics); plain bodies stay as case-insensitive literals. Empty bodies stay as empty Pattern::Text for explicit downstream rejection.
visible_to_selector
Convert a visible: value (scalar string or map with a selector sub-key) into a Selector.