pub struct Drive { /* private fields */ }Expand description
The handle a test drives the app with. Every method awaits the op and fails the test with the step’s own message when the op fails after its retry window.
Implementations§
Source§impl Drive
impl Drive
Sourcepub fn new(backend: Rc<dyn DriveBackend>) -> Self
pub fn new(backend: Rc<dyn DriveBackend>) -> Self
A drive over backend; the engine and the mock harness build one per test.
pub fn tap(&self, id: &str) -> OpFuture
Sourcepub fn input(&self, id: &str, text: &str) -> OpFuture
pub fn input(&self, id: &str, text: &str) -> OpFuture
Type text into the field, replacing what it holds.
pub fn toggle(&self, id: &str, on: bool) -> OpFuture
pub fn set_value(&self, id: &str, value: f64) -> OpFuture
pub fn select(&self, id: &str, index: usize) -> OpFuture
pub fn focus(&self, id: &str) -> OpFuture
pub fn submit(&self, id: &str) -> OpFuture
pub fn pause(&self, secs: f64) -> OpFuture
Sourcepub fn shot(&self, name: &str) -> OpFuture
pub fn shot(&self, name: &str) -> OpFuture
Capture the window as name; the capture rides the test’s record to the runner.
pub fn assert_text(&self, id: &str, text: &str) -> OpFuture
pub fn assert_visible(&self, id: &str) -> OpFuture
pub fn assert_missing(&self, id: &str) -> OpFuture
Sourcepub fn hover(&self, id: &str, at: Option<(f64, f64)>) -> OpFuture
pub fn hover(&self, id: &str, at: Option<(f64, f64)>) -> OpFuture
The pointer entering id at (x, y) in its coordinates (its center for None).
Sourcepub fn hover_leave(&self, id: &str) -> OpFuture
pub fn hover_leave(&self, id: &str) -> OpFuture
The pointer leaving id.
Sourcepub fn pan(&self, id: &str, dx: f64, dy: f64) -> OpFuture
pub fn pan(&self, id: &str, dx: f64, dy: f64) -> OpFuture
A two-finger pan over id by (dx, dy) in total.
Sourcepub fn pinch(&self, id: &str, scale: f64) -> OpFuture
pub fn pinch(&self, id: &str, scale: f64) -> OpFuture
A pinch over id to scale (cumulative; 1 = unchanged).
Sourcepub fn rotate(&self, id: &str, rotation: f64) -> OpFuture
pub fn rotate(&self, id: &str, rotation: f64) -> OpFuture
A two-finger rotation over id to rotation radians (cumulative; positive clockwise).
Sourcepub fn drag(&self, id: &str, from: (f64, f64), to: (f64, f64)) -> OpFuture
pub fn drag(&self, id: &str, from: (f64, f64), to: (f64, f64)) -> OpFuture
A pointer drag over id from from to to, in its coordinates.
Sourcepub fn tap_at(&self, id: &str, x: f64, y: f64) -> OpFuture
pub fn tap_at(&self, id: &str, x: f64, y: f64) -> OpFuture
A tap at (x, y) in id’s coordinates.
Sourcepub fn key(&self, id: Option<&str>, key: &str) -> OpFuture
pub fn key(&self, id: Option<&str>, key: &str) -> OpFuture
A key press (web KeyboardEvent.key names: "Enter", "ArrowRight", "a") to id,
or to whatever holds focus for None.
Sourcepub fn key_phase(
&self,
id: Option<&str>,
key: &str,
phase: KeyPhase,
) -> OpFuture
pub fn key_phase( &self, id: Option<&str>, key: &str, phase: KeyPhase, ) -> OpFuture
A key in one phase of its press (KeyPhase::Repeat for auto-repeat, KeyPhase::Up
for the release) to id, or to whatever holds focus for None.
Sourcepub fn press(&self, id: &str, pressed: bool) -> OpFuture
pub fn press(&self, id: &str, pressed: bool) -> OpFuture
The pointer going down on id (pressed: true) or the press ending.
Sourcepub fn long_press(&self, id: &str) -> OpFuture
pub fn long_press(&self, id: &str) -> OpFuture
A long press on id, at its center.
Sourcepub fn double_tap(&self, id: &str) -> OpFuture
pub fn double_tap(&self, id: &str) -> OpFuture
A double tap on id, at its center.
Sourcepub fn touches(
&self,
id: &str,
points: &[(f64, f64)],
phase: TouchPhase,
) -> OpFuture
pub fn touches( &self, id: &str, points: &[(f64, f64)], phase: TouchPhase, ) -> OpFuture
Contacts on id, one per point (ids count from 0), all in phase.
Sourcepub fn fling(
&self,
id: &str,
from: (f64, f64),
to: (f64, f64),
velocity: (f64, f64),
) -> OpFuture
pub fn fling( &self, id: &str, from: (f64, f64), to: (f64, f64), velocity: (f64, f64), ) -> OpFuture
A drag over id from from to to that the platform’s recognizer released at
velocity points per second.
Sourcepub fn pointer(&self, kind: PointerKind) -> OpFuture
pub fn pointer(&self, kind: PointerKind) -> OpFuture
The kind of pointer in use changing, as the platform reports it.
Sourcepub fn drag_enter(&self, id: &str, text: &str) -> OpFuture
pub fn drag_enter(&self, id: &str, text: &str) -> OpFuture
A drag carrying text coming over id’s drop target.
Sourcepub fn drag_leave(&self, id: &str) -> OpFuture
pub fn drag_leave(&self, id: &str) -> OpFuture
The drag leaving id’s drop target without dropping.
Sourcepub fn drop_files(&self, id: &str, paths: &[&str]) -> OpFuture
pub fn drop_files(&self, id: &str, paths: &[&str]) -> OpFuture
Files (local paths) dropped on id’s drop target.
Sourcepub fn assert_announced(&self, text: &str) -> OpFuture
pub fn assert_announced(&self, text: &str) -> OpFuture
That the app announced text to the screen reader during the run.
That an element is not on screen: missing, with an empty frame, or hidden natively (a collapsed pane a toolkit keeps built).
pub fn assert_value(&self, id: &str, value: f64) -> OpFuture
pub fn assert_focused(&self, id: &str, focused: bool) -> OpFuture
pub fn assert_route(&self, route: &str) -> OpFuture
Sourcepub fn a11y_audit(&self, id: Option<&str>) -> OpFuture
pub fn a11y_audit(&self, id: Option<&str>) -> OpFuture
Diff the native accessibility tree against Day’s expectation for id (all id’d
nodes when None), where the toolkit can read its tree back.
Sourcepub fn assert_native(&self, id: &str, expect: NativeExpect) -> OpFuture
pub fn assert_native(&self, id: &str, expect: NativeExpect) -> OpFuture
The native widget’s own state, as the platform reports it (docs/testing.md). A field
the toolkit cannot read is recorded in the report as unread rather than failed. In a
conformance run assert_text, assert_value and assert_on check the native widget
too; this is for what they do not cover.
Sourcepub fn assert_frame(&self, id: &str, expect: FrameExpect) -> OpFuture
pub fn assert_frame(&self, id: &str, expect: FrameExpect) -> OpFuture
The element’s frame in Day’s layout and, where the toolkit reads it back, natively.
Sourcepub fn assert_displayed(&self, id: &str, expect: DisplayedExpect) -> OpFuture
pub fn assert_displayed(&self, id: &str, expect: DisplayedExpect) -> OpFuture
What the element shows at this moment, an animation’s in-between state included
(Toolkit::read_displayed, docs/testing.md). Read once, with no retry. A field the
toolkit cannot observe mid-flight is recorded in the report as unread rather than
failed.
Sourcepub fn assert_size(&self, id: &str, width: f64, height: f64) -> OpFuture
pub fn assert_size(&self, id: &str, width: f64, height: f64) -> OpFuture
The element’s size, the common case of Drive::assert_frame.
Sourcepub fn sample_pixel(&self, id: &str, x: f64, y: f64, color: &str) -> OpFuture
pub fn sample_pixel(&self, id: &str, x: f64, y: f64, color: &str) -> OpFuture
The color drawn at (x, y), fractions of the element’s frame, as #rrggbb. Passes as
unread where the toolkit has no capture.
Sourcepub fn assert_opened_url(&self, url: &str) -> OpFuture
pub fn assert_opened_url(&self, url: &str) -> OpFuture
That the app asked to open url (a link, day::open_url) during the run; in a run
nothing actually opens.
Sourcepub fn assert_enabled(&self, id: &str, enabled: bool) -> OpFuture
pub fn assert_enabled(&self, id: &str, enabled: bool) -> OpFuture
Whether the element takes input, in Day’s tree and in the native widget.
Sourcepub fn activate(&self, id: &str, index: usize) -> OpFuture
pub fn activate(&self, id: &str, index: usize) -> OpFuture
Activate a list’s row by position: what a double click, Return or a phone’s tap commits.
Sourcepub fn reorder(&self, id: &str, from: usize, to: usize) -> OpFuture
pub fn reorder(&self, id: &str, from: usize, to: usize) -> OpFuture
Move a list’s row from from to to, as a native drag-to-reorder commits it.
Sourcepub fn delete_row(&self, id: &str, row: usize) -> OpFuture
pub fn delete_row(&self, id: &str, row: usize) -> OpFuture
Delete a list’s row, as the platform’s delete gesture commits it.
Sourcepub fn swipe_row(
&self,
id: &str,
row: usize,
leading: bool,
action: usize,
) -> OpFuture
pub fn swipe_row( &self, id: &str, row: usize, leading: bool, action: usize, ) -> OpFuture
Press the actionth swipe action on a list row’s leading or trailing edge.
Sourcepub fn scroll_to(&self, id: &str, edge: &str) -> OpFuture
pub fn scroll_to(&self, id: &str, edge: &str) -> OpFuture
Scroll a scroll view or list to an edge: "top", "bottom", "leading", "trailing".
Sourcepub fn reveal(&self, id: &str) -> OpFuture
pub fn reveal(&self, id: &str) -> OpFuture
Reveal element id in its nearest scroll, or the list row it sits in: the dayscript
scroll_to step with no edge.
Sourcepub fn expand(&self, id: &str, row: &str, expanded: bool) -> OpFuture
pub fn expand(&self, id: &str, row: &str, expanded: bool) -> OpFuture
Expand or collapse a tree’s row, named by its row id.
Go back one page in the innermost navigation stack.
Sourcepub fn tree_move(
&self,
id: &str,
row: &str,
parent: Option<&str>,
index: Option<usize>,
) -> OpFuture
pub fn tree_move( &self, id: &str, row: &str, parent: Option<&str>, index: Option<usize>, ) -> OpFuture
Move a tree’s row (by row id) under parent (None = the root level), at index among
its new siblings (None = last), as a native drag commits it.
Choose the item labeled item from id’s context menu, as a right click (or long
press) and a choice would.
Choose an app-menu item by the id the app gave it (MenuEntry::id).
Sourcepub fn toolbar_press(&self, item: &str) -> OpFuture
pub fn toolbar_press(&self, item: &str) -> OpFuture
Press the toolbar button item.
Sourcepub fn toolbar_toggle(&self, item: &str, on: bool) -> OpFuture
pub fn toolbar_toggle(&self, item: &str, on: bool) -> OpFuture
Turn the toolbar toggle item on or off.
Sourcepub fn dialogs_scripted(&self, scripted: bool) -> OpFuture
pub fn dialogs_scripted(&self, scripted: bool) -> OpFuture
Show presentations natively (false, the default) or hold them for
Drive::respond without any native dialog (true). In native mode respond still
answers, and the toolkit dismisses the dialog it showed.
Sourcepub fn assert_presented(&self, title: Option<&str>) -> OpFuture
pub fn assert_presented(&self, title: Option<&str>) -> OpFuture
That a dialog or picker is pending, titled title where one is given.
Sourcepub fn respond(&self, button: Option<usize>) -> OpFuture
pub fn respond(&self, button: Option<usize>) -> OpFuture
Answer the pending dialog with the button at button (presentation order), or dismiss
it for None.
Sourcepub fn respond_text(&self, text: &str) -> OpFuture
pub fn respond_text(&self, text: &str) -> OpFuture
Confirm a pending text prompt.
Sourcepub fn check(&self, ok: bool, what: &str) -> TestResult
pub fn check(&self, ok: bool, what: &str) -> TestResult
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Drive
impl !Send for Drive
impl !Sync for Drive
impl !UnwindSafe for Drive
impl Forget for Drive
impl Freeze for Drive
impl Move for Drive
impl Unpin for Drive
impl UnsafeUnpin for Drive
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> 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