Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

docs: #33837 Clarify that clock.install must precede clock operations (#33901)

Adam Gastineaua14d9750b314
diff --git a/docs/src/clock.md b/docs/src/clock.md
index 2f846e4fd3..44582f450b 100644
--- a/docs/src/clock.md
+++ b/docs/src/clock.md
@@ -34,6 +34,10 @@ The recommended approach is to use `setFixedTime` to set the time to a specific
- `Event.timeStamp`
:::
+:::warning
+If you call `install` at any point in your test, the call _MUST_ occur before any other clock related calls (see note above for list). Calling these methods out of order will result in undefined behavior. For example, you cannot call `setInterval`, followed by `install`, then `clearInterval`, as `install` overrides the native definition of the clock functions.
+:::
+
## Test with predefined time
Often you only need to fake `Date.now` while keeping the timers going.