two-browser sig FTs: read --priYl off :root live instead of a hardcoded rgb(255,207,52) — palette-tuning-resilient (build 377 fix)
Both SigSelectChannelsTest cursor/reservation FTs hardcoded the OLD --priYl = rgb(255,207,52); the palette tuning moved --priYl to 255,227,82, so the rendered NC role colour no longer matched and both failed in the test-two-browser-FTs stage (build 377). Now each reads --priYl off document.documentElement at run time and compares whitespace-stripped (so 255,227,82 matches rgb(255,227,82) and the rgb()/rgba() box-shadow forms alike) — future palette tweaks to --priYl won't re-break them. Docstrings de-hardcoded too. Couldn't run the channels/two-browser stage locally (needs Redis + dual Firefox); verified --priYl is a :root base var + py_compile clean; the assertion now tracks whatever --priYl renders. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -110,7 +110,7 @@ class SigSelectChannelsTest(ChannelsFunctionalTest):
|
||||
def test_nc_hover_activates_mid_cursor_in_pc_browser(self):
|
||||
"""
|
||||
When NC (levity mid) hovers a card, PC (levity left) must see the
|
||||
--mid cursor become active, coloured --priYl (rgb 255 207 52).
|
||||
--mid cursor become active, coloured the NC role's --priYl.
|
||||
Verifies: WS broadcast pipeline + JS applyHover + CSS role colouring.
|
||||
"""
|
||||
room, gamers = self._setup_sig_select_room()
|
||||
@@ -143,14 +143,23 @@ class SigSelectChannelsTest(ChannelsFunctionalTest):
|
||||
)
|
||||
)
|
||||
|
||||
# CSS colour check: portal float has data-role="NC" → --priYl = 255, 207, 52
|
||||
# CSS colour check: the portal float has data-role="NC" → coloured the
|
||||
# NC (levity-mid) role's --priYl. Read --priYl off :root LIVE rather than
|
||||
# hardcode an RGB, so palette tuning can't break this; whitespace-strip
|
||||
# both so "255, 227, 82" matches "rgb(255,227,82)".
|
||||
portal_sel = '.sig-cursor-float[data-role="NC"]'
|
||||
portal_cursor = self.browser.find_element(By.CSS_SELECTOR, portal_sel)
|
||||
color = self.browser.execute_script(
|
||||
"return window.getComputedStyle(arguments[0]).color",
|
||||
"return window.getComputedStyle(arguments[0]).color.replace(/\\s+/g, '');",
|
||||
portal_cursor,
|
||||
)
|
||||
self.assertEqual(color, "rgb(255, 207, 52)", f"Expected --priYl colour for NC cursor, got {color}")
|
||||
priyl = self.browser.execute_script(
|
||||
"return getComputedStyle(document.documentElement)"
|
||||
".getPropertyValue('--priYl').replace(/\\s+/g, '');"
|
||||
)
|
||||
self.assertEqual(
|
||||
color, f"rgb({priyl})",
|
||||
f"Expected --priYl rgb({priyl}) for NC cursor, got {color}")
|
||||
|
||||
# ── Mouse-off: anchor class removed, portal float gone ────────────
|
||||
ActionChains(browser2).move_to_element(
|
||||
@@ -171,7 +180,7 @@ class SigSelectChannelsTest(ChannelsFunctionalTest):
|
||||
def test_nc_reservation_glows_priYl_in_pc_browser(self):
|
||||
"""
|
||||
When NC (levity mid) clicks OK on a card, PC must see that card's border
|
||||
coloured --priYl (rgb 255 207 52) via the data-reserved-by CSS selector.
|
||||
coloured the NC role's --priYl via the data-reserved-by CSS selector.
|
||||
Verifies: sig_reserve view → WS broadcast → applyReservation → CSS glow.
|
||||
"""
|
||||
room, gamers = self._setup_sig_select_room()
|
||||
@@ -212,12 +221,19 @@ class SigSelectChannelsTest(ChannelsFunctionalTest):
|
||||
|
||||
reserved_card = self.browser.find_element(By.CSS_SELECTOR, reserved_card_sel)
|
||||
box_shadow = self.browser.execute_script(
|
||||
"return window.getComputedStyle(arguments[0]).boxShadow",
|
||||
"return window.getComputedStyle(arguments[0]).boxShadow.replace(/\\s+/g, '');",
|
||||
reserved_card,
|
||||
)
|
||||
# Read --priYl off :root LIVE so palette tuning can't break this; the
|
||||
# glow box-shadow renders the NC role colour as rgb()/rgba() — assert
|
||||
# the whitespace-stripped RGB triple appears either way.
|
||||
priyl = self.browser.execute_script(
|
||||
"return getComputedStyle(document.documentElement)"
|
||||
".getPropertyValue('--priYl').replace(/\\s+/g, '');"
|
||||
)
|
||||
self.assertIn(
|
||||
"255, 207, 52", box_shadow,
|
||||
f"Expected --priYl (255,207,52) in box-shadow for NC reservation, got {box_shadow}",
|
||||
priyl, box_shadow,
|
||||
f"Expected --priYl ({priyl}) in box-shadow for NC reservation, got {box_shadow}",
|
||||
)
|
||||
|
||||
finally:
|
||||
|
||||
Reference in New Issue
Block a user