Fix intermittent login navigation race in feature specs - #2847
Open
mroderick wants to merge 1 commit into
Open
Conversation
login() returned once the OAuth redirect chain had committed navigation, but a request issued straight after could still race the chain and resolve to its landing page instead. That surfaced as an intermittent failure in accepting_terms_and_conditions_spec, where visiting /dashboard right after login landed on /. Wait for the member nav, which is only rendered once the session is established, before returning from login().
mroderick
marked this pull request as ready for review
September 8, 2026 10:57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes an intermittent feature-spec failure where a request issued straight after
login(member)resolved to the OAuth chain's landing page instead of the requested path.Observed in #2846's CI run (34213281043):
accepting_terms_and_conditions_spec.rbexpected/dashboardaftervisit dashboard_pathbut got/- the page the auth redirect chain lands on. The run was not deterministic: the same job passed on re-run and the full suite passed four times locally with CI's seed (8255).Root cause:
LoginHelpers#loginreturns oncevisit '/auth/codebar'has committed navigation, but the OAuth redirect chain can still be in flight. Avisitissued immediately after can race it and land on the chain's destination instead of the requested path.Fix:
login()now waits for#navbarDropdownMenuLinkMember- the member nav toggle, rendered only once the session is established - before returning. The wait resolves as soon as the chain settles, so it adds no measurable time to passing runs.Details:
Why this fix point
login()is the shared helper for all feature specs, so fixing it there covers the whole flake class rather than only the spec that happened to fail. Verified: the targeted spec passes 5/5 runs with CI's seed, and the full suite passes with the change (1308 examples, 0 failures). RuboCop clean.