sea-select deal FT: scroll the revealed FLIP btn into view before the is_displayed assert — TDD

test_clicking_stack_shows_ok_btn is the only PickSeaDealTest that pairs _choose_spread w. an is_displayed() assert (the six-draws test checks the class instead). Once a spread is OK'd the felt scroll-snaps onto two pages + the deck stacks sit on the page the post-OK rAF scroll-to-cross targets — but headless Firefox DROPS that delayed scroll, leaving the clicked stack's revealed FLIP btn off the visible page → is_displayed False. scrollIntoView the btn first so the assert reflects the `--active` reveal, not the scroll position. Surfaced in CI build 374's channels stage (a flake that 373 survived on retry; my bd9155c preview edits only shifted the timing).

[[feedback-headless-delayed-scroll-dropped]]

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Disco DeDisco
2026-06-08 13:00:51 -04:00
parent 1a83c5f01c
commit c9fc5a2fd4

View File

@@ -301,7 +301,16 @@ class PickSeaDealTest(ChannelsFunctionalTest):
ok_btn = self.wait_for(lambda: self.browser.find_element(
By.CSS_SELECTOR, ".sea-deck-stack--levity .sea-stack-ok"
))
self.assertTrue(ok_btn.is_displayed())
# Choosing the spread scroll-snaps the felt onto two pages; the deck
# stacks sit on a different page than the post-OK scroll lands on in
# headless (the rAF scroll-to-cross is dropped, see
# [[feedback-headless-delayed-scroll-dropped]]), leaving the revealed OK
# btn off the visible page. Pull it into view so is_displayed reflects
# the `--active` reveal, not the scroll position.
self.browser.execute_script(
"arguments[0].scrollIntoView({block: 'center'})", ok_btn
)
self.wait_for(lambda: self.assertTrue(ok_btn.is_displayed()))
def test_clicking_elsewhere_hides_ok_btn(self):
"""Clicking outside a focused stack dismisses the OK btn."""