pub struct PageExpectation { /* private fields */ }Expand description
Page-level expectation for screenshot assertions.
Implementations§
Source§impl PageExpectation
impl PageExpectation
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Sets a custom timeout for this assertion.
Sourcepub async fn to_have_title(self, expected: &str) -> Result<()>
pub async fn to_have_title(self, expected: &str) -> Result<()>
Asserts that the page title matches the expected string.
Auto-retries until the title matches or the timeout expires.
See: https://playwright.dev/docs/api/class-pageassertions#page-assertions-to-have-title
Sourcepub async fn to_have_title_regex(self, pattern: &str) -> Result<()>
pub async fn to_have_title_regex(self, pattern: &str) -> Result<()>
Asserts that the page title matches the given regex pattern.
Auto-retries until the title matches or the timeout expires.
See: https://playwright.dev/docs/api/class-pageassertions#page-assertions-to-have-title
Sourcepub async fn to_match_aria_snapshot(self, expected: &str) -> Result<()>
pub async fn to_match_aria_snapshot(self, expected: &str) -> Result<()>
Asserts that the page’s accessibility tree matches the expected ARIA snapshot.
The page-level counterpart of
[Expectation::to_match_aria_snapshot]; it matches the whole document
(rooted at :root). The expected string is a YAML representation of
the accessibility tree, and the Playwright server auto-retries within the
assertion timeout.
§Example
expect_page(&page)
.to_match_aria_snapshot("- heading \"Welcome\" [level=1]")
.await?;See: https://playwright.dev/docs/api/class-pageassertions#page-assertions-to-match-aria-snapshot
Sourcepub async fn to_have_url(self, expected: &str) -> Result<()>
pub async fn to_have_url(self, expected: &str) -> Result<()>
Asserts that the page URL matches the expected string.
Auto-retries until the URL matches or the timeout expires.
See: https://playwright.dev/docs/api/class-pageassertions#page-assertions-to-have-url
Sourcepub async fn to_have_url_regex(self, pattern: &str) -> Result<()>
pub async fn to_have_url_regex(self, pattern: &str) -> Result<()>
Asserts that the page URL matches the given regex pattern.
Auto-retries until the URL matches or the timeout expires.
See: https://playwright.dev/docs/api/class-pageassertions#page-assertions-to-have-url