Le scénario ajouté supposait que l'IntersectionObserver se redéclenchait
tout seul avec une liste courte — faux : il ne se déclenche qu'à une
*transition* d'intersection. Les pages font maintenant 15 éléments (la
liste déborde son conteneur, la sentinelle démarre sous la ligne de
flottaison) et chaque page suivante est demandée via un
`scrollTo("bottom")` explicite, qui produit une vraie transition.
Avec l'ancien code bugué, la sentinelle stale rappelle « cursor-2 » au 2e
scroll : « Page 3 Item 1 » n'apparaît jamais et un curseur est redemandé
— les deux assertions échouent.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
94 lines
4.2 KiB
Gherkin
94 lines
4.2 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
|
|
Then I should see the source item "Page 2 Item 1"
|
|
When I scroll the source list to the bottom
|
|
Then I should see the source item "Page 3 Item 1"
|
|
And no browse cursor should have been requested more than once
|
|
|
|
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
|