Skip to content

Stop createEvent picking a past date for a future event - #903

Open
edwh wants to merge 1 commit into
developfrom
fix-event-fixture-date
Open

Stop createEvent picking a past date for a future event#903
edwh wants to merge 1 commit into
developfrom
fix-event-fixture-date

Conversation

@edwh

@edwh edwh commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

develop has been red since 31 August, and it is a dormant fixture bug rather than a code regression.

Cause

createEvent picks a date with:

await page.click('#event_date .b-calendar-grid > ... .row:last-child .btn:last-child')

page.click is not strict, so it takes the first of the seven matches in the final week row, not the last. That day sits near the end of the displayed month — so for the last few days of every month it is on or before today, and createEvent(past=false) silently produced a finished event.

EventActions renders a different branch when an event is finished (Request review / Share event stats / Download event data) with no Invite volunteers item at all, so the test timed out waiting for a dropdown item that was never going to appear. The CI failure screenshot shows exactly that: an event dated 30 Aug 2026 on a run dated 31 Aug 2026, dropdown open on the finished branch.

Green on 15 Jul, red on 31 Aug, with no relevant code change in between — the only two commits between those runs were the WordPress group avatar fix and its merge.

Fix

Shift a month in the direction we want, mirroring what the past branch already did, then assert the date we actually landed on. Without that assertion a mis-picked date surfaces as a confusing timeout much later in whichever test used the helper.

Verification

Against the local site with the browser clock faked (both the grid and the assertion are client-side):

Date Old click picks Patched helper
2026-08-31 2026-08-30 — past OK
2026-12-29 2026-12-27 — past OK
2026-09-02 2026-09-27 — future test passes

Invite volunteers modal opens from Event Actions dropdown passes locally with the change.

This should also clear the same test's noise on #835.

The date click lands on the first day of the calendar's final week row -
page.click is not strict, so it takes the first of the seven matches, not
the last.  In the current month that day is near the month's end, so for
the last few days of every month it is on or before today.

createEvent(past=false) then produced a finished event.  EventActions
renders a different branch for a finished event, with no Invite
volunteers item at all, so the invite test timed out waiting for a
dropdown item that was never going to appear.  Nothing in the app had
changed: the suite went red on 31 August because the calendar picked 30
August, and it had been green on 15 July when the same click landed in
the future.

Shift a month in the direction we want instead of relying on where today
falls, mirroring what the past branch already did, and check the date we
ended up with.  Without that check a mis-picked date shows up as a
puzzling timeout much later in whichever test used the helper.

Verified against the local site with the browser clock faked: at
2026-08-31 the old click picks 2026-08-30 and at 2026-12-29 it picks
2026-12-27, both in the past; with the shift both dates land in the
following month, and the invite test passes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@sonarqubecloud

sonarqubecloud Bot commented Sep 2, 2026

Copy link
Copy Markdown

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.

1 participant