Skip to content

test(e2e): wait for sign-out to finish before navigating - #102

Closed
TusanHomichi wants to merge 1 commit into
mainfrom
claude/83-signout-race
Closed

TusanHomichi wants to merge 1 commit into
mainfrom
claude/83-signout-race

Conversation

@TusanHomichi

Copy link
Copy Markdown
Member

Primary Issue

There's no separate issue. This is a test-only fix for a failure found on #91's pr-gate run. It is related to, but distinct from, #83 (a different intermittent spec).

Problem And Outcome

pr-gate on #91 (e9f3758) failed in drafts.spec.ts:113: the test timed out at getByLabel('Username') on /reset. The PR's diff did not cause it.

The cause is a race in the tests. The shell keeps a signed-in browser out of /login and /reset; shell.spec.ts already notes "Still signed in → guard bounces to status". Twelve steps in drafts.spec.ts and sessions.spec.ts click Sign out and immediately goto('/reset') or fill the sign-in form. If the logout request is still in flight, as it can be on a loaded runner, /reset bounces to the home page. For a trainer, home has no Username field, so the test waits out its 60 s timeout. Locally the test runs in 27–29 s, so the race window is normally hidden.

After this PR, no test can move on before the server has ended the session.

Changes

  • web/e2e/fixtures.ts: a new signOut(page) helper clicks Sign out and waits for /login. The shell only navigates there after logout() resolves.
  • Specs: every plain sign-out goes through the helper; 20 call sites, 12 of which had no wait at all. The one deliberate exception is draft-recovery.spec.ts:2419, which tests that a failed save refuses sign-out. Redundant /login assertions after the helper are removed.

Correction rung: 1 (one owning API). Waiting is now the only way the specs sign out.

Scope

Verification

Review And Merge Notes

🤖 Generated with Claude Code

https://claude.ai/code/session_01TsvZjbz8dTRM8A1NqAP5ts


Generated by Claude Code

The shell keeps a signed-in browser out of /login and /reset. Twelve
browser steps clicked Sign out and navigated straight on; when the
logout request was still in flight (a loaded CI runner), /reset bounced
to the home page and the next fill waited out the test timeout. It
failed pr-gate on #91 in drafts.spec.ts:113.

One owning helper, signOut(page) in fixtures.ts, clicks Sign out and
waits for /login, which the shell reaches only after the server ends
the session. Every plain sign-out goes through it; the one deliberate
exception tests that a failed save refuses sign-out. A scratch spec
that delays the logout response by 1.5 s reproduced the bounce with the
old pattern and passed with the helper.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01TsvZjbz8dTRM8A1NqAP5ts
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T20:05:21.578227Z af0f4a5 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Copy link
Copy Markdown
Member Author

Superseded: this exact commit was ported into #91 as 97d1488 to get that PR green, and #91 merged as 7c4d011. main now has the signOut(page) helper, and every plain sign-out goes through it. The only direct click left is the deliberate refusal test at draft-recovery.spec.ts:2419. Merging this branch would add nothing, so I'm closing it.

Verification of the change on main's tree: local full gates passed on 97d1488, with 59 browser tests (receipt sha256 8f20468f…). Hosted pr-gate passed on both af0f4a5 (this PR) and 97d1488.


Generated by Claude Code

@TusanHomichi
TusanHomichi deleted the claude/83-signout-race branch October 15, 2026 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants