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>) -> Drive
pub fn new(backend: Rc<dyn DriveBackend>) -> Drive
A drive over backend; the engine and the mock harness build one per test.
pub fn tap(&self, id: &str) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
Sourcepub fn input(
&self,
id: &str,
text: &str,
) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn input( &self, id: &str, text: &str, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
Type text into the field, replacing what it holds.
pub fn toggle( &self, id: &str, on: bool, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn set_value( &self, id: &str, value: f64, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn select( &self, id: &str, index: usize, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn focus(&self, id: &str) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn submit( &self, id: &str, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
Sourcepub fn wait_idle(&self) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn wait_idle(&self) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
Let native transitions settle.
pub fn pause( &self, secs: f64, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
Sourcepub fn shot(
&self,
name: &str,
) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn shot( &self, name: &str, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
Capture the window as name; the capture rides the test’s record to the runner.
pub fn assert_text( &self, id: &str, text: &str, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn assert_visible( &self, id: &str, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn assert_missing( &self, id: &str, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
Sourcepub fn hover(
&self,
id: &str,
at: Option<(f64, f64)>,
) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn hover( &self, id: &str, at: Option<(f64, f64)>, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
The pointer entering id at (x, y) in its coordinates (its center for None).
Sourcepub fn hover_leave(
&self,
id: &str,
) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn hover_leave( &self, id: &str, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
The pointer leaving id.
Sourcepub fn pan(
&self,
id: &str,
dx: f64,
dy: f64,
) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn pan( &self, id: &str, dx: f64, dy: f64, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
A two-finger pan over id by (dx, dy) in total.
Sourcepub fn pinch(
&self,
id: &str,
scale: f64,
) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn pinch( &self, id: &str, scale: f64, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
A pinch over id to scale (cumulative; 1 = unchanged).
Sourcepub fn rotate(
&self,
id: &str,
rotation: f64,
) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn rotate( &self, id: &str, rotation: f64, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
A two-finger rotation over id to rotation radians (cumulative; positive clockwise).
Sourcepub fn drag(
&self,
id: &str,
from: (f64, f64),
to: (f64, f64),
) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn drag( &self, id: &str, from: (f64, f64), to: (f64, f64), ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
A pointer drag over id from from to to, in its coordinates.
Sourcepub fn tap_at(
&self,
id: &str,
x: f64,
y: f64,
) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn tap_at( &self, id: &str, x: f64, y: f64, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
A tap at (x, y) in id’s coordinates.
Sourcepub fn key(
&self,
id: Option<&str>,
key: &str,
) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn key( &self, id: Option<&str>, key: &str, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
A key press (web KeyboardEvent.key names: "Enter", "ArrowRight", "a") to id,
or to whatever holds focus for None.
Sourcepub fn assert_announced(
&self,
text: &str,
) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn assert_announced( &self, text: &str, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
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, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
Sourcepub fn assert_on(
&self,
id: &str,
on: bool,
) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn assert_on( &self, id: &str, on: bool, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
A toggle’s on/off state.
pub fn assert_focused( &self, id: &str, focused: bool, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn assert_route( &self, route: &str, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
Sourcepub fn a11y_audit(
&self,
id: Option<&str>,
) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn a11y_audit( &self, id: Option<&str>, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
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,
) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn assert_native( &self, id: &str, expect: NativeExpect, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
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,
) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn assert_frame( &self, id: &str, expect: FrameExpect, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
The element’s frame in Day’s layout and, where the toolkit reads it back, natively.
Sourcepub fn assert_size(
&self,
id: &str,
width: f64,
height: f64,
) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn assert_size( &self, id: &str, width: f64, height: f64, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
The element’s size, the common case of Drive::assert_frame.
Sourcepub fn sample_pixel(
&self,
id: &str,
x: f64,
y: f64,
color: &str,
) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn sample_pixel( &self, id: &str, x: f64, y: f64, color: &str, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
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,
) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn assert_opened_url( &self, url: &str, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
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,
) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn assert_enabled( &self, id: &str, enabled: bool, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
Whether the element takes input, in Day’s tree and in the native widget.
Sourcepub fn activate(
&self,
id: &str,
index: usize,
) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn activate( &self, id: &str, index: usize, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
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,
) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn reorder( &self, id: &str, from: usize, to: usize, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
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,
) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn delete_row( &self, id: &str, row: usize, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
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,
) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn swipe_row( &self, id: &str, row: usize, leading: bool, action: usize, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
Press the actionth swipe action on a list row’s leading or trailing edge.
Sourcepub fn scroll_to(
&self,
id: &str,
edge: &str,
) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn scroll_to( &self, id: &str, edge: &str, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
Scroll a scroll view or list to an edge: "top", "bottom", "leading", "trailing".
Sourcepub fn expand(
&self,
id: &str,
row: &str,
expanded: bool,
) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn expand( &self, id: &str, row: &str, expanded: bool, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
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>,
) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn tree_move( &self, id: &str, row: &str, parent: Option<&str>, index: Option<usize>, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
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,
) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn toolbar_press( &self, item: &str, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
Press the toolbar button item.
Sourcepub fn toolbar_toggle(
&self,
item: &str,
on: bool,
) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn toolbar_toggle( &self, item: &str, on: bool, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
Turn the toolbar toggle item on or off.
Sourcepub fn dialogs_scripted(
&self,
scripted: bool,
) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn dialogs_scripted( &self, scripted: bool, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
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>,
) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn assert_presented( &self, title: Option<&str>, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
That a dialog or picker is pending, titled title where one is given.
Sourcepub fn respond(
&self,
button: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn respond( &self, button: Option<usize>, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
Answer the pending dialog with the button at button (presentation order), or dismiss
it for None.
Sourcepub fn respond_text(
&self,
text: &str,
) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
pub fn respond_text( &self, text: &str, ) -> Pin<Box<dyn Future<Output = Result<(), Fail>>>>
Confirm a pending text prompt.
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 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