hard20 pts · first answer countsui-automationplaywrightflaky-tests
Retrying a group of steps
A settings panel sometimes ignores the first click while it initialises, and fixing the app is not possible this sprint. Which Playwright tool retries both the click and the check together?
await expect(async () => {
await page.getByRole('switch', { name: 'Dark mode' }).click()
await expect(page.locator('html')).toHaveAttribute('data-theme', 'dark', { timeout: 1000 })
}).toPass({ timeout: 10_000 })Discussion 0
Join free to post in the discussion.
Related questions
- Choosing a stable locatorAutomation Test Engineer
- Waiting for an elementAutomation Test Engineer
- Headless modeAutomation Test Engineer
- A missing awaitAutomation Test Engineer
- What makes a test flakyAutomation Test Engineer
- Browsers Playwright coversAutomation Test Engineer
- Using the trace viewerAutomation Test Engineer
- Finding a button by role and nameAutomation Test Engineer