Testing / Playwright Interview questions
How does Playwright differentiate retry behavior between actions and assertions?
Actions like click() or fill() retry against a fixed set of actionability checks (attached, visible, stable, enabled, receives events) and stop as soon as all of them pass, then perform the action exactly once. Their retry loop is really a "wait until ready" loop, governed by the action's own timeout option.
Web-first assertions like expect(locator).toHaveText() retry the condition itself, not just element readiness - they re-evaluate the actual assertion (does the text match yet?) repeatedly until it's true or the assertion timeout, set separately via expect.timeout in the config, is reached.
Practically, this means you can tune how long the app is given to settle into an expected state independently of how long individual clicks or fills are allowed to wait for an element to become interactable.
More Related questions...