wpt
wpt copied to clipboard
docs: recommend alternatives to timeouts and update reviewer checklist
Summary
This PR improves the documentation around usage of timeouts in WPT tests. It provides recommended alternatives to using setTimeout and updates the reviewer checklist to align with these practices.
Changes Made
-
testharness-api.md:- Expanded the section under "Timers in Tests" to:
- Emphasize avoiding timeouts.
- Recommend using event-based approaches.
- Suggest
requestAnimationFrame(ideally two frames) for rendering-related delays. - Clarify when
step_timeout()is acceptable, such as in APNG or reftest cases.
- Expanded the section under "Timers in Tests" to:
-
checklist.md:- Updated the "Script Tests Only" checklist item:
- Strengthened guidance against internal timeouts.
- Recommends event-based testing and
requestAnimationFrameas better alternatives. - Clarifies that timeouts (like
step_timeout) should only be used when necessary.
- Updated the "Script Tests Only" checklist item:
Why
Timeouts in tests are a common source of flakiness and instability. This update addresses [Issue #20715] by helping test authors and reviewers adopt more stable and reliable testing patterns.
Let me know if you’d like more clarification or examples added. Thanks!