Skip to content

Commit 20e9da8

Browse files
atulmguptaCopilot
andcommitted
fix(ci): stabilize rolling dates in visual snapshots
Scope the Playwright fixed clock to visual cases while preserving shared browser seeding and running timers. Keep existing snapshots and tolerances unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 07900e4 commit 20e9da8

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

web/e2e/harness.contract.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,16 @@ test('browser globals are not monkeypatched by state seeding', () => {
4444
expect(source).not.toContain('HarnessEventSource');
4545
});
4646

47+
test('visual date labels use a fixed clock without changing shared browser seeding', () => {
48+
const visual = readFileSync(resolve(process.cwd(), 'e2e', 'visual.spec.ts'), 'utf8');
49+
const seed = readFileSync(resolve(process.cwd(), 'e2e', 'mockApi.ts'), 'utf8');
50+
const clock = "page.clock.setFixedTime(new Date('2026-09-13T12:00:00Z'))";
51+
expect(visual).toContain(clock);
52+
expect(visual.indexOf(clock)).toBeLessThan(visual.indexOf('page.goto'));
53+
expect(seed).not.toContain('clock.setFixedTime');
54+
expect(visual).not.toContain('clock.pauseAt');
55+
});
56+
4757
test('Date semantics contract uses the standard hermetic API lifecycle', () => {
4858
const source = readFileSync(
4959
resolve(process.cwd(), 'e2e', 'date.contract.smoke.spec.ts'),

web/e2e/visual.spec.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ for (const route of VISUAL_ROUTES) {
9393
: profile === 'large-fleet'
9494
? 'large-fleet'
9595
: 'populated';
96+
// Pin rolling date labels to the committed baseline day, without freezing timers.
97+
// This clock is visual-only; the native Date contract uses the shared seed unchanged.
98+
await page.clock.setFixedTime(new Date('2026-09-13T12:00:00Z'));
9699
await seedBrowserState(page, theme, route.path, { density });
97100
const mockApi = await installApiMocks(page, scenario, theme, density);
98101
await page.goto(route.path, { waitUntil: 'domcontentloaded' });

0 commit comments

Comments
 (0)