From 31a81b2293af225cb994b485e0b7875cfa534ec1 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 25 Jun 2026 13:27:57 +0000 Subject: [PATCH] fix(e2e): bump stale 2026-06-07 seed dates to next-Sunday-from-today MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Four e2e tests (test_decline_reopen, test_event_roster_fill, test_open_shifts, test_swap_marketplace) seed a "Sunday 10am Service" event with hard-coded date 2026-06-07 and then wait for it on `/v/open` (or the swap-open list). Those volunteer-facing views filter out past events, so as soon as today's date passed 2026-06-07 the selector `#open-list:has-text('Sunday 10am Service')` started timing out on every PR — blocking the E2E lane for all new work. The fix replaces the literal with a `next_sunday_iso()` helper in `tests/e2e/_helpers.py` that always returns a Sunday at least 7 days out, so the seed event is reliably in the future regardless of when the suite runs. Scoped narrowly: only the 4 tests whose date drives a future-filtered view are touched. Other tests still using 2026-06-07 (analytics, recurring, smoke, etc.) interact with admin views that don't filter on date, and some pair the date with a hard-coded solver window — bumping their date would require also bumping the window. Left for a follow-up. Changed files: - tests/e2e/_helpers.py — add next_sunday_iso() helper - tests/e2e/test_decline_reopen.py - tests/e2e/test_event_roster_fill.py - tests/e2e/test_open_shifts.py - tests/e2e/test_swap_marketplace.py Validation: - poetry run black tests/e2e/ — clean - poetry run ruff check tests/e2e/ — clean - poetry run pytest --co tests/ — 361 tests collected (imports OK) - E2E suite couldn't run locally (Playwright browser version mismatch); CI is the source of truth for the E2E lane. Follow-ups: - Sweep the remaining 7 e2e files that still use 2026-06-07; they pass today but will rot. Bump dates AND the associated solver windows in the same PR to avoid breaking previously-green tests. --- tests/e2e/_helpers.py | 18 ++++++++++++++++++ tests/e2e/test_decline_reopen.py | 11 +++++++++-- tests/e2e/test_event_roster_fill.py | 11 +++++++++-- tests/e2e/test_open_shifts.py | 11 +++++++++-- tests/e2e/test_swap_marketplace.py | 11 +++++++++-- 5 files changed, 54 insertions(+), 8 deletions(-) diff --git a/tests/e2e/_helpers.py b/tests/e2e/_helpers.py index f231b406..de376ca3 100644 --- a/tests/e2e/_helpers.py +++ b/tests/e2e/_helpers.py @@ -6,12 +6,30 @@ import sqlite3 import uuid +from datetime import date, timedelta def rid() -> str: return uuid.uuid4().hex[:8] +def next_sunday_iso() -> str: + """Return the ISO date of a Sunday at least 7 days from today. + + The open-shift, swap, and decline-reopen flows seed a "Sunday 10am + Service" event and expect it to appear on `/v/open` (which filters + out past events). Hard-coded dates rot the suite as time passes — + this keeps the seed event safely in the future on every run. + """ + today = date.today() + # weekday(): Monday=0 ... Sunday=6. Days until next Sunday after at + # least a 7-day cushion. + days_until_sunday = (6 - today.weekday()) % 7 + if days_until_sunday < 7: + days_until_sunday += 7 + return (today + timedelta(days=days_until_sunday)).isoformat() + + def signup_admin( page, base_url, *, org="Hope Chapel", name="Admin Dana", email=None, password="HopePass123!" ): diff --git a/tests/e2e/test_decline_reopen.py b/tests/e2e/test_decline_reopen.py index ac33ae65..a012b135 100644 --- a/tests/e2e/test_decline_reopen.py +++ b/tests/e2e/test_decline_reopen.py @@ -8,7 +8,14 @@ import pytest -from tests.e2e._helpers import accept_invitation, invite_token, no_js_errors, rid, signup_admin +from tests.e2e._helpers import ( + accept_invitation, + invite_token, + next_sunday_iso, + no_js_errors, + rid, + signup_admin, +) pytestmark = pytest.mark.e2e @@ -39,7 +46,7 @@ def test_decline_reopens_slot(live_server, new_context, page, db_path): page.click("button:has-text('New event')") page.wait_for_selector("#ev_type", state="visible") page.fill("#ev_type", "Sunday 10am Service") - page.fill("#ev_date", "2026-06-07") + page.fill("#ev_date", next_sunday_iso()) page.fill("#ev_start", "10:00") page.fill("#ev_end", "11:30") page.fill("input[name=role_name]", "volunteer") diff --git a/tests/e2e/test_event_roster_fill.py b/tests/e2e/test_event_roster_fill.py index 6e0c6fc8..d180b3f8 100644 --- a/tests/e2e/test_event_roster_fill.py +++ b/tests/e2e/test_event_roster_fill.py @@ -4,7 +4,14 @@ import pytest -from tests.e2e._helpers import accept_invitation, invite_token, no_js_errors, rid, signup_admin +from tests.e2e._helpers import ( + accept_invitation, + invite_token, + next_sunday_iso, + no_js_errors, + rid, + signup_admin, +) pytestmark = pytest.mark.e2e @@ -28,7 +35,7 @@ def test_admin_fills_roster_gap(live_server, new_context, page, db_path): page.click("button:has-text('New event')") page.wait_for_selector("#ev_type", state="visible") page.fill("#ev_type", "Sunday 10am Service") - page.fill("#ev_date", "2026-06-07") + page.fill("#ev_date", next_sunday_iso()) page.fill("#ev_start", "10:00") page.fill("#ev_end", "11:30") page.fill("input[name=role_name]", "usher") diff --git a/tests/e2e/test_open_shifts.py b/tests/e2e/test_open_shifts.py index aae41b0b..09a935c2 100644 --- a/tests/e2e/test_open_shifts.py +++ b/tests/e2e/test_open_shifts.py @@ -4,7 +4,14 @@ import pytest -from tests.e2e._helpers import accept_invitation, invite_token, no_js_errors, rid, signup_admin +from tests.e2e._helpers import ( + accept_invitation, + invite_token, + next_sunday_iso, + no_js_errors, + rid, + signup_admin, +) pytestmark = pytest.mark.e2e @@ -32,7 +39,7 @@ def test_volunteer_claims_open_shift(live_server, new_context, page, db_path): page.click("button:has-text('New event')") page.wait_for_selector("#ev_type", state="visible") page.fill("#ev_type", "Sunday 10am Service") - page.fill("#ev_date", "2026-06-07") + page.fill("#ev_date", next_sunday_iso()) page.fill("#ev_start", "10:00") page.fill("#ev_end", "11:30") page.fill("input[name=role_name]", "volunteer") diff --git a/tests/e2e/test_swap_marketplace.py b/tests/e2e/test_swap_marketplace.py index bc09196b..a8eaa280 100644 --- a/tests/e2e/test_swap_marketplace.py +++ b/tests/e2e/test_swap_marketplace.py @@ -4,7 +4,14 @@ import pytest -from tests.e2e._helpers import accept_invitation, invite_token, no_js_errors, rid, signup_admin +from tests.e2e._helpers import ( + accept_invitation, + invite_token, + next_sunday_iso, + no_js_errors, + rid, + signup_admin, +) pytestmark = pytest.mark.e2e @@ -36,7 +43,7 @@ def test_cover_a_swap_end_to_end(live_server, new_context, page, db_path): page.click("button:has-text('New event')") page.wait_for_selector("#ev_type", state="visible") page.fill("#ev_type", "Sunday 10am Service") - page.fill("#ev_date", "2026-06-07") + page.fill("#ev_date", next_sunday_iso()) page.fill("#ev_start", "10:00") page.fill("#ev_end", "11:30") page.fill("input[name=role_name]", "volunteer")