batchCooking/apps/web/cypress/e2e/recipes.feature
Nicolas ecf236c1a4 feat(tech-steps): distingue les corrections manuelles des détections auto
Les corrections utilisateur (via TechStepCorrectionPopover) sont
désormais écrites directement dans StepTechStep, avec une colonne
`source` ("auto" | "manual") qui les distingue des matches du
classifieur NLP :

- Migration `step_tech_step_source` ajoutant `source` (défaut "auto")
- `applyManualCorrection`/`renumberStepTechSteps` dans
  recipe-tech-step-correction.service.ts : une correction met à jour
  ou crée l'entrée StepTechStep concernée (source "manual"), la
  réponse de l'endpoint inclut désormais le techSteps à jour du step
  (SubmitTechStepCorrectionResult), pas seulement l'audit de
  correction
- backfill-tech-steps.ts préserve les entrées "manual" existantes :
  seules les entrées "auto" sont recalculées, et un nouveau match
  auto chevauchant une correction manuelle est ignoré plutôt
  qu'inséré en doublon — vérifié en base réelle (une correction
  manuelle survit intacte à un backfill complet)
- Le front distingue visuellement les deux (StepDescription.tsx,
  recipes.scss : `.step-tech-step--manual`, couleur Turmeric au lieu
  de Basil), avec un tooltip "(correction manuelle)" et un indicateur
  de découvrabilité de la fonctionnalité dans RecipeDetailPanel

Corrige aussi deux bugs trouvés en testant en conditions réelles :
- StepDescription.tsx : le clic sur un highlight existant lisait la
  variable `offset` (mutable, partagée par la boucle) au lieu d'une
  valeur capturée, envoyant un `end` erroné (fin de la description
  entière au lieu du span du mot cliqué)
- backfill-tech-steps.ts : le garde `import.meta.url ===
  file://${process.argv[1]}` ne matche jamais sur Windows (chemins à
  antislash), le script ne faisait donc rien en exécution directe ;
  remplacé par `pathToFileURL(process.argv[1]).href`

335 tests apps/api passants, 40/40 composants Cypress, 75/76 e2e
Cypress (1 flake pré-existant sans rapport, non touché ici).
2026-08-22 12:15:47 +02:00

59 lines
2.8 KiB
Gherkin

Feature: Managing a recipe from the catalog
As a signed-in user
I want to favorite or delete one of my recipes
So that I can curate my catalog as it grows
Background:
Given I am signed in as "Alice" "Martin"
And my household id is 1
And the disliked ingredients list is empty
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: Highlights a detected technique in a step, with its name shown on focus
Given the recipe catalog contains "Omelette"
And recipe 2's detail is available
When I visit "/recettes/2"
Then I should see the highlighted technique "Cuire"
When I focus the highlighted technique "Cuire"
Then the tooltip should show "Cuire"
Scenario: Corrects a detected technique from its highlight, visible immediately as a manual match
Given the recipe catalog contains "Omelette"
And recipe 2's detail is available
And the tech steps reference list has options
And correcting step 2's "Cuire" match will succeed
When I visit "/recettes/2"
And I click the highlighted technique "Cuire"
Then I should see the technique correction options
When I choose "Mijoter" as the correct technique
Then the correction request should have been made
# The highlighted *word* stays "Cuire" (a relabel changes which
# technique a span means, not the literal text at that span, still
# "Cuire" in the source description) — now styled as a manual
# correction, with its tooltip naming the newly-assigned technique.
And the highlighted technique "Cuire" should be marked as a manual correction
When I focus the highlighted technique "Cuire"
Then the tooltip should show "Mijoter (correction manuelle)"
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"