test(e2e): stabilize repeat-task-day-change test against CI timer throttling

The day-change emission in GlobalTrackingIntervalService has three real-world
paths: 1s interval, window:focus, visibilitychange. Under CI load the 1s
setInterval can starve past the 30s assertion window. Dispatch a focus event
after the clock advance to trigger focusBased$ (debounced 100ms), exercising
the same addAllDueToday() chain deterministically.
This commit is contained in:
Johannes Millan 2026-05-27 00:31:53 +02:00
parent 34f45b11bc
commit 46ac873570

View file

@ -71,6 +71,13 @@ test.describe('Repeat Task - Day Change (#6230)', () => {
// 7. Advance clock past midnight to Day X+1
await page.clock.setFixedTime(new Date('2026-06-16T00:05:00'));
// The day-change emission has two real-world paths in GlobalTrackingIntervalService:
// the 1s `interval` (timerBased$) and `window:focus` / `visibilitychange`.
// CI runners have enough CPU contention that the 1s tick can lag past the 30s
// wait window. Dispatching a focus event triggers focusBased$ (debounced 100ms)
// immediately, exercising the same effect chain deterministically.
await page.evaluate(() => window.dispatchEvent(new Event('focus')));
// 8. Assert: a new undone task with the same title should appear
// The app's date-change mechanism should detect the new day and create
// a fresh repeat task instance. 30s timeout accounts for debounce + sync.