pub struct Expect<'a, T> {
pub subject: &'a T,
pub timeout: Duration,
pub is_not: bool,
pub is_soft: bool,
pub message: Option<String>,
}Expand description
Auto-retrying assertion builder.
Fields§
§subject: &'a T§timeout: Duration§is_not: bool§is_soft: bool§message: Option<String>Implementations§
Source§impl Expect<'_, HttpResponse>
impl Expect<'_, HttpResponse>
pub fn to_be_ok(&self) -> Result<(), AssertionFailure>
Source§impl<T> Expect<'_, T>
impl<T> Expect<'_, T>
Sourcepub fn with_timeout(self, timeout: Duration) -> Expect<'_, T>
pub fn with_timeout(self, timeout: Duration) -> Expect<'_, T>
Override the timeout for this assertion.
Sourcepub fn with_message(self, msg: impl Into<String>) -> Expect<'_, T>
pub fn with_message(self, msg: impl Into<String>) -> Expect<'_, T>
Custom failure-message prefix.
Source§impl Expect<'_, Locator>
impl Expect<'_, Locator>
pub async fn to_be_visible(&self) -> Result<(), AssertionFailure>
pub async fn to_be_enabled(&self) -> Result<(), AssertionFailure>
pub async fn to_be_disabled(&self) -> Result<(), AssertionFailure>
pub async fn to_be_checked(&self) -> Result<(), AssertionFailure>
pub async fn to_be_editable(&self) -> Result<(), AssertionFailure>
pub async fn to_be_attached(&self) -> Result<(), AssertionFailure>
pub async fn to_be_empty(&self) -> Result<(), AssertionFailure>
pub async fn to_be_focused(&self) -> Result<(), AssertionFailure>
pub async fn to_be_in_viewport(&self) -> Result<(), AssertionFailure>
pub async fn to_be_in_viewport_with( &self, options: InViewportOptions, ) -> Result<(), AssertionFailure>
pub async fn to_have_text( &self, expected: impl Into<StringOrRegex>, ) -> Result<(), AssertionFailure>
pub async fn to_contain_text( &self, expected: impl Into<StringOrRegex>, ) -> Result<(), AssertionFailure>
pub async fn to_have_value( &self, expected: impl Into<StringOrRegex>, ) -> Result<(), AssertionFailure>
pub async fn to_have_values( &self, expected: &[impl AsRef<str>], ) -> Result<(), AssertionFailure>
pub async fn to_have_attribute( &self, name: &str, value: impl Into<StringOrRegex>, ) -> Result<(), AssertionFailure>
pub async fn to_have_attribute_exists( &self, name: &str, ) -> Result<(), AssertionFailure>
pub async fn to_have_class( &self, expected: impl Into<StringOrRegex>, ) -> Result<(), AssertionFailure>
pub async fn to_contain_class( &self, expected: &str, ) -> Result<(), AssertionFailure>
pub async fn to_have_css( &self, property: &str, value: impl Into<StringOrRegex>, ) -> Result<(), AssertionFailure>
pub async fn to_have_css_with( &self, property: &str, value: impl Into<StringOrRegex>, options: HaveCssOptions, ) -> Result<(), AssertionFailure>
pub async fn to_have_id( &self, expected: impl Into<StringOrRegex>, ) -> Result<(), AssertionFailure>
pub async fn to_have_role( &self, expected: impl Into<StringOrRegex>, ) -> Result<(), AssertionFailure>
pub async fn to_have_accessible_name( &self, expected: impl Into<StringOrRegex>, ) -> Result<(), AssertionFailure>
pub async fn to_have_accessible_description( &self, expected: impl Into<StringOrRegex>, ) -> Result<(), AssertionFailure>
pub async fn to_have_accessible_error_message( &self, expected: impl Into<StringOrRegex>, ) -> Result<(), AssertionFailure>
pub async fn to_have_js_property( &self, name: &str, value: Value, ) -> Result<(), AssertionFailure>
pub async fn to_have_texts( &self, expected: &[impl Into<StringOrRegex> + Clone], ) -> Result<(), AssertionFailure>
pub async fn to_contain_texts( &self, expected: &[impl AsRef<str>], ) -> Result<(), AssertionFailure>
pub async fn to_have_count( &self, expected: usize, ) -> Result<(), AssertionFailure>
Source§impl Expect<'_, Arc<Page>>
impl Expect<'_, Arc<Page>>
pub async fn to_have_title( &self, expected: impl Into<StringOrRegex>, ) -> Result<(), AssertionFailure>
pub async fn to_contain_title( &self, expected: &str, ) -> Result<(), AssertionFailure>
pub async fn to_have_url( &self, expected: impl Into<StringOrRegex>, ) -> Result<(), AssertionFailure>
pub async fn to_contain_url( &self, expected: &str, ) -> Result<(), AssertionFailure>
Trait Implementations§
Source§impl LocatorSnapshotMatchers for Expect<'_, Locator>
impl LocatorSnapshotMatchers for Expect<'_, Locator>
Source§async fn to_match_snapshot(&self, name: &str) -> Result<(), TestFailure>
async fn to_match_snapshot(&self, name: &str) -> Result<(), TestFailure>
Compare the element’s text content against a stored
.snap file.Source§async fn to_have_screenshot(&self, name: &str) -> Result<(), TestFailure>
async fn to_have_screenshot(&self, name: &str) -> Result<(), TestFailure>
Compare the element’s screenshot to a baseline PNG (default
options).
Source§async fn to_have_screenshot_with(
&self,
name: &str,
options: ScreenshotMatcherOptions,
) -> Result<(), TestFailure>
async fn to_have_screenshot_with( &self, name: &str, options: ScreenshotMatcherOptions, ) -> Result<(), TestFailure>
Playwright
toHaveScreenshot(name, options?) — full capture
option bag.Source§async fn to_match_aria_snapshot(
&self,
expected_yaml: &str,
) -> Result<(), TestFailure>
async fn to_match_aria_snapshot( &self, expected_yaml: &str, ) -> Result<(), TestFailure>
Playwright
toMatchAriaSnapshot(yaml) — compares the live ARIA
tree against the Playwright-style YAML template.Source§impl PageSnapshotMatchers for Expect<'_, Arc<Page>>
impl PageSnapshotMatchers for Expect<'_, Arc<Page>>
async fn to_have_screenshot(&self, name: &str) -> Result<(), TestFailure>
async fn to_match_aria_snapshot( &self, expected: &str, ) -> Result<(), TestFailure>
Auto Trait Implementations§
impl<'a, T> Freeze for Expect<'a, T>
impl<'a, T> RefUnwindSafe for Expect<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for Expect<'a, T>where
T: Sync,
impl<'a, T> Sync for Expect<'a, T>where
T: Sync,
impl<'a, T> Unpin for Expect<'a, T>
impl<'a, T> UnsafeUnpin for Expect<'a, T>
impl<'a, T> UnwindSafe for Expect<'a, T>where
T: RefUnwindSafe,
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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