pub enum Step {
Show 62 variants
IdCatalog,
IdMounted,
WaitFor {
id: String,
timeout_secs: Option<f64>,
},
WaitIdle,
MemoryUsage {
fail_if_above: Option<MemorySize>,
},
MemoryWatch {
interval_ms: u64,
},
ScrollTo {
id: String,
edge: Option<String>,
x: Option<f64>,
y: Option<f64>,
},
Tap {
id: String,
if_present: bool,
repeat: Option<u32>,
at: Option<[f64; 2]>,
modifiers: Vec<String>,
},
Key {
key: String,
id: Option<String>,
modifiers: Vec<String>,
},
Drag {
id: String,
from: [f64; 2],
to: [f64; 2],
steps: Option<u32>,
modifiers: Vec<String>,
},
Hover {
id: String,
at: Option<[f64; 2]>,
leave: bool,
},
Pan {
id: String,
by: [f64; 2],
steps: Option<u32>,
},
Pinch {
id: String,
scale: f64,
steps: Option<u32>,
},
Rotate {
id: String,
rotation: f64,
steps: Option<u32>,
},
Submit {
id: String,
},
Input {
id: String,
text: Option<String>,
key: Option<String>,
args: Option<BTreeMap<String, Value>>,
},
SetValue {
id: String,
value: f64,
},
Toggle {
id: String,
value: Option<bool>,
},
Activate {
id: String,
index: usize,
},
Select {
id: String,
index: i64,
if_present: bool,
},
Reorder {
id: String,
from: usize,
to: usize,
},
Undo,
Redo,
Expand {
id: String,
row: String,
expanded: bool,
},
TreeMove {
id: String,
row: String,
parent: Option<String>,
index: Option<usize>,
},
DeleteRow {
id: String,
row: usize,
},
SwipeRow {
id: String,
row: usize,
edge: Option<String>,
action: usize,
label: Option<String>,
key: Option<String>,
},
WebEval {
id: String,
script: String,
contains: Option<String>,
text: Option<String>,
timeout_secs: Option<f64>,
},
ContextMenu {
id: String,
if_present: bool,
item_id: Option<String>,
item: Option<String>,
key: Option<String>,
path: Option<Vec<String>>,
},
Menu {
id: Option<String>,
item: Option<String>,
key: Option<String>,
path: Option<Vec<String>>,
},
Toolbar {
item: String,
text: Option<String>,
key: Option<String>,
args: Option<BTreeMap<String, Value>>,
on: Option<bool>,
index: Option<usize>,
submit: bool,
},
AssertVisible {
id: String,
},
AssertMissing {
id: String,
},
AssertHidden {
id: String,
},
AssertText {
id: String,
text: Option<String>,
key: Option<String>,
args: Option<BTreeMap<String, Value>>,
timeout_secs: Option<f64>,
},
AssertValue {
id: String,
value: Value,
},
AssertFrame {
id: String,
width: Option<f64>,
height: Option<f64>,
x: Option<f64>,
y: Option<f64>,
relative_to: Option<String>,
tolerance: Option<f64>,
},
SamplePixel {
id: String,
x: f64,
y: f64,
color: String,
tolerance: Option<u8>,
},
AssertOpenedUrl {
url: String,
},
AssertAnnounced {
text: String,
},
AssertNative {
id: String,
text: Option<String>,
number: Option<f64>,
checked: Option<bool>,
enabled: Option<bool>,
visible: Option<bool>,
},
AssertNoPlaceholders {
allow: Vec<String>,
},
CloseWindow {
window: Option<String>,
},
Screenshot {
name: String,
window: Option<String>,
in_process: bool,
},
Pause {
secs: f64,
},
DeepLink {
url: String,
},
OpenUrl {
url: String,
},
Navigate {
route: String,
},
NavBack {
native: bool,
},
AssertRoute {
route: String,
},
DialogMode {
mode: DialogMode,
},
AssertNotPresented,
AssertPresented {
title: Option<String>,
},
Respond {
button: Option<i64>,
text: Option<String>,
path: Option<String>,
dismiss: bool,
},
A11yAudit {
id: Option<String>,
},
Tests,
RunTests {
filter: Vec<String>,
shots: ShotPolicy,
timeout_secs: Option<f64>,
case_timeout_secs: Option<f64>,
},
Focus {
id: String,
focused: Option<bool>,
},
AssertFocused {
id: String,
focused: Option<bool>,
},
ExpectExit {
within: Option<f64>,
},
SizeClass {
width: String,
height: Option<String>,
},
Resize {
width: Option<f64>,
height: Option<f64>,
restore: bool,
},
}Variants§
IdCatalog
Compiled declaration registry, independent of the mounted tree.
IdMounted
Cumulative mounted families, diagnostic only.
WaitFor
Fields
WaitIdle
MemoryUsage
Sample current process memory once. Exceeding the optional byte limit is a
non-retryable failure. Host only_on/skip_on gates allow per-target budgets.
Fields
fail_if_above: Option<MemorySize>MemoryWatch
Transport control for background reporting. Zero stops the stream; otherwise sample every 100..=60000 ms. Samples are unsolicited replies, not script steps.
ScrollTo
Programmatic scroll (docs/scroll.md §dayscript). With edge/x+y, id must name a
scroll piece; with neither, id names any element and its nearest enclosing scroll
reveals it. Unanimated, so the next step sees the settled position.
Native navigation menus also accept top/bottom on UIKit and Material.
Fields
Tap
Fields
if_present: boolSkip an absent element after UI transitions settle. Intended for idempotent fixture cleanup; existing elements still pass the visibility/enabled gates.
Key
A non-text key press, delivered the way the platform delivers one: to whatever holds
focus (- focus: { id: canvas } then - key: { key: ArrowRight, modifiers: [shift] },
docs/menus.md). Names follow the web KeyboardEvent.key vocabulary. On a piece that
took the full route (Decorate::keyboard) a name outside that vocabulary, pressed
with nothing but Shift, types: key: a arrives as the text “a”, the way a real press
does, and modifiers: [control] is the physical Control key of a chord, which types
nothing.
Fields
Drag
A synthetic pointer drag over one element, in its own coordinate space: Began at
from, a few Changed samples along the segment, Ended at to, the same
Event::Drag stream a native recognizer delivers, so .on_drag state machines
(canvas move/resize) run their whole preview→commit path. Injected, like every
dayscript step: green here says the app logic holds, not that the platform recognizer
fires; verify that with real input (docs/agent.md).
Fields
modifiers: Vec<String>Modifier keys “held” for the whole drag, named as in Step::Tap, for gestures
whose meaning they change (a shift-drag that adds to a selection rather than
replacing it). They stand in for every phase, press through release, because that
is how a real drag reads them: once, when it starts.
Hover
A synthetic pointer hover over one element (.on_hover, docs/canvas.md “Interaction”):
the pointer enters at at (element coordinates; the center when omitted), or, with
leave: true, leaves. Injected, like Step::Drag.
Pan
A synthetic two-finger pan over one element (.on_pan, docs/shapes.md): Began, a few
Changed samples whose deltas add up to by, Ended. Injected, like Step::Drag.
Pinch
A synthetic pinch over one element (.on_pinch, docs/shapes.md): Began at scale 1,
Changed samples toward scale, Ended at scale (cumulative, as the platforms
report it), centered on the element. Injected, like Step::Drag.
Rotate
A synthetic two-finger rotation over one element (.on_rotate, docs/canvas.md):
Began at 0, Changed samples toward rotation (radians, positive clockwise),
Ended at rotation (cumulative, as the platforms report it), centered on the
element. Injected, like Step::Drag.
Submit
Deliver Event::Submitted to the element: the scripted stand-in for the platform’s
submit gesture (Enter in a text_area with .on_submit, a field’s return key).
Input
Fields
SetValue
Toggle
Activate
Invoke a list row without changing selection. Out-of-range indices are ignored.
Select
Fields
Reorder
Drag-reorder a list row programmatically: row from drops at row to through the same
guard → commit path a native drag takes (docs/list.md); the app’s reorder_guard may
deny or retarget it. Fails (non-retryably) when the list isn’t .reorderable() or the
guard denies the move.
Undo
Undo one unit of the app’s history, through the installed undo bridge, the same handler ⌘Z and the Edit menu reach (docs/model.md). Portable: it needs no undo button and no scriptable menu item on the target. Fails (non-retryably) when the app never installed an undo stack.
Redo
Redo one unit, Step::Undo’s mirror.
Expand
Disclose or collapse a tree row programmatically (docs/tree.md). The row is resolved
by its .row_id string; the step emits the same Event::TreeExpanded a native
disclosure does, so the piece’s expansion signal (and through it the native row)
follows. Retryable while the row id is unknown (a pending reload may still produce it).
TreeMove
Move a tree row programmatically: row lands under parent (absent = the root) at
index (absent = dropped onto the parent, i.e. append), through the same guard → commit
path a native drag takes (docs/tree.md). Fails (non-retryably) when the tree isn’t
.movable() or a guard (structural or the app’s) denies the move.
DeleteRow
Delete a list row programmatically: row row goes through the same guard → commit path
a native swipe takes (docs/list.md); the app’s delete_guard may refuse it. Fails
(non-retryably) when the list isn’t .deletable() or the guard refuses.
This is how a walkthrough asserts deletion on every target, including the desktops whose
toolkits answer Cap::ListDelete = Unsupported and have no gesture to simulate: the step
drives the guard → commit path, not the platform’s gesture recognizer.
SwipeRow
Activate a list row’s swipe action programmatically: pull row row’s offer for edge
(trailing, the default, or leading) and run action action (an index into the
offer, default 0, the one a native full swipe activates), through the same
offer → commit path a native gesture takes (docs/list.md). label: (literal) or
key: (a Fluent key resolved in the run’s locale) pins which button may be pressed.
Offers are state-dependent (“Mark as Read” vs “Mark as Unread”), and the pin is
checked before the press: a mismatched offer refuses the activation and fails the
step with the row’s state untouched, so a stale pin (leftover state from an aborted
earlier run) fails once instead of flipping state and poisoning every later run.
Fails (non-retryably) when the list offers no swipe actions or the row’s offer has
no such action.
This is how a walkthrough exercises swipe actions on every target, including the
toolkits that answer Cap::ListSwipeActions = Unsupported and show no affordance:
the step drives the offer → commit path, not the platform’s gesture recognizer.
Fields
WebEval
Evaluate JavaScript in a web view node and assert on the result
(docs/webview-eval.md), the step that proves a page rendered, where
assert_visible only proves the native view exists. script runs in the page;
its value (a string compares as itself, anything else as its JSON) must contain
contains: and/or equal text:; with neither, a successful evaluation alone
passes. Retryable while the reply is pending, the script throws, or the assertion
mismatches (a page mid-load settles within the wait); fails non-retryably when the
id names no web view or no webview piece is linked. Only meaningful where the
backend’s eval arm exists (eval_support(); docs/webview-eval.md keeps the list);
elsewhere the step fails after the wait, so gate it with only_on:.
Fields
ContextMenu
Invoke an app-menu item programmatically (docs/menus.md): match a unique Action
leaf in the installed app-menu model by exact item label, or by key, a Fluent
key resolved in the run’s locale (locale-portable; a standard-role item also
matches its role’s core-catalog key, so the auto Preferences item is
key: day_preferences). path disambiguates with ancestor submenu labels (suffix
match). Items that run a native selector instead of a day action (role items with
id 0) are not invokable this way.
Choose an item from an element’s context menu (.context_menu, .context_menu_fn;
docs/menus.md), as a right click or long press followed by a choice would. id names the
element; the item is addressed as Step::Menu addresses one: item_id: (the name the
app gave it), item: (the literal label) or key:, with path for submenus. A
provider menu is asked at the element’s origin.
Fields
Menu
Choose an app-menu item. Address it by id: (the name the app gave it with
MenuEntry::id) in preference to anything else: a label is localized, and an item that
shows a check mark rewrites its label as the state moves, so neither is a stable
address. item: matches the literal label, key: a built-in role key (day_copy) or a
Fluent key resolved in the run’s locale.
Toolbar
Drive a window-toolbar item by its id (docs/toolbars.md). With neither text: nor
on: this runs a button’s command; text: types into a search item; on: sets a
toggle. Each goes through the same dispatch the native control fires, so it exercises
the app’s wiring; it does not prove the native widget drew (a screenshot does). With
submit: true a search item’s text is then submitted, as its Return or Search key does.
Fields
key: Option<String>Localized alternative to text, exactly as Step::Input takes one: resolve this
Fluent key (with args) in the run’s locale and type the result. A toolbar search
field that filters on localized text needs this: a literal query written in English
matches nothing once the run switches locale.
AssertVisible
AssertMissing
Fail if the id is in the tree: the assertion for a subtree a when has not mounted
(a property row that does not apply, a page’s absent chrome). assert_visible cannot
say this: a missing id is an error there, and an error is not a pass.
AssertHidden
Fail if the element is on screen: pass when it is missing, has an empty frame, or its
native widget reports itself hidden. For what a toolkit hides rather than removes (a
collapsed pane, a closed popover), where assert_missing would see it present.
AssertText
Fields
AssertValue
AssertFrame
Check an element’s frame (docs/testing.md): its size, and its origin relative to
relative_to’s (or to the window content when absent), in points, within tolerance
(default 1). Day’s layout must match, and so must the native widget’s frame where the
toolkit reads it back; where it cannot, the reply’s data lists the frame as unread.
Fields
SamplePixel
Check the color of one point of an element in an in-process capture (docs/testing.md).
x and y are fractions of the element’s frame (0.5, 0.5 is its center); color is
#rrggbb, matched per channel within tolerance (default 64 of 255, which absorbs color
management, such as a Display P3 capture reading sRGB red as #ea3323, and antialiasing,
but not a different color). A toolkit with no capture
(Cap::Snapshot unsupported) passes it as unread.
AssertOpenedUrl
Check that the app asked to open url during this test run (docs/testing.md). While
run_tests runs, open_url records instead of opening anything.
AssertAnnounced
Check that the app announced text to the screen reader during this test run
(day::announce, docs/accessibility.md). The announcement still reaches the toolkit.
AssertNative
Compare the NATIVE widget with what is expected (docs/testing.md): the state the
platform reports through Toolkit::read_native, not Day’s tree. Only the fields given
are checked. A field the toolkit cannot read passes and is listed as unread in the
reply’s data, so a gap is recorded rather than hidden. enabled is also checked
against Day’s own state, so a disagreement between the two fails either way.
Fields
AssertNoPlaceholders
Fail if any piece kind rendered a ⟨kind⟩ placeholder, i.e. the backend had no renderer
for it. Placeholders are invisible to every other assertion (the app still renders, the
screenshot still looks plausible), so this is the only step that catches a missing or
silently-dropped renderer. allow lists the kinds a target is expected to lack, which
makes the script itself the per-target gap ledger; anything outside it is a failure.
CloseWindow
Close the secondary window opened under window (day::open_window‘s key;
the preferences window is day.preferences), through the same async confirm →
teardown path a title-bar close takes (docs/windows.md; on the cover-fallback tier
this dismisses the cover). An already-closed window is a success (closing is
idempotent). With no window, the app’s initial window, whose close ends the app
(docs/windows.md close policy), so follow it with expect_exit. GTK routes that close
through the title bar’s path today; the other desktop toolkits’ close_window duties
still look only at secondary windows, so there the step is a no-op and expect_exit
times out.
Screenshot
Fields
window: Option<String>Capture the secondary window opened under this key (day::open_window’s key)
instead of the primary (docs/windows.md). On the cover-fallback tier the key
resolves to the primary window, whose fullscreen cover is the content: the same
pixels, no special case. A missing key fails retryably (the window may still be
opening).
in_process: boolWhether the reply carries the engine’s capture (png_base64).
On a device target the runner captures through simctl/adb and that image
(whole screen, system chrome and all) is what the gallery publishes, so a payload
rendered here would be encoded, shipped over the socket and dropped on the floor.
Measured at 819ms per shot on the iOS simulator (33.6s across one walkthrough
variant, ~4.5 minutes across a CI job’s eight), so the runner asks for it only
where it will be used, and re-asks with this set if the device capture fails.
Defaults to true: an older runner, day drive, or a hand-written step says
nothing and still gets the image. The idle wait above happens either way; it is
what makes a capture land on a settled frame, not an artifact of the encoding.
Pause
DeepLink
Deliver a deep-link URL in-process (docs/deep-links.md): the URL maps to its route
through the same day_spec::route_of_url every platform intake uses, then navigates,
identical to a warm OS delivery. Proves routing, params, and back-stack seeding on
every backend, including mock; OS registration and intake are the runner tier’s job.
OpenUrl
Deliver an original external URL to on_open_url (with normal routing fallback).
Navigate to a registered route (reset-to semantics; “” = root). docs/navigation.md.
Pop one navigation level. Bare, it is Day’s own rail (day_core::nav_back), which pops
the model and lets the backend follow. native: true presses the platform’s back
affordance instead (Toolkit::native_back): the bar’s shouldPop, the dispatcher’s
callbacks, the native pop, then the backend’s report of it to Day as a user back, which
is the code a real tap runs and the bare step never reaches (docs/navigation.md).
AssertRoute
Assert the current route path (“” = root).
DialogMode
Select presentation behavior for subsequent Day dialogs and file pickers. Existing requests must be answered before switching.
Fields
mode: DialogModeAssertNotPresented
Assert that no Day presentation requests remain unanswered.
AssertPresented
Assert a presentation is pending (native or scripted), optionally checking its title.
Respond
Answer the open modal: a button index, a prompt text, a file path (open/save
pickers; relative paths resolve against the app temp dir, writable on every target), or
dismiss.
A11yAudit
Diff the native accessibility tree against Day’s expectations (role/label/value/identifier)
for every id’d node, or just id (§13, §14.2). Backends that can’t read their native tree
(found = false) are skipped; role is only compared when both sides map to a known Role.
Tests
List the #[day::test] cases the binary registers (docs/testing.md); the reply’s
data is the listing.
RunTests
Run the registered tests whose names match filter (globs; empty = all), keeping
captures per shots. Retryable while the run is in progress, so the runner’s wait loop
polls it; timeout_secs bounds the whole run, case_timeout_secs each case. The
reply’s data is the report.
Fields
shots: ShotPolicyFocus
Move native focus to the control: the real Toolkit duty, not a synthetic event, so
keyboards and end-editing flows engage (docs/focus.md). focused: false resigns it.
AssertFocused
Assert the control’s focus state as Day resolved it (NodeProbe.focused; retryable, since
focus lands a turn after the request). focused defaults to true.
ExpectExit
Expect the app to terminate: the only step that tolerates the app dying (docs/break.md’s
crash-reporting flow, docs/agent.md). Must be the last step: a preceding step triggered an
exit or crash, and expect_exit treats the connection dropping within within
seconds (default 15) as success; the app surviving the window is the failure. Handled
runner-side (day-cli), so the in-app engine never executes it; this arm is defensive.
SizeClass
Force the window’s size class (docs/size-classes.md) without resizing anything: the
cheap way to drive a responsive layout on a backend whose window cannot be resized from a
script (the phones, an emulator). width is compact | medium | expanded | large |
extra-large; height is compact | medium | expanded and defaults to expanded.
This reports a class the way a backend would, so everything downstream (an automatic
nav host re-presenting, a piece that lays out from day::size_class()) runs its real
path. What it does not do is change the window’s actual pixels: a screenshot after this
step shows the new layout at the old size. Drive a real resize from the runner instead
(Playwright’s setViewportSize on web, the simulator’s rotation on iOS) when the
geometry itself is what’s under test.
width: auto releases the override and restores the class the window itself reports, so
the steps after an adaptive sweep run at the device’s real geometry again. A script that
forces expanded and never lets go leaves a phone laying out a split whose detail pane
falls off the screen: the layout is correct, the window just isn’t that wide.
Resize
Change the window’s actual geometry, and wait until the app has reported the new size (docs/size-classes.md). The runner performs the resize (a device’s window belongs to the system, not to the app) and this half is the barrier: without it the next step races the platform’s resize animation.
size_class:’s complement, and the difference matters: that step reports a class the
window is not actually at, so a screenshot after it shows the new layout at the old size.
This one moves the pixels.
Implementations§
Source§impl Step
impl Step
Sourcepub fn element_references(&self) -> Vec<String>
pub fn element_references(&self) -> Vec<String>
Element references only: model row keys, routes, strings and screenshot names are intentionally excluded. Secondary geometry references are validated, not credited.
pub fn evidence_class(&self) -> Option<EvidenceClass>
Source§impl Step
impl Step
Sourcepub fn wait_budget_secs(&self) -> f64
pub fn wait_budget_secs(&self) -> f64
The implicit-wait budget for this step, seconds: its own timeout_secs when declared
(and positive), else the shared DEFAULT_TIMEOUT_SECS.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Step
impl<'de> Deserialize<'de> for Step
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Step, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Step, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for Step
impl Serialize for Step
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Step
Auto Trait Implementations§
impl Forget for Step
impl Freeze for Step
impl RefUnwindSafe for Step
impl Send for Step
impl Sync for Step
impl Unpin for Step
impl UnsafeUnpin for Step
impl UnwindSafe for Step
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more