Skip to main content

LiveTestClient

Struct LiveTestClient 

Source
pub struct LiveTestClient { /* private fields */ }
Expand description

An HTTP client that drives a running Fission application for automated UI testing.

Connect to a running application via [LiveTestClient::connect(port)]. The application must have been started with FISSION_TEST_CONTROL_PORT=<port>.

§Example

let client = LiveTestClient::connect(9876);
client.wait_for_ready(5000).unwrap();
client.tap_text("Submit").unwrap();
client.assert_text_visible("Success").unwrap();
client.screenshot("/tmp/result.png").unwrap();
client.quit().unwrap();

Implementations§

Source§

impl LiveTestClient

Source

pub fn connect(port: u16) -> Self

Source

pub fn wait_for_ready(&self, timeout_ms: u64) -> Result<()>

Source

pub fn tap(&self, x: f32, y: f32) -> Result<()>

Source

pub fn tap_text(&self, text: &str) -> Result<()>

Source

pub fn drag( &self, start_x: f32, start_y: f32, end_x: f32, end_y: f32, steps: u32, ) -> Result<()>

Source

pub fn scroll(&self, x: f32, y: f32, dx: f32, dy: f32) -> Result<()>

Source

pub fn press_key(&self, key: &str, modifiers: u8) -> Result<()>

Source

pub fn type_text(&self, text: &str) -> Result<()>

Source

pub fn screenshot(&self, path: &str) -> Result<()>

Source

pub fn get_text(&self) -> Result<Vec<TextItem>>

Source

pub fn get_tree(&self) -> Result<Vec<SemanticNode>>

Source

pub fn wait(&self, ms: u64) -> Result<()>

Source

pub fn pump(&self) -> Result<()>

Source

pub fn quit(&self) -> Result<()>

Source

pub fn simulate_mouse_move(&self, x: f32, y: f32) -> Result<()>

Simulate a mouse move to (x, y) — goes through the real CursorMoved path.

Source

pub fn right_click(&self, x: f32, y: f32) -> Result<()>

Simulate a right-click at (x, y) — move + down + up with right button.

Source

pub fn simulate_resize(&self, width: u32, height: u32) -> Result<()>

Simulate a window resize in logical test-space pixels.

Source

pub fn tap_text_and_wait(&self, text: &str, ms: u64) -> Result<()>

Source

pub fn assert_text_visible(&self, needle: &str) -> Result<()>

Source

pub fn assert_text_not_visible(&self, needle: &str) -> Result<()>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.