Repository navigation
test(e2e): wait for the settled document title before axe checks - #45
Merged
Merged
Conversation
A client-side navigation can render the new page's heading before Next.js commits its <title>. expectAccessible ran axe as soon as the heading was visible, so on a slow runner it could sample an empty title and report a serious document-title violation. The onboarding setup project then failed and every dependent project lost its stored admin session. Wait for a non-empty title first. A page with no title still fails, now with a precise toHaveTitle message. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WJyn1D52aa77MxSKQGKQYp
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Root cause
expectAccessible(tests/e2e/support.ts) runs axe as soon as the step's heading is visible. Steps 2 and 3 of onboarding arrive by client-side navigation (router.replace), and Next.js 16 removes the old<title>and commits the new one separately. For a short window the new heading is on screen whiledocument.titleis"", so axe can report a seriousdocument-titleviolation. Theonboardingsetup project then fails,test-results/.auth/admin.jsonis never written, and every dependent project (desktop, mobile, git-workflow) fails on the missing authentication state.No page is actually untitled: every route declares
metadata.titleor inherits the root default. The failure is a timing race, which is whymainand #44 pass while #43's run failed.Fix
Wait for a non-empty title (
toHaveTitle(/\S/)) before running axe. This doesn't relax any check:toHaveTitlemessage instead of a generic axe report.I also tried
htmlLimitedBots: /.*/(blocking metadata for all user agents). It made the gap more frequent, so it is not included.Validation
Connect a repositoryheading is visible whiledocument.title === ""(the race, reproduced directly).toHaveTitle; a titled page passes.pnpm check: format, lint, typecheck, 354 tests pass.pnpm test:e2ewithE2E_GIT_REMOTE=https://github.com/docker/awesome-compose.git E2E_STACK_ROOT=nginx-golang: 33 passed, 9 skipped (the suite's own desktop-only and narrow-only splits).Limitation: the unmodified real suite did not fail locally (32 runs at up to 12× throttle), because axe's own start-up time usually covers the gap. This fix is based on the reproduced race, not a local red→green of the CI job. GitHub Actions log and artifact storage is blocked from my environment, so I could not read the original CI report.
Separate from the docs notifier PRs (#43/#44); test-only, no product change.
🤖 Generated with Claude Code
https://claude.ai/code/session_01WJyn1D52aa77MxSKQGKQYp
Generated by Claude Code