Feature: Shopping list
  As a signed-in user
  I want to see every ingredient needed for this week's planned recipes, already summed
  So that I know what to buy without recomputing it myself

  Background:
    Given I am signed in as "Alice" "Martin"
    And today is frozen at "2026-08-17T09:00:00.000Z"

  Scenario: Nothing planned this week shows the empty message, not an error
    Given the shopping list for "2026-08-17" is empty
    When I visit "/liste-de-courses"
    Then I should see "Aucun ingrédient à acheter pour cette semaine — ajoutez des recettes à votre planning."

  Scenario: Ingredients are grouped by aisle, in canonical order, each with its summed quantity
    Given the shopping list for "2026-08-17" contains:
      | ingredientKey | icon | category       | quantity | unitKey  |
      | egg           | EGG  | dairyAndCheese | 6        | piece    |
      | tomato        | VEGETABLE | freshProduce | 400    | gram     |
    When I visit "/liste-de-courses"
    Then the shopping list group "Produits frais" should appear before "Crémerie & fromage"
    And the shopping list should show "Tomate" at quantity "400 g"
    And the shopping list should show "Oeuf" at quantity "6 unité"

  Scenario: Navigating to another week fetches and shows that week's own list
    Given the shopping list for "2026-08-17" is empty
    And the shopping list for "2026-08-24" contains:
      | ingredientKey | icon | category     | quantity | unitKey |
      | onion         | VEGETABLE | freshProduce | 1  | kilogram |
    When I visit "/liste-de-courses"
    And I click the next week arrow
    Then the shopping list should show "Oignon" at quantity "1 kg"
