19. Web-First Assertions with PlaywrightAssertions.assertThat

Web-First Auto-Retrying Assertions

import static com.microsoft.playwright.assertions.PlaywrightAssertions.assertThat;

assertThat(page).hasURL("https://targetqa.com/dashboard");
assertThat(page).hasTitle("Dashboard - TargetQA");

Locator welcomeHeader = page.getByRole(AriaRole.HEADING);
assertThat(welcomeHeader).isVisible();
assertThat(welcomeHeader).hasText("Welcome back, Dhanu!");

Task

  • Implement verifyDashboardPage:
  • 1. Assert assertThat(page).hasURL(expectedUrl).
  • 2. Assert assertThat(page.getByRole(AriaRole.HEADING)).isVisible().
πŸ’‘Common doubts
Did you like the problem?
Lesson 19 of 38
Java
Loading code editor…
Next