mediumStudy question · answer published in Playwright interview questions, so no pointsplaywrighte2e-testing
Flaky end-to-end test with fixed waits
A Playwright test clicks Save, waits 3 seconds and then checks for a success message. It fails randomly on CI. What is the better approach?
await page.getByRole('button', { name: 'Save' }).click()
await page.waitForTimeout(3000)
expect(await page.locator('.toast').isVisible()).toBe(true)Discussion 0
Join free to post in the discussion.
Related questions
- Flaky end-to-end testFull Stack Developer
- Flaky Playwright visibility checkQA Engineer
- Strict mode violationQA Engineer
- A missing awaitAutomation Test Engineer
- Browsers Playwright coversAutomation Test Engineer
- Using the trace viewerAutomation Test Engineer
- Finding a button by role and nameAutomation Test Engineer
- Recording a first draft of a testAutomation Test Engineer