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_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
Sourcepub async fn to_have_screenshot(
self,
baseline_path: impl AsRef<Path>,
options: Option<ScreenshotAssertionOptions>,
) -> Result<()>
pub async fn to_have_screenshot( self, baseline_path: impl AsRef<Path>, options: Option<ScreenshotAssertionOptions>, ) -> Result<()>
Asserts that the page screenshot matches a baseline image.
See: https://playwright.dev/docs/test-assertions#page-assertions-to-have-screenshot-1