wpt icon indicating copy to clipboard operation
wpt copied to clipboard

docs: recommend alternatives to timeouts and update reviewer checklist

Open rajanarahul93 opened this issue 6 months ago • 0 comments

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

  1. 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.
  2. checklist.md:

    • Updated the "Script Tests Only" checklist item:
      • Strengthened guidance against internal timeouts.
      • Recommends event-based testing and requestAnimationFrame as better alternatives.
      • Clarifies that timeouts (like step_timeout) should only be used when necessary.

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!

rajanarahul93 avatar Jun 15 '25 12:06 rajanarahul93