I currently have an issue where I need to wait for a checkbox / radio button to be "checked" before I proceed with my testing.
If I assert the checkbox is checked the test fails because it doesn't have the checked state immediately after the action.
How does one go about this through playwright commands. Yes I can add a hardcoded timeout, but I feel like there is a better way.
It looks like in version 1.21.0 of playwright they have added a polling assertion:
// Poll the method until it returns an expected result.
await expect.poll(async () => {
const response = await page.request.get('https://api.example.com');
return response.status();
}).toBe(200);