Le scénario échouait en CI sur deux points de fragilité, pas sur le fond :
1. `IntersectionObserver` ne se redéclenche qu'à une *transition*
d'intersection — avec des pages courtes la sentinelle restait visible en
continu et seule la 2e page se chargeait. Les pages font maintenant 15
éléments (la liste déborde son conteneur) et chaque page suivante est
tirée par un `scrollTo("bottom")` explicite, répété 5 fois.
2. Une fois la liste débordante, `should("be.visible")` sur un élément
sorti du conteneur `overflow:auto` échoue (même classe de bug que #1) —
l'assertion "3e page chargée" fait maintenant `.scrollIntoView()` avant.
L'assertion anti-boucle porte sur le journal des curseurs demandés
(tolérance 2× pour le double-effet React StrictMode du serveur e2e), pas
sur un `Set.size` strict.
Vérifié localement : 7/7 avec le correctif, "Page 3 Item 1" jamais chargée
sans lui.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
92 lines
4.1 KiB
Gherkin
92 lines
4.1 KiB
Gherkin
Feature: Browsing external recipe sources
|
|
As a signed-in user
|
|
I want to browse the recipes available from my household's enabled sources
|
|
So that I can find new recipes to import, or jump straight to ones I already have
|
|
|
|
Background:
|
|
Given I am signed in as "Alice" "Martin"
|
|
And my household id is 1
|
|
And the disliked ingredients list is empty
|
|
And the planning request returns nothing
|
|
|
|
Scenario: Shows no source tab when the household hasn't enabled any
|
|
Given the recipe catalog contains nothing
|
|
And the sources reference list has options
|
|
And the household's enabled sources are empty
|
|
When I visit "/recettes"
|
|
Then I should not see "TheMealDB"
|
|
|
|
Scenario: Browses an enabled source, distinguishing already-imported items from new ones
|
|
Given the recipe catalog contains nothing
|
|
And the sources reference list has options
|
|
And the household has enabled TheMealDB
|
|
And browsing TheMealDB returns some items
|
|
And recipe 2's detail is available
|
|
When I visit "/recettes"
|
|
And I click the button "TheMealDB"
|
|
Then I should see the source item "Chicken Handi"
|
|
And I should see the source item "Fish Pie"
|
|
And the source item "Chicken Handi" should be marked as already imported
|
|
|
|
When I click the source item "Chicken Handi"
|
|
Then the URL should include "/recettes/2"
|
|
And the recipe detail panel heading should be "Omelette"
|
|
|
|
Scenario: Previews a not-yet-imported item, highlighting its detected techniques
|
|
Given the recipe catalog contains nothing
|
|
And the sources reference list has options
|
|
And the household has enabled TheMealDB
|
|
And browsing TheMealDB returns some items
|
|
And previewing TheMealDB item "9999" is available
|
|
When I visit "/recettes"
|
|
And I click the button "TheMealDB"
|
|
And I click the source item "Fish Pie"
|
|
Then the URL should include "/recettes/sources/theMealDb/9999"
|
|
And the recipe detail panel heading should be "Fish Pie"
|
|
And I should see the highlighted technique "Cuire"
|
|
|
|
Scenario: Loads further pages automatically, with no "load more" button
|
|
Given the recipe catalog contains nothing
|
|
And the sources reference list has options
|
|
And the household has enabled TheMealDB
|
|
And browsing TheMealDB returns two pages of items
|
|
When I visit "/recettes"
|
|
And I click the button "TheMealDB"
|
|
Then I should see the source item "Chicken Handi"
|
|
And I should see the source item "Beef Wellington"
|
|
And I should not see "Voir plus"
|
|
|
|
Scenario: Walks several pages with distinct cursors, then stops, without re-requesting a page
|
|
Given the recipe catalog contains nothing
|
|
And the sources reference list has options
|
|
And the household has enabled TheMealDB
|
|
And browsing TheMealDB returns three pages, each addressed by its own cursor
|
|
When I visit "/recettes"
|
|
And I click the button "TheMealDB"
|
|
Then I should see the source item "Page 1 Item 1"
|
|
When I scroll the source list to the bottom 5 times
|
|
Then the third page's items should have loaded
|
|
And no browse cursor should have been requested more than twice
|
|
|
|
Scenario: Offers a retry when loading the next page fails
|
|
Given the recipe catalog contains nothing
|
|
And the sources reference list has options
|
|
And the household has enabled TheMealDB
|
|
And browsing TheMealDB's next page fails once, then succeeds
|
|
When I visit "/recettes"
|
|
And I click the button "TheMealDB"
|
|
Then I should see the source item "Chicken Handi"
|
|
And I should see a message to retry loading more
|
|
When I click the button "Réessayer"
|
|
Then I should see the source item "Beef Wellington"
|
|
|
|
Scenario: Deep-links straight to a not-yet-imported item's own page, with no import affordance at all
|
|
Given the recipe catalog contains nothing
|
|
And the sources reference list has options
|
|
And the household has enabled TheMealDB
|
|
And browsing TheMealDB returns some items
|
|
And previewing TheMealDB item "9999" is available
|
|
When I visit "/recettes/sources/theMealDb/9999"
|
|
Then the recipe detail panel heading should be "Fish Pie"
|
|
And I should not see "Importer cette recette"
|
|
And I should see a discreet link to the item's original page
|