Skip to content

test(e2e): wait for the settled document title before axe checks - #45

Merged
uniskela merged 1 commit into
mainfrom
fix/onboarding-document-title
Oct 9, 2026
Merged

uniskela merged 1 commit into
mainfrom
fix/onboarding-document-title

Conversation

@uniskela

@uniskela uniskela commented Oct 9, 2026

Copy link
Copy Markdown
Owner

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 while document.title is "", so axe can report a serious document-title violation. The onboarding setup project then fails, test-results/.auth/admin.json is 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.title or inherits the root default. The failure is a timing race, which is why main and #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:

  • An untitled page still fails, now with a precise toHaveTitle message instead of a generic axe report.
  • Every caller (onboarding, desktop and mobile specs) gets the same guard.

I also tried htmlLimitedBots: /.*/ (blocking metadata for all user agents). It made the gap more frequent, so it is not included.

Validation

  • Probe with Chromium CPU throttled 6×: the Connect a repository heading is visible while document.title === "" (the race, reproduced directly).
  • Guard check: an untitled page still rejects with toHaveTitle; a titled page passes.
  • pnpm check: format, lint, typecheck, 354 tests pass.
  • Full pnpm test:e2e with E2E_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

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
@coderabbitai

coderabbitai Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3b51a9da-ede1-4cce-b918-a39153c98323
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@uniskela
uniskela merged commit f5e4add into main Oct 9, 2026
10 checks passed
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