my-sea hex-btn state-machine FT pin: extend test_landing_renders_hex_with_free_draw_btn to assert PAID DRAW + GATE VIEW are absent for fresh users — closes the mutual-exclusion gap (the other two states already pin the same invariant from their own directions; this adds the FREE-DRAW side). Docstring spells out the 3-way state machine for future readers

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Disco DeDisco
2026-05-20 11:56:09 -04:00
parent 611ca9b5b4
commit 191dad5365

View File

@@ -205,8 +205,20 @@ class MySeaDrawSeaLandingTest(FunctionalTest):
"""User w. sig → /gameboard/my-sea/ shows the DRY table hex (re-
used from my-sign / the room shell) w. a central FREE DRAW btn.
Element ID `id_draw_sea_btn` describes intent (the draw entry
point) — a future sprint will conditionally swap the label to
DRAW SEA once the daily free has been used."""
point); the hex-center btn is a 3-way state machine:
- FREE DRAW (`#id_draw_sea_btn`) — fresh user (no active row, no
deposit). Pinned here.
- PAID DRAW (`#id_my_sea_paid_draw_btn`) — deposit reserved.
Pinned by `MySeaLandingPaidDrawTest`.
- GATE VIEW (`#id_my_sea_gate_view_btn`) — quota spent, no
deposit (post-DEL). Pinned by
`MySeaDeleteDrawAndGuardPortalTest` (the DEL-confirm flow).
The three IDs are mutually exclusive — only one renders at a
time. This test pins the fresh-user side of that exclusion
(FREE DRAW present, the other two absent); the deposit + post-
DEL sides have their own dedicated FTs that pin the same
invariant from the other directions."""
self.create_pre_authenticated_session(self.email)
self.browser.get(self.live_server_url + "/gameboard/my-sea/")
# data-phase=landing on the page wrapper
@@ -221,6 +233,17 @@ class MySeaDrawSeaLandingTest(FunctionalTest):
self.assertIn("FREE", btn.text.upper())
self.assertIn("DRAW", btn.text.upper())
self.assertIn("btn-primary", btn.get_attribute("class"))
# Mutual exclusion: PAID DRAW + GATE VIEW must NOT also render.
self.assertEqual(
len(page.find_elements(By.CSS_SELECTOR, "#id_my_sea_paid_draw_btn")),
0,
"PAID DRAW btn must not render when no deposit is reserved",
)
self.assertEqual(
len(page.find_elements(By.CSS_SELECTOR, "#id_my_sea_gate_view_btn")),
0,
"GATE VIEW btn must not render when no active draw row exists",
)
# ── Test 2 ───────────────────────────────────────────────────────────────