Playwright · Middle · Question 26 of 75
When is expect.poll useful?
await expect.poll(async () => {
const res = await request.get("/api/jobs/42");
return (await res.json()).status;
}).toBe("done");- 1To wait for a fixed delay before asserting
- 2To retry a non-locator value until it matches
- 3To check every value in an array of locators
Show the answer
Correct answer: To retry a non-locator value until it matches
Explanation
Web-first assertions retry locator checks. expect.poll retries any async function, e.g. waiting for a background job.