Playwright · Junior · Question 33 of 75
What does toHaveText check?
await expect(page.getByRole("status")).toHaveText("Saved");- 1The element had that text when the test started
- 2The element's text matches, retrying until timeout
- 3The page source contains the word somewhere
Show the answer
Correct answer: The element's text matches, retrying until timeout
Explanation
Web-first assertions keep retrying until the condition holds or the expect timeout runs out. toContainText checks a substring instead of the full text.