Skip to main content

Harness

Struct Harness 

Source
pub struct Harness { /* private fields */ }

Implementations§

Source§

impl Harness

Source

pub fn enable_trace(&mut self, enabled: bool)

Source

pub fn take_trace_logs(&mut self) -> Vec<String>

Source§

impl Harness

Source

pub fn from_html(html: &str) -> Result<Self>

Source

pub fn from_html_with_url(url: &str, html: &str) -> Result<Self>

Source

pub fn from_html_with_local_storage( html: &str, initial_local_storage: &[(&str, &str)], ) -> Result<Self>

Source

pub fn from_html_with_url_and_local_storage( url: &str, html: &str, initial_local_storage: &[(&str, &str)], ) -> Result<Self>

Source§

impl Harness

Source

pub fn assert_text(&self, selector: &str, expected: &str) -> Result<()>

Source

pub fn assert_value(&self, selector: &str, expected: &str) -> Result<()>

Source

pub fn assert_checked(&self, selector: &str, expected: bool) -> Result<()>

Source

pub fn assert_exists(&self, selector: &str) -> Result<()>

Source

pub fn dump_dom(&self, selector: &str) -> Result<String>

Source§

impl Harness

Source

pub fn now_ms(&self) -> i64

Source

pub fn clear_timer(&mut self, timer_id: i64) -> bool

Source

pub fn clear_all_timers(&mut self) -> usize

Source

pub fn pending_timers(&self) -> Vec<PendingTimer>

Source

pub fn advance_time(&mut self, delta_ms: i64) -> Result<()>

Source

pub fn advance_time_to(&mut self, target_ms: i64) -> Result<()>

Source

pub fn flush(&mut self) -> Result<()>

Source

pub fn run_next_timer(&mut self) -> Result<bool>

Source

pub fn run_next_due_timer(&mut self) -> Result<bool>

Source

pub fn run_due_timers(&mut self) -> Result<usize>

Source§

impl Harness

Source

pub fn set_trace_stderr(&mut self, enabled: bool)

Source

pub fn set_trace_events(&mut self, enabled: bool)

Source

pub fn set_trace_timers(&mut self, enabled: bool)

Source

pub fn set_trace_log_limit(&mut self, max_entries: usize) -> Result<()>

Source

pub fn set_random_seed(&mut self, seed: u64)

Source

pub fn set_fetch_mock(&mut self, url: &str, body: &str)

Source

pub fn set_fetch_mock_response(&mut self, url: &str, status: i64, body: &str)

Source

pub fn set_clipboard_text(&mut self, text: &str)

Source

pub fn clipboard_text(&self) -> String

Source

pub fn set_clipboard_read_error(&mut self, error: Option<&str>)

Source

pub fn set_clipboard_write_error(&mut self, error: Option<&str>)

Source

pub fn clear_clipboard_errors(&mut self)

Source

pub fn set_location_mock_page(&mut self, url: &str, html: &str)

Source

pub fn clear_location_mock_pages(&mut self)

Source

pub fn take_location_navigations(&mut self) -> Vec<LocationNavigation>

Source

pub fn take_downloads(&mut self) -> Vec<DownloadArtifact>

Source

pub fn take_clipboard_writes(&mut self) -> Vec<ClipboardWriteArtifact>

Source

pub fn location_reload_count(&self) -> usize

Source

pub fn clear_fetch_mocks(&mut self)

Source

pub fn take_fetch_calls(&mut self) -> Vec<String>

Source

pub fn set_match_media_mock(&mut self, query: &str, matches: bool)

Source

pub fn clear_match_media_mocks(&mut self)

Source

pub fn set_default_match_media_matches(&mut self, matches: bool)

Source

pub fn take_match_media_calls(&mut self) -> Vec<String>

Source

pub fn enqueue_confirm_response(&mut self, accepted: bool)

Source

pub fn set_default_confirm_response(&mut self, accepted: bool)

Source

pub fn enqueue_prompt_response(&mut self, value: Option<&str>)

Source

pub fn set_default_prompt_response(&mut self, value: Option<&str>)

Source

pub fn take_alert_messages(&mut self) -> Vec<String>

Source

pub fn take_print_call_count(&mut self) -> usize

Source

pub fn set_timer_step_limit(&mut self, max_steps: usize) -> Result<()>

Source§

impl Harness

Source

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

Source

pub fn set_select_value(&mut self, selector: &str, value: &str) -> Result<()>

Source

pub fn set_input_files( &mut self, selector: &str, files: &[MockFile], ) -> Result<()>

Source

pub fn set_checked(&mut self, selector: &str, checked: bool) -> Result<()>

Source

pub fn click(&mut self, selector: &str) -> Result<()>

Source

pub fn focus(&mut self, selector: &str) -> Result<()>

Source

pub fn blur(&mut self, selector: &str) -> Result<()>

Source

pub fn press_enter(&mut self, selector: &str) -> Result<()>

Source

pub fn copy(&mut self, selector: &str) -> Result<()>

Source

pub fn paste(&mut self, selector: &str) -> Result<()>

Source

pub fn submit(&mut self, selector: &str) -> Result<()>

Source

pub fn dispatch(&mut self, selector: &str, event: &str) -> Result<()>

Source

pub fn dispatch_keyboard( &mut self, selector: &str, event: &str, init: KeyboardEventInit, ) -> Result<()>

Trait Implementations§

Source§

impl Debug for Harness

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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.