Skip to content

Specs: Recently Viewed Products

Acceptance scenarios

Scenario 1 — Strip appears after visiting a product

Given I am on the product catalog page and the recently-viewed list is empty, When I navigate to a product detail page and then return to the catalog page, Then the recently-viewed strip is visible below the product grid, And it shows the product I just visited (thumbnail + name).

Scenario 2 — Newest item appears first

Given the recently-viewed strip already shows products A and B (A is older), When I visit product C's detail page and return to the catalog, Then the strip shows C, B, A in that order (newest first).

Scenario 3 — Cap at 10 items

Given the recently-viewed list already contains 10 products, When I visit an 11th product's detail page and return to the catalog, Then the strip shows no more than 10 entries, And the oldest entry (11th from the top) has been removed.

Scenario 4 — Duplicate moves to front

Given the recently-viewed strip shows products A, B, C, When I visit product B's detail page again and return to the catalog, Then the strip shows B, A, C (B moved to front, no duplicate).

Scenario 5 — Remove item with "×" button

Given the recently-viewed strip is visible with at least one item, When I click the "×" button on an item, Then that item is removed from the strip without a page reload, And it is also removed from localStorage.

Scenario 6 — Strip hidden when list is empty

Given the recently-viewed list is empty (no products visited, or all removed), When I view the product catalog page, Then the recently-viewed strip is not visible (no empty container, no heading).

Scenario 7 — Clicking strip item navigates to detail page

Given the recently-viewed strip shows a product, When I click the product's thumbnail or name, Then I am navigated to that product's detail page (/products/:id).

Scenario 8 — Data persists across page refresh

Given the recently-viewed strip shows at least one product, When I refresh the browser, Then the strip still shows the same products (data survives in localStorage).

Copyright © MSG Systems Romania AI Labs