Skip to content

fix(frontend,e2e): stop Cypress flakes from #mount scroll - #1054

Merged
northdpole merged 1 commit into
mainfrom
e2e-mount-scroll-fix
Sep 5, 2026
Merged

fix(frontend,e2e): stop Cypress flakes from #mount scroll#1054
northdpole merged 1 commit into
mainfrom
e2e-mount-scroll-fix

Conversation

@northdpole

Copy link
Copy Markdown
Collaborator

Summary

  • Root cause of intermittent Test-e2e failures on main: smoke.cy.jshome search routes to search results page times out because h1.standard-page__heading ("Results matching") is clipped by #mount (overflow-y: auto). body is overflow: hidden, so window.scrollTo(0, 0) in page mounts was a no-op.
  • Add scrollMountToTop() and use it on Search / Root CREs / CRE / Standard / Graph mounts (same pattern Docs already documents).
  • Harden smoke/cre heading asserts with scrollIntoView.
  • Keep the scripts/seed_e2e_fixtures.py contract (Mutually authenticate, ASVS/V13.2.5). Do not swap root CRE asserts to Cryptography (that CRE is the free-text search fixture only).

Why not #1050 as-is

#1050 correctly noticed the scrollIntoView need, but also:

  1. Replaced root CRE Mutually authenticate with Cryptography (wrong fixture role).
  2. Weakened standard.cy.js data-bearing asserts — those were already passing on main.

Supersedes #1050.

Test plan

  • Confirmed failing main runs all flake on home search + clipped standard-page__heading
  • CI Test-e2e green on this PR
  • make frontend / lint as required by CI

Made with Cursor

…akes

body is overflow:hidden and #mount is the real scroll container, so
window.scrollTo(0,0) was a no-op. That left search/browse headings clipped
and made smoke.cy.js "home search" flake on main.

Add scrollMountToTop(), use it on page mounts, and harden e2e heading
asserts with scrollIntoView while keeping the seed fixture contract
(Mutually authenticate / V13.2.5).
@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Team

Run ID: df0516fe-3cd6-46cd-96e0-228f7a3b16e9

📥 Commits

Reviewing files that changed from the base of the PR and between 2e5d47d and e7f6f2a.

📒 Files selected for processing (10)
  • application/frontend/src/pages/BrowseRootCres/browseRootCres.tsx
  • application/frontend/src/pages/CommonRequirementEnumeration/CommonRequirementEnumeration.tsx
  • application/frontend/src/pages/Graph/Graph.tsx
  • application/frontend/src/pages/Search/SearchName.tsx
  • application/frontend/src/pages/Standard/Standard.tsx
  • application/frontend/src/pages/Standard/StandardSection.tsx
  • application/frontend/src/utils/index.ts
  • application/frontend/src/utils/scroll.ts
  • cypress/e2e/cre.cy.js
  • cypress/e2e/smoke.cy.js

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


Summary by CodeRabbit

  • Bug Fixes

    • Improved page navigation so views consistently return to the top when loading new content.
    • Added fallback scrolling behavior for pages with different scroll containers.
  • Tests

    • Updated end-to-end tests to bring target content into view before checking visibility, improving test reliability.

Walkthrough

The PR adds a shared scroll-reset helper for the #mount container, applies it across six page components, and updates Cypress assertions to scroll elements into view before visibility checks.

Changes

SPA scroll reset

Layer / File(s) Summary
Shared scroll reset helper
application/frontend/src/utils/scroll.ts, application/frontend/src/utils/index.ts
Adds and exports scrollMountToTop, which resets #mount or falls back to window.scrollTo(0, 0).
Page navigation integration
application/frontend/src/pages/BrowseRootCres/browseRootCres.tsx, application/frontend/src/pages/CommonRequirementEnumeration/CommonRequirementEnumeration.tsx, application/frontend/src/pages/Graph/Graph.tsx, application/frontend/src/pages/Search/SearchName.tsx, application/frontend/src/pages/Standard/*
Replaces direct window scrolling with scrollMountToTop() in page data-loading effects.
Scrollable content assertions
cypress/e2e/cre.cy.js, cypress/e2e/smoke.cy.js
Scrolls target headings and search results into view before visibility assertions. Adds fixture comments for the browse and search data.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to e7f6f

Navigation now resets the application’s actual scroll container, preventing pages from opening mid-scroll and stabilizing relevant visibility checks. The change is ready to merge.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: fixing Cypress flakes caused by the #mount scroll container.
Description check ✅ Passed The description directly explains the scroll-container root cause, the code changes, the E2E test updates, and the preserved fixture contract.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch e2e-mount-scroll-fix

Warning

Some tools did not complete. Review the errors below.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

application/frontend/src/pages/BrowseRootCres/browseRootCres.tsx

ESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox.

application/frontend/src/pages/CommonRequirementEnumeration/CommonRequirementEnumeration.tsx

ESLint skipped: the matched ESLint configuration already failed (missing-dependency).

application/frontend/src/pages/Graph/Graph.tsx

ESLint skipped: the matched ESLint configuration already failed (missing-dependency).

  • 7 others

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.

@northdpole
northdpole merged commit 5a3c384 into main Sep 5, 2026
11 checks passed
@northdpole
northdpole deleted the e2e-mount-scroll-fix branch September 5, 2026 17:33
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.

1 participant