fix(cypress): allow scrollTo on non-scrollable pages in footer dropup test

cy.scrollTo('bottom') threw on CI ("element is not scrollable") whenever
the rendered page fit inside the viewport. Pass ensureScrollable:false
so the call is a no-op on short pages — the footer is already in view
and the subsequent rect-position pre-check enforces the actual
precondition that chooseDirection() needs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-11 02:38:06 +02:00
parent 28a796e24f
commit 4424db22cb

View File

@@ -46,11 +46,12 @@ describe('Navigation dropdowns', () => {
.as('menu') .as('menu')
.should('not.have.class', 'show'); .should('not.have.class', 'show');
// Scroll the page so the footer sits at the bottom of the viewport, // Make sure the footer sits at the bottom of the viewport before clicking
// then click without Cypress re-scrolling — otherwise the toggle could // — otherwise the toggle could land near the top and chooseDirection would
// land near the top of the viewport and chooseDirection would keep // keep .dropdown (more space below than above).
// .dropdown (more space below than above). // ensureScrollable:false because on short pages the body isn't scrollable
cy.scrollTo('bottom'); // and the footer is already in view (which is fine for this test).
cy.scrollTo('bottom', { ensureScrollable: false });
cy.get('@toggle').then($toggle => { cy.get('@toggle').then($toggle => {
const rect = $toggle[0].getBoundingClientRect(); const rect = $toggle[0].getBoundingClientRect();
expect(rect.top, 'toggle is in the lower half of the viewport') expect(rect.top, 'toggle is in the lower half of the viewport')