Skip to content

Commit a03fc9b

Browse files
test(e2e): capture the picker's state when the 409 journey's click times out
test_409_from_a_second_tab_offers_reattach_that_adopts_the_session failed on PR #24's first run (35380095596, e2e 568/569) with the same symptom c8b832f addressed on 2026-09-18: Locator.click on the Start button timed out, "element is not visible", after the settled wait it added had passed. That fix rested on init()'s state fetch landing late; this recurrence says that was not the whole mechanism. Read against the second failure: the timer has no periodic state poll, its only click-free adopt path is init()'s single fetch (which the settled wait covers — `topic` starts as 'Loading...'), the console's own load-time adoption writes nothing into the timer, and no nav.go fires without a click. Nothing found explains a hidden picker. The failure diagnostics artifact held nothing for this test either: the timeout fires before its own _diag hook. So the click now records what a third occurrence needs — the nav view, sessionActive/starting/topic/agent/resolvedTopic, the held conflict id, the picker's computed display, the button's disabled state and the URL — to a JSON beside a screenshot and DOM dump, then re-raises. No behaviour or timing changed: the fix must rest on that evidence, not on a guess. Class 7/7 locally in natural order; ruff/pyright clean.
1 parent ad598fb commit a03fc9b

1 file changed

Lines changed: 37 additions & 1 deletion

File tree

‎packages/studyloop/tests/e2e/test_session_recovery_journey.py‎

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,43 @@ def test_409_from_a_second_tab_offers_reattach_that_adopts_the_session(
347347
d.agent = 'codex';
348348
}"""
349349
)
350-
page.locator("[data-testid='study-start-session']").click()
350+
# Twice on CI this click has timed out with "element is not visible"
351+
# (runs 35341660469 and 35380095596) after the settled wait above passed,
352+
# and neither run produced evidence of WHY the picker was hidden: the
353+
# timeout fires before this test's own _diag hook, so the artifact held
354+
# nothing for it. Every adopt path in the timer was read against the
355+
# second failure and none explains it without a click. Capture the
356+
# state at the click so a third occurrence names the mechanism instead
357+
# of the symptom -- the fix must rest on that, not on a guess.
358+
try:
359+
page.locator("[data-testid='study-start-session']").click()
360+
except Exception: # pragma: no cover - diagnostics only
361+
state = page.evaluate(
362+
"""() => {
363+
const root = document.querySelector('[x-data="sessionTimer()"]');
364+
const d = root && window.Alpine.$data(root);
365+
const picker = document.querySelector('.study-start-picker');
366+
const button = document.querySelector("[data-testid='study-start-session']");
367+
return {
368+
view: window.Alpine.store('nav').current,
369+
sessionActive: d && d.sessionActive,
370+
starting: d && d.starting,
371+
topic: d && d.topic,
372+
agent: d && d.agent,
373+
resolvedTopic: d && d.resolvedTopic(),
374+
conflict: d && d.conflictSession ? d.conflictSession.study_session_id : null,
375+
pickerDisplay: picker && getComputedStyle(picker).display,
376+
buttonDisabled: button && button.disabled,
377+
url: location.href,
378+
};
379+
}"""
380+
)
381+
RESULTS.mkdir(parents=True, exist_ok=True)
382+
(RESULTS / "session-recovery-409-click-timeout.json").write_text(
383+
json.dumps(state, indent=2), encoding="utf-8"
384+
)
385+
_diag(page, "409-click-timeout")
386+
raise
351387

352388
error = page.locator(".study-start-picker .picker-error")
353389
try:

0 commit comments

Comments
 (0)