8000 fix(clock): amend setSystemTime docs (#32901) · microsoft/playwright@d3fbf1a · GitHub
[go: up one dir, main page]

Skip to content

Commit d3fbf1a

Browse files
8000 Skn0ttdgozman
andauthored
fix(clock): amend setSystemTime docs (#32901)
As discussed yesterday over #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>
1 parent e6afb65 commit d3fbf1a

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

docs/src/api/class-clock.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,8 @@ Resumes timers. Once this method is called, time resumes flowing, timers are fir
193193
Makes `Date.now` and `new Date()` return fixed fake time at all times,
194194
keeps all the timers running.
195195

196+
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.
197+
196198
**Usage**
197199

198200
```js
@@ -249,7 +251,7 @@ Time to be set.
249251
## async method: Clock.setSystemTime
250252
* since: v1.45
251253

252-
Sets current system time but does not trigger any timers.
254+
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.
253255

254256
**Usage**
255257

packages/playwright-core/types/types.d.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18544,6 +18544,10 @@ export interface Clock {
1854418544
/**
1854518545
* Makes `Date.now` and `new Date()` return fixed fake time at all times, keeps all the timers running.
1854618546
*
18547+
* Use this method for simple scenarios where you only need to test with a predefined time. For more advanced
18548+
* scenarios, use [clock.install([options])](https://playwright.dev/docs/api/class-clock#clock-install) instead. Read
18549+
* docs on [clock emulation](https://playwright.dev/docs/clock) to learn more.
18550+
*
1854718551
* **Usage**
1854818552
*
1854918553
* ```js
@@ -18557,7 +18561,8 @@ export interface Clock {
1855718561
setFixedTime(time: number|string|Date): Promise<void>;
1855818562

1855918563
/**
18560-
* Sets current system time but does not trigger any timers.
18564+
* Sets system time, but does not trigger any timers. Use this to test how the web page reacts to a time shift, for
18565+
* example switching from summer to winter time, or changing time zones.
1856118566
*
1856218567
* **Usage**
1856318568
*

0 commit comments

Comments
 (0)
0