LocatorAssertions

Struct LocatorAssertions 

Source
pub struct LocatorAssertions<'a> { /* private fields */ }
Expand description

Assertions for locators (elements).

Implementations§

Source§

impl<'a> LocatorAssertions<'a>

Source

pub fn new(locator: &'a Locator<'a>) -> Self

Create a new LocatorAssertions for the given locator.

Source

pub fn timeout(self, timeout: Duration) -> Self

Set the timeout for this assertion.

Source

pub fn negated(self) -> Self

Negate the assertion.

This is an alias for the not method to avoid conflict with std::ops::Not.

Source

pub fn not(self) -> Self

Negate the assertion.

Note: This method name shadows the Not trait’s method. Use negated() if you need to avoid this conflict.

Source

pub async fn to_be_visible(&self) -> Result<(), AssertionError>

Assert that the element is visible.

§Errors

Returns an error if the assertion fails or the element cannot be queried.

Source

pub async fn to_be_hidden(&self) -> Result<(), AssertionError>

Assert that the element is hidden.

§Errors

Returns an error if the assertion fails or the element cannot be queried.

Source

pub async fn to_have_text(&self, expected: &str) -> Result<(), AssertionError>

Assert that the element has the exact text content.

§Errors

Returns an error if the assertion fails or the element cannot be queried.

Source

pub async fn to_contain_text( &self, expected: &str, ) -> Result<(), AssertionError>

Assert that the element contains the specified text.

§Errors

Returns an error if the assertion fails or the element cannot be queried.

Source

pub async fn to_have_attribute( &self, name: &str, value: &str, ) -> Result<(), AssertionError>

Assert that the element has the specified attribute value.

§Errors

Returns an error if the assertion fails or the element cannot be queried.

Source

pub async fn to_have_class( &self, class_name: &str, ) -> Result<(), AssertionError>

Assert that the element has the specified class.

§Errors

Returns an error if the assertion fails or the element cannot be queried.

Source

pub async fn to_be_enabled(&self) -> Result<(), AssertionError>

Assert that the element is enabled.

§Errors

Returns an error if the assertion fails or the element cannot be queried.

Source

pub async fn to_be_disabled(&self) -> Result<(), AssertionError>

Assert that the element is disabled.

§Errors

Returns an error if the assertion fails or the element cannot be queried.

Source

pub async fn to_be_checked(&self) -> Result<(), AssertionError>

Assert that the element is checked (for checkboxes/radios).

§Errors

Returns an error if the assertion fails or the element cannot be queried.

Source

pub async fn to_have_value(&self, expected: &str) -> Result<(), AssertionError>

Assert that the element has the specified value (for input/textarea/select).

§Errors

Returns an error if the assertion fails or the element cannot be queried.

Source

pub async fn to_have_values( &self, expected: &[&str], ) -> Result<(), AssertionError>

Assert that a multi-select element has the specified values selected.

§Errors

Returns an error if the assertion fails or the element cannot be queried.

Source

pub async fn to_have_id(&self, expected: &str) -> Result<(), AssertionError>

Assert that the element has the specified id.

§Errors

Returns an error if the assertion fails or the element cannot be queried.

Source

pub async fn to_have_count(&self, expected: usize) -> Result<(), AssertionError>

Assert that the element has the specified count.

§Errors

Returns an error if the assertion fails or the elements cannot be counted.

Source

pub async fn to_have_count_greater_than( &self, n: usize, ) -> Result<(), AssertionError>

Assert that the element count is greater than a value.

§Errors

Returns an error if the assertion fails or the elements cannot be counted.

Source

pub async fn to_have_count_less_than( &self, n: usize, ) -> Result<(), AssertionError>

Assert that the element count is less than a value.

§Errors

Returns an error if the assertion fails or the elements cannot be counted.

Source

pub async fn to_have_count_at_least( &self, n: usize, ) -> Result<(), AssertionError>

Assert that the element count is at least a value (greater than or equal).

§Errors

Returns an error if the assertion fails or the elements cannot be counted.

Source

pub async fn to_have_count_at_most( &self, n: usize, ) -> Result<(), AssertionError>

Assert that the element count is at most a value (less than or equal).

§Errors

Returns an error if the assertion fails or the elements cannot be counted.

Source

pub async fn to_have_texts( &self, expected: &[&str], ) -> Result<(), AssertionError>

Assert that all elements have the specified texts (in order).

§Errors

Returns an error if the assertion fails or the elements cannot be queried.

Source

pub async fn to_match_aria_snapshot( &self, expected: &AriaSnapshot, ) -> Result<(), AssertionError>

Assert that the element’s ARIA snapshot matches the expected structure.

This method compares the accessibility tree of the element against an expected snapshot. The expected snapshot can contain regex patterns in name fields when enclosed in /pattern/ syntax.

§Errors

Returns an error if the assertion fails or the element cannot be queried.

Source

pub async fn to_match_aria_snapshot_yaml( &self, expected_yaml: &str, ) -> Result<(), AssertionError>

Assert that the element’s ARIA snapshot matches the expected YAML string.

This is a convenience method that parses the YAML string and delegates to to_match_aria_snapshot.

§Errors

Returns an error if the YAML parsing fails, the assertion fails, or the element cannot be queried.

Source

pub async fn to_contain_texts( &self, expected: &[&str], ) -> Result<(), AssertionError>

Assert that all elements contain the specified texts (in order).

§Errors

Returns an error if the assertion fails or the elements cannot be queried.

Source

pub async fn to_have_classes( &self, expected_classes: &[&str], ) -> Result<(), AssertionError>

Assert that the element has all specified classes.

Unlike to_have_class() which checks for a single class, this method verifies that the element has ALL specified classes.

§Errors

Returns an error if the assertion fails or the element cannot be queried.

Auto Trait Implementations§

§

impl<'a> Freeze for LocatorAssertions<'a>

§

impl<'a> !RefUnwindSafe for LocatorAssertions<'a>

§

impl<'a> Send for LocatorAssertions<'a>

§

impl<'a> Sync for LocatorAssertions<'a>

§

impl<'a> Unpin for LocatorAssertions<'a>

§

impl<'a> !UnwindSafe for LocatorAssertions<'a>

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more