You re-run. It passes. You move on.
Until your whole team is trained to ignore failures. That's when real bugs slip through.
Here are the 3 root causes behind 90% of flaky Playwright tests.
Race Condition
// bad
const text = await page.locator('.welcome').textContent();
// good
await expect(page.getByText('Welcome back')).toBeVisible();
// auto-retries until element exists
Shared Data
// bad
await request.delete('/api/users/test-user-1');
// 5 workers fight over this
// good
const user = await createUniqueUser(request);
await request.delete(`/api/users/${user.id}`);
// each test gets its own
Network Timing
// bad
await page.goto('/search?q=laptop');
await page.locator('.result').first().click();
// results not loaded yet
// good
await page.goto('/search?q=laptop');
await page.waitForResponse('**/api/search');
await page.getByTestId('result').first().click();
Which of these three has burned you the most on your current project?
Top comments (0)