pub struct LocatorAssertions { /* private fields */ }Implementations§
Source§impl LocatorAssertions
impl LocatorAssertions
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Builder: override the assertion timeout.
Sourcepub fn set_timeout(&mut self, timeout: Duration) -> &mut Self
pub fn set_timeout(&mut self, timeout: Duration) -> &mut Self
Override the assertion timeout in place.
pub async fn to_be_visible(&self) -> Result<()>
pub async fn to_be_enabled(&self) -> Result<()>
pub async fn to_be_disabled(&self) -> Result<()>
pub async fn to_be_editable(&self) -> Result<()>
pub async fn to_be_checked(&self) -> Result<()>
pub async fn to_be_unchecked(&self) -> Result<()>
Sourcepub async fn to_have_text(&self, expected: &str) -> Result<()>
pub async fn to_have_text(&self, expected: &str) -> Result<()>
Assert the element’s trimmed textContent equals expected.
Sourcepub async fn to_contain_text(&self, expected: &str) -> Result<()>
pub async fn to_contain_text(&self, expected: &str) -> Result<()>
Assert the element’s trimmed textContent contains expected.
Sourcepub async fn to_have_inner_text(&self, expected: &str) -> Result<()>
pub async fn to_have_inner_text(&self, expected: &str) -> Result<()>
Assert the element’s innerText equals expected.
Sourcepub async fn to_have_text_regex(&self, pattern: &str) -> Result<()>
pub async fn to_have_text_regex(&self, pattern: &str) -> Result<()>
Assert the element’s trimmed textContent matches the regex pattern.
Sourcepub async fn to_contain_text_regex(&self, pattern: &str) -> Result<()>
pub async fn to_contain_text_regex(&self, pattern: &str) -> Result<()>
Assert the element’s textContent matches the regex pattern (no trim).
Sourcepub async fn to_have_inner_text_regex(&self, pattern: &str) -> Result<()>
pub async fn to_have_inner_text_regex(&self, pattern: &str) -> Result<()>
Assert the element’s innerText matches the regex pattern.
Sourcepub async fn to_have_count(&self, expected: usize) -> Result<()>
pub async fn to_have_count(&self, expected: usize) -> Result<()>
Assert the number of matching elements equals expected.
Sourcepub async fn to_have_attribute(&self, name: &str, value: &str) -> Result<()>
pub async fn to_have_attribute(&self, name: &str, value: &str) -> Result<()>
Assert the element has attribute name equal to value.
Sourcepub async fn to_have_value(&self, expected: &str) -> Result<()>
pub async fn to_have_value(&self, expected: &str) -> Result<()>
Assert the element’s input value equals expected.
Sourcepub async fn to_have_value_regex(&self, pattern: &str) -> Result<()>
pub async fn to_have_value_regex(&self, pattern: &str) -> Result<()>
Assert the element’s input value matches the regex pattern.
Sourcepub async fn to_have_attribute_regex(
&self,
name: &str,
pattern: &str,
) -> Result<()>
pub async fn to_have_attribute_regex( &self, name: &str, pattern: &str, ) -> Result<()>
Assert the element’s class attribute matches the regex pattern.
Sourcepub async fn to_have_css(&self, name: &str, value: &str) -> Result<()>
pub async fn to_have_css(&self, name: &str, value: &str) -> Result<()>
Assert the element’s computed CSS property name equals value.
Reads the value via getComputedStyle(el).getPropertyValue(name) and
compares for exact equality.
Sourcepub async fn to_have_css_regex(&self, name: &str, pattern: &str) -> Result<()>
pub async fn to_have_css_regex(&self, name: &str, pattern: &str) -> Result<()>
Assert the element’s computed CSS property name matches the regex
pattern.
Sourcepub async fn to_have_class(&self, expected: &str) -> Result<()>
pub async fn to_have_class(&self, expected: &str) -> Result<()>
Assert the element’s class attribute equals expected.
Sourcepub async fn to_have_class_regex(&self, pattern: &str) -> Result<()>
pub async fn to_have_class_regex(&self, pattern: &str) -> Result<()>
Assert the element’s class attribute matches the regex pattern.
Sourcepub async fn to_be_focused(&self) -> Result<()>
pub async fn to_be_focused(&self) -> Result<()>
Assert the element is the current document.activeElement.
Sourcepub async fn to_match_aria_snapshot(&self, expected: &str) -> Result<()>
pub async fn to_match_aria_snapshot(&self, expected: &str) -> Result<()>
Assert the element’s aria snapshot equals expected.
Simplified variant: compares the trimmed snapshot string against the
trimmed expected for exact equality. This is not Playwright’s
structured accessibility-tree diff (it does no node normalization or
whitespace folding beyond trim()), so mismatches in indentation or
ordering will fail even when the trees are semantically equivalent.
Sourcepub async fn to_have_screenshot(
&self,
name: &str,
options: Option<ScreenshotAssertOptions>,
) -> Result<()>
pub async fn to_have_screenshot( &self, name: &str, options: Option<ScreenshotAssertOptions>, ) -> Result<()>
Assert the element’s screenshot matches a baseline PNG file name.
A .png suffix is appended to name if absent. If the baseline does
not yet exist, the first run writes it (establishing the baseline) and
succeeds.
Comparison mode depends on the screenshot-diff cargo feature:
- Feature OFF (default): exact byte-level comparison of the
captured PNG against the baseline. The rendered bytes must be
identical. The
optionsargument is accepted but ignored. - Feature ON (
screenshot-diff): pixel-level tolerance comparison via theimagecrate. Both PNGs are decoded to RGBA and compared pixel-by-pixel; a mismatch is reported only when the number of differing pixels exceeds the tolerance inScreenshotAssertOptions(max_diff_pixels/threshold). Disable the feature to drop theimagedependency entirely.
On mismatch the actual bytes are always dumped to {name}-actual.png
for inspection, and the error message carries diff statistics.
Because this captures a single frame rather than polling a condition,
it bypasses [wait_for] and runs to completion immediately.
Sourcepub async fn to_be_empty(&self) -> Result<()>
pub async fn to_be_empty(&self) -> Result<()>
Assert the element is empty: an empty input value, or zero matching elements.
Trait Implementations§
Source§impl Clone for LocatorAssertions
impl Clone for LocatorAssertions
Source§fn clone(&self) -> LocatorAssertions
fn clone(&self) -> LocatorAssertions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more