From 4db20858268e19c39ba1e6a55246a67fedd2aab9 Mon Sep 17 00:00:00 2001 From: Nicolas Date: Thu, 20 Aug 2026 13:56:42 +0200 Subject: [PATCH] fix(web-tests): scroll to the sources section before asserting visibility MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CI's e2e run confirmed the real cause: SourcesSection renders near the bottom of /parametres/foyer (after name, invite code, members), inside .app-content's own scrollable region — a bare `.should("be.visible")` doesn't auto-scroll (only interaction commands like `.click()`/`.check()` do), so the checkbox row was still clipped by that container's overflow when the assertion ran. Adds a dedicated "I scroll to the section" step and uses it before the sources-section assertions in household-settings.feature. Co-Authored-By: Claude Sonnet 5 --- apps/web/cypress/e2e/household-settings.feature | 1 + apps/web/cypress/support/step_definitions/common.steps.ts | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/apps/web/cypress/e2e/household-settings.feature b/apps/web/cypress/e2e/household-settings.feature index 6334a6f..d3bc168 100644 --- a/apps/web/cypress/e2e/household-settings.feature +++ b/apps/web/cypress/e2e/household-settings.feature @@ -61,6 +61,7 @@ Feature: Household settings And the household's enabled sources are empty And saving the source selection will succeed When I visit "/parametres/foyer" + And I scroll to the section "Sources disponibles" Then I should see the section "Sources disponibles" And I should see "TheMealDB" And I should see "Officielle" diff --git a/apps/web/cypress/support/step_definitions/common.steps.ts b/apps/web/cypress/support/step_definitions/common.steps.ts index b428189..86fd61a 100644 --- a/apps/web/cypress/support/step_definitions/common.steps.ts +++ b/apps/web/cypress/support/step_definitions/common.steps.ts @@ -125,6 +125,14 @@ Then("I should see the section {string}", (legend: string) => { cy.contains("legend", legend).should("be.visible"); }); +// Needed for a section that can render below the fold of `.app-content`'s +// own scroll (see layout.cy.ts) — a bare `.should("be.visible")` doesn't +// auto-scroll (only interaction commands like `.click()`/`.check()` do), +// so a section low on a long page needs this before asserting on it. +When("I scroll to the section {string}", (legend: string) => { + cy.contains("legend", legend).scrollIntoView(); +}); + Then("the checkbox {string} should be checked", (label: string) => { cy.contains("label", label).find("input[type=checkbox]").should("be.checked"); });