Skip to content

Fix time-of-day flake in date range picker e2e test#3269

Merged
david-crespo merged 1 commit into
mainfrom
claude/playwright-failure-main-5hvusg
Jun 30, 2026
Merged

Fix time-of-day flake in date range picker e2e test#3269
david-crespo merged 1 commit into
mainfrom
claude/playwright-failure-main-5hvusg

Conversation

@david-crespo

Copy link
Copy Markdown
Collaborator

The "invalid range shows an error" test in instance-metrics.e2e.ts
collapsed the default "Last hour" range to a single day by clicking
Today twice, then asserted the range was valid. But the calendar keeps
the time components from the existing range, and when the test runs
shortly after midnight the "Last hour" range straddles midnight (start
~23:00 the previous day, end ~00:00 today). Collapsing both dates to
today then leaves the start time after the end time, so the range reads
as invalid and the precondition assertion fails. This is what broke CI
on main, which ran at 00:03 UTC.

Set the start and end times explicitly to a valid same-day order before
asserting the range is valid, then flip them to assert the invalid case,
so the test no longer depends on the time of day it runs.

Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_017LT16CnNXBGhBHKk82cq9Z

The "invalid range shows an error" test in instance-metrics.e2e.ts
collapsed the default "Last hour" range to a single day by clicking
Today twice, then asserted the range was valid. But the calendar keeps
the time components from the existing range, and when the test runs
shortly after midnight the "Last hour" range straddles midnight (start
~23:00 the previous day, end ~00:00 today). Collapsing both dates to
today then leaves the start time after the end time, so the range reads
as invalid and the precondition assertion fails. This is what broke CI
on main, which ran at 00:03 UTC.

Set the start and end times explicitly to a valid same-day order before
asserting the range is valid, then flip them to assert the invalid case,
so the test no longer depends on the time of day it runs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017LT16CnNXBGhBHKk82cq9Z
@vercel

vercel Bot commented Jun 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
console Ready Ready Preview Jun 30, 2026 1:01am

Request Review

@david-crespo david-crespo merged commit 07daaf1 into main Jun 30, 2026
7 checks passed
@david-crespo david-crespo deleted the claude/playwright-failure-main-5hvusg branch June 30, 2026 01:11
david-crespo added a commit that referenced this pull request Jul 1, 2026
The fix in #3269 was a hack. This is a better fix, and covers a second
case I didn't learn about until an hour ago.

### 🤖 Summary

The metrics page defaults to a "Last hour" range derived from the wall
clock, so what the tests see depends on when they run. Two failure
modes:

- If the test runs **within an hour after midnight UTC,** the default
range spans the day boundary (start `23:xx` yesterday, end `00:xx`
today). The test collapses both dates to today, which keeps the
inherited times, so start `23:xx` now lands after end `00:xx`, the range
reads invalid before the test has done anything, and the "should be
valid" assertion fails. This is what #3269 worked around by setting the
times explicitly.
- If the test runs **within the first hour of a month UTC**, the range
start (an hour before `00:xx` on the 1st = `23:xx` on the last day of
the *previous* month) is in a different month than today. The calendar
opens on the start's month, so today's cell isn't in the visible grid,
`getByRole('button', { name: /Today/ })` finds nothing, and the click
times out after 60s. This is what failed just now (June 30 → July 1):
[Playwright
(chrome)](https://github.com/oxidecomputer/console/actions/runs/28483772639/job/84425726642),
all three browsers, tests running at 00:03 UTC.

No user impact either way — near midnight the calendar just opens on the
start month, which is normal. The problem is just what the tests expect
to see when that happens.

**Fix:** Freeze the clock to a fixed mid-month noon with
`page.clock.setFixedTime` (same trick as the visual regression suite),
so neither the range times nor the visible month depend on when CI runs.
With that in place the #3269 time-juggling is no longer needed, so I
reverted it back to the simpler form.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants