mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Add automated tests around pagination in product list for a shop
- with two order cycles and go from one to the other
This commit is contained in:
@@ -159,6 +159,31 @@ feature "As a consumer I want to shop with a distributor", js: true do
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "two order cycles and more than 20 products for each" do
|
||||
before do
|
||||
20.times do
|
||||
product = create(:simple_product, supplier: supplier)
|
||||
add_variant_to_order_cycle(exchange1, product.variants.first)
|
||||
add_variant_to_order_cycle(exchange2, product.variants.first)
|
||||
end
|
||||
end
|
||||
|
||||
it "show the whole products list for each OC" do
|
||||
visit shop_path
|
||||
select "turtles", from: "order_cycle_id"
|
||||
select "frogs", from: "order_cycle_id"
|
||||
expect(page).to have_selector("product", count: 10)
|
||||
scroll_to(page.find(".product-listing"), align: :bottom)
|
||||
expect(page).to have_selector("product", count: 20)
|
||||
|
||||
scroll_to(page.find("distributor"))
|
||||
select "turtles", from: "order_cycle_id"
|
||||
expect(page).to have_selector("product", count: 10)
|
||||
scroll_to(page.find(".product-listing"), align: :bottom)
|
||||
expect(page).to have_selector("product", count: 20)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user