Does Playwright Auto-Wait Retry Actions after Network Failures?
0 reputation · 17 Dec 2024, 16:01 UTC
Playwright’s auto‑wait system automatically pauses until a target element is actionable before performing an action such as click or type. This reduces flakiness caused by timing differences between the test and the page.
When the element becomes detached or hidden during the wait, Playwright internally retries the action a few times. However, if a navigation step encounters a transient network error—such as a 500 response or a dropped connection—Playwright does not automatically retry the navigation or the subsequent action. The current implementation hard‑codes this behavior, and there is no exposed configuration flag to change it.
Users who need retry logic on network errors must wrap navigation calls in a try/catch and implement their own retry loop, which increases test maintenance overhead and obscures the intent of the test.
Which design decision would best serve the Playwright community: keep the hard‑coded no‑retry on network errors to preserve deterministic test execution, or expose a configurable flag that allows automatic retry of navigation and actions after transient network failures?
Does adding such a flag risk masking genuine application issues, or would it provide a more robust testing experience for flaky network environments?