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:
Jean-Baptiste Bellet
2021-04-27 11:24:22 +02:00
parent 07881ede2d
commit 5085501f89

View File

@@ -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