Playwright lab
Web-first assertions
Values that change after a delay: practise retrying expect() matchers, polling and soft assertions.
Practice tasks
- Assert the status text becomes “Saved” with toHaveText (no waitForTimeout).
- Use toHaveCount(3) while items are added one per second, then toContainText on the list.
- Assert toHaveValue, toBeChecked, toBeEditable, toBeFocused, toHaveClass and toHaveCSS on the matching controls.
- Assert toHaveAttribute('aria-expanded', 'true') after opening the disclosure.
- Assert toHaveTitle and toHaveURL after the delayed title and URL changes.
- Use expect.poll() to wait for the counter to reach 10 and expect(...).toPass() to retry the flaky API block.
- Write four soft assertions against the product card so every mismatch is reported at once.
- Negate: assert the spinner is hidden with not.toBeVisible() and toBeHidden().