batchCooking/apps/web/cypress/e2e/household-settings.feature
Nicolas 20d52aee2d feat(web): migre les specs Cypress vers Cucumber/Gherkin
Les tests e2e (apps/web/cypress/e2e/) étaient de simples specs Cypress
(.cy.ts), sans lien avec Cucumber alors qu'apps/api utilise déjà
Gherkin pour ses propres tests BDD. Intègre
@badeball/cypress-cucumber-preprocessor pour écrire les scénarios
utilisateurs en Gherkin des deux côtés, même vocabulaire.

- cypress.config.ts : specPattern sur *.feature, wiring du
  préprocesseur (esbuild bundler + plugin cucumber)
- Les 11 fichiers .cy.ts sont remplacés par des paires .feature/.steps.ts
  (co-localisées, même nom) — conversion complète, comportement
  équivalent (mêmes intercepts, mêmes assertions)
- cypress/support/step_definitions/common.steps.ts : steps partagés
  entre features (connexion, navigation, assertions génériques de
  texte/URL/champ) — globaux à toute la suite, réutilisables tels quels
- cypress/support/profile.ts : profil du compte "connecté" courant,
  assemblé au fil de plusieurs Given avant le premier visit/When
- README : nouvelle section "Cucumber (apps/web)" (miroir de la section
  existante pour apps/api), mise à jour des références aux anciens noms
  de fichiers .cy.ts (déjà obsolètes avant ce changement)

Vérification : impossible d'exécuter Cypress dans cet environnement
(crash Electron/GPU au lancement, limitation déjà documentée dans le
README — reproductible sur main, indépendante de ce changement). À la
place :
- les 447 steps Gherkin des 11 .feature ont été vérifiés
  programmatiquement contre les 165 patterns de step enregistrés : 0
  non résolu, 0 ambigu
- les 11 .feature parsent correctement avec le parser Gherkin officiel
  (57 scénarios au total)
- tous les .steps.ts passent `biome check` (syntaxe + style) sans erreur
- CYPRESS_INSTALL_BINARY déjà géré (voir PR précédente) — le binaire est
  bien présent localement (`cypress verify` OK), donc le blocage est
  spécifiquement le sandbox GPU de cet environnement, pas l'installation

La vraie exécution reste à vérifier via le job `e2e` de la CI GitHub
Actions sur cette PR — c'est le chemin déjà documenté dans le README
pour cet environnement précis.
2026-08-19 09:42:29 +02:00

90 lines
3.7 KiB
Gherkin

Feature: Household settings
As a signed-in user
I want to create, join, manage, or leave a household
So that I can share a batch-cooking plan with the people I cook with
Scenario: Offers to create or join a household when I have none yet
Given I am signed in as "Alice" "Martin"
And the household request returns no household
When I visit "/parametres/foyer"
Then I should see "Créer un foyer"
And I should see "Rejoindre un foyer"
Scenario: Creates a household
Given I am signed in as "Alice" "Martin"
And creating a household will succeed
When I visit "/parametres/foyer"
And I fill in the "houseName" field with "Chez Alice"
And I click the button "Créer"
Then the household creation request should have been made with name "Chez Alice"
And I should see "ABCD2345"
Scenario: Joins a household by invite code
Given I am signed in as "Alice" "Martin"
And joining a household will succeed
When I visit "/parametres/foyer"
And I fill in the "inviteCode" field with "abcd2345"
And I click the button "Rejoindre"
Then the household join request should have been made with invite code "ABCD2345"
And I should see "Bob Dupont"
Scenario: Shows the household's name, invite code, and members with an admin badge
Given I am signed in as "Alice" "Martin"
And my household id is 1
And the household request returns the two-member household
When I visit "/parametres/foyer"
Then the "houseName" field should have the value "Chez Alice"
And I should see "ABCD2345"
And I should see "Bob Dupont"
And "Alice Martin" should be marked as Admin
Scenario: Autosaves the household name
Given I am signed in as "Alice" "Martin"
And my household id is 1
And the household request returns the two-member household
And renaming the household will succeed
When I visit "/parametres/foyer"
And I clear the "houseName" field
And I fill in the "houseName" field with "Chez les Martin"
Then the household rename request should have been made with name "Chez les Martin"
And I should see "Enregistré "
Scenario: Removes a member
Given I am signed in as "Alice" "Martin"
And my household id is 1
And the household request returns the two-member household
And removing Bob from the household will succeed
When I visit "/parametres/foyer"
And I click "Retirer" for the member "Bob Dupont"
Then the member removal request should have been made
And I should not see "Bob Dupont"
Scenario: Deletes the household after confirming
Given I am signed in as "Alice" "Martin"
And my household id is 1
And the household request returns the two-member household
And deleting the household will succeed
When I visit "/parametres/foyer"
And I click the button "Supprimer le foyer"
And I click the button "Confirmer la suppression"
Then the household deletion request should have been made
And I should see "Créer un foyer"
Scenario: Offers to leave the household instead of deleting it, as a non-admin member
Given I am signed in as "Bob" "Dupont"
And my user id is 2
And my household id is 1
And the household request returns the two-member household
When I visit "/parametres/foyer"
Then I should see "Quitter le foyer"
And I should not see "Supprimer le foyer"
Scenario: Leaves the household
Given I am signed in as "Bob" "Dupont"
And my user id is 2
And my household id is 1
And the household request returns the two-member household
And leaving the household will succeed
When I visit "/parametres/foyer"
And I click the button "Quitter le foyer"
Then the household leave request should have been made