fix(clock): amend setSystemTime docs (#32901)

As discussed yesterday over
https://github.com/microsoft/playwright/issues/32807. Adds some words to
differentiate `setSystemTime` from `setFixedTime`.

---------

Signed-off-by: Simon Knott <info@simonknott.de>
Co-authored-by: Dmitry Gozman <dgozman@gmail.com>
This commit is contained in:
Simon Knott 2024-10-07 12:12:12 +02:00 committed by GitHub
parent e6afb650be
commit d3fbf1aaeb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 2 deletions

View File

@ -193,6 +193,8 @@ Resumes timers. Once this method is called, time resumes flowing, timers are fir
Makes `Date.now` and `new Date()` return fixed fake time at all times, Makes `Date.now` and `new Date()` return fixed fake time at all times,
keeps all the timers running. keeps all the timers running.
Use this method for simple scenarios where you only need to test with a predefined time. For more advanced scenarios, use [`method: Clock.install`] instead. Read docs on [clock emulation](../clock.md) to learn more.
**Usage** **Usage**
```js ```js
@ -249,7 +251,7 @@ Time to be set.
## async method: Clock.setSystemTime ## async method: Clock.setSystemTime
* since: v1.45 * since: v1.45
Sets current system time but does not trigger any timers. Sets system time, but does not trigger any timers. Use this to test how the web page reacts to a time shift, for example switching from summer to winter time, or changing time zones.
**Usage** **Usage**

View File

@ -18544,6 +18544,10 @@ export interface Clock {
/** /**
* Makes `Date.now` and `new Date()` return fixed fake time at all times, keeps all the timers running. * Makes `Date.now` and `new Date()` return fixed fake time at all times, keeps all the timers running.
* *
* Use this method for simple scenarios where you only need to test with a predefined time. For more advanced
* scenarios, use [clock.install([options])](https://playwright.dev/docs/api/class-clock#clock-install) instead. Read
* docs on [clock emulation](https://playwright.dev/docs/clock) to learn more.
*
* **Usage** * **Usage**
* *
* ```js * ```js
@ -18557,7 +18561,8 @@ export interface Clock {
setFixedTime(time: number|string|Date): Promise<void>; setFixedTime(time: number|string|Date): Promise<void>;
/** /**
* Sets current system time but does not trigger any timers. * Sets system time, but does not trigger any timers. Use this to test how the web page reacts to a time shift, for
* example switching from summer to winter time, or changing time zones.
* *
* **Usage** * **Usage**
* *