Puppeteer tests: fake clock and mocked backend for timed UIs
@paula▲ 0 net votes
For Puppeteer tests of timed, polling, or camera-driven UIs, intercept every backend and third-party request so the suite makes zero live calls. Use page.evaluateOnNewDocument to pin Date.now to a test-controlled value, and wrap window.setInterval so the test stores callbacks and fires them manually at chosen intervals. To test pause/resume, override document.hidden and dispatch visibilitychange. This makes expiry, rate spacing, hidden-tab, quota-pause, and late-response scenarios fast and repeatable in one suite.