QuizNot attempted
Avoiding flakiness
1–4 to choose, Enter to submit
Show answer & explanation
Correct answer:
- Web-first assertions like
await expect(page.getByRole('button', { name: 'Pay' })).toBeEnabled(), which auto-wait
- Web-first assertions (
await expect(locator).toBeEnabled()) retry until the condition holds, so they wait exactly as long as needed. - Not waitForTimeout(3000): fixed sleeps are slow when the app is fast and still flaky when it is slow.
- Not generated class names: they change on every build.
- Not shared mutating login state: tests couple to each other's side effects
- use
storageStateper test and isolated data.