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.
98 lines
4.4 KiB
Gherkin
98 lines
4.4 KiB
Gherkin
Feature: Recipe catalog
|
|
As a signed-in user
|
|
I want to browse, search, and manage my recipes in a master-detail view
|
|
So that I can find a recipe and see/edit its details without leaving the list
|
|
|
|
Background:
|
|
Given I am signed in as "Alice" "Martin"
|
|
And my household id is 1
|
|
And the disliked ingredients list is empty
|
|
|
|
Scenario: Defaults to the Favoris tab and lists its recipes
|
|
Given the recipe catalog defaults to the favorites tab with "Ratatouille"
|
|
When I visit "/recettes"
|
|
Then the recipe list request should have been made
|
|
And I should see the heading "Recettes"
|
|
And the active tab should be "Favoris"
|
|
And the recipe "Ratatouille" should be visible in the table
|
|
And the recipe "Ratatouille" should be marked as favorite
|
|
And the recipe "Ratatouille" should show the diet badge "Végétarien"
|
|
|
|
Scenario: Shows the empty state when a tab has no recipes
|
|
Given the recipe catalog is empty
|
|
When I visit "/recettes"
|
|
Then I should see "Aucune recette pour le moment."
|
|
|
|
Scenario: Shows an error state when the catalog fails to load
|
|
Given the recipe catalog fails to load
|
|
When I visit "/recettes"
|
|
Then I should see "Impossible de charger"
|
|
|
|
Scenario: Switches tabs, re-fetching each one's own recipes
|
|
Given the recipe catalog switches between tabs
|
|
When I visit "/recettes"
|
|
Then the recipe list request should have been made
|
|
And the recipe "Ratatouille" should be visible in the table
|
|
When I click the tab "Perso"
|
|
Then the active tab should be "Perso"
|
|
And the recipe "Omelette" should be visible in the table
|
|
And the recipe "Ratatouille" should not be visible in the table
|
|
And the tab "Sources (bientôt)" should be disabled
|
|
|
|
Scenario: Searches within the active tab, debounced
|
|
Given the recipe catalog supports searching
|
|
When I visit "/recettes"
|
|
Then the recipe list request should have been made
|
|
And the recipe "Ratatouille" should be visible in the table
|
|
When I search for "Omel"
|
|
Then the recipe "Omelette" should be visible in the table
|
|
And the recipe "Ratatouille" should not be visible in the table
|
|
|
|
Scenario: Opens a recipe's detail alongside the table when its row is selected
|
|
Given the recipe catalog contains "Ratatouille" and "Omelette"
|
|
And recipe 2's detail is available
|
|
When I visit "/recettes"
|
|
And I click the recipe "Omelette" in the table
|
|
Then the recipe detail request should have been made
|
|
And the URL should include "/recettes/2"
|
|
And the recipe "Ratatouille" should be visible in the table
|
|
And the selected row should be "Omelette"
|
|
And the recipe detail panel heading should be "Omelette"
|
|
And the recipe detail panel should show "Une omelette toute simple."
|
|
And the recipe detail panel should show "Battre les œufs."
|
|
And the recipe detail panel should show "Cuire à la poêle."
|
|
|
|
Scenario: Shows a not-found message for a selected id the API rejects
|
|
Given the recipe catalog is empty
|
|
And recipe 999 does not exist
|
|
When I visit "/recettes/999"
|
|
Then the recipe detail panel should say the recipe doesn't exist
|
|
|
|
Scenario: Toggles a recipe's favorite from the detail panel and reflects it in the table
|
|
Given the recipe catalog contains "Omelette"
|
|
And recipe 2's detail is available
|
|
And toggling recipe 2's favorite will succeed
|
|
When I visit "/recettes/2"
|
|
Then the recipe "Omelette" should not be marked as favorite
|
|
When I click the favorite star
|
|
Then the favorite request should have been made
|
|
And the favorite star should be marked as favorite
|
|
And the recipe "Omelette" should be marked as favorite
|
|
|
|
Scenario: Deletes a recipe after a two-step confirmation, then clears the selection
|
|
Given the recipe catalog contains "Omelette"
|
|
And recipe 2's detail is available
|
|
And deleting recipe 2 will succeed
|
|
When I visit "/recettes/2"
|
|
Then the recipe detail panel heading should be "Omelette"
|
|
When I click "Supprimer" in the recipe detail panel
|
|
And I confirm the deletion in the recipe detail panel
|
|
Then the delete request should have been made
|
|
And the URL should match the recipes list
|
|
And the recipe "Omelette" should not be visible in the table
|
|
And I should see "Sélectionnez une recette dans le tableau"
|
|
|
|
Scenario: Links the new-recipe button to the recipe form
|
|
Given the recipe catalog is empty
|
|
When I visit "/recettes"
|
|
Then the new-recipe button should link to "/recettes/nouvelle"
|