mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-30 06:31:16 +00:00
Merge pull request #11452 from dacook/flaky-spec-products_v3-11328
[Flaky] spec/system/admin/products_v3/products_spec.rb
This commit is contained in:
@@ -53,6 +53,8 @@ describe 'As an admin, I can see the new product page' do
|
||||
within ".pagination" do
|
||||
click_link "2"
|
||||
end
|
||||
|
||||
expect(page).to have_content "Showing 16 to 30"
|
||||
expect_page_to_be 2
|
||||
expect_per_page_to_be 15
|
||||
expect_products_count_to_be 15
|
||||
@@ -60,6 +62,8 @@ describe 'As an admin, I can see the new product page' do
|
||||
|
||||
it "can change the number of products per page" do
|
||||
select "50", from: "per_page"
|
||||
|
||||
expect(page).to have_content "Showing 1 to 50"
|
||||
expect_page_to_be 1
|
||||
expect_per_page_to_be 50
|
||||
expect_products_count_to_be 50
|
||||
@@ -67,18 +71,19 @@ describe 'As an admin, I can see the new product page' do
|
||||
end
|
||||
|
||||
describe "search" do
|
||||
before do
|
||||
visit admin_products_v3_index_url
|
||||
end
|
||||
|
||||
context "product has searchable term" do
|
||||
# create a product with a name that can be searched
|
||||
let!(:product_by_name) { create(:simple_product, name: "searchable product") }
|
||||
|
||||
before do
|
||||
visit admin_products_v3_index_url
|
||||
end
|
||||
|
||||
it "can search for a product" do
|
||||
search_for "searchable product"
|
||||
|
||||
expect(page).to have_field "search_term", with: "searchable product"
|
||||
# expect(page).to have_content "1 product found for your search criteria."
|
||||
expect_products_count_to_be 1
|
||||
end
|
||||
|
||||
@@ -86,21 +91,26 @@ describe 'As an admin, I can see the new product page' do
|
||||
within ".pagination" do
|
||||
click_link "2"
|
||||
end
|
||||
|
||||
expect(page).to have_content "Showing 16 to 30"
|
||||
expect_page_to_be 2
|
||||
expect_per_page_to_be 15
|
||||
expect_products_count_to_be 15
|
||||
search_for "searchable product"
|
||||
# expect(page).to have_content "1 product found for your search criteria."
|
||||
expect_products_count_to_be 1
|
||||
end
|
||||
|
||||
it "can clear filters" do
|
||||
search_for "searchable product"
|
||||
expect(page).to have_field "search_term", with: "searchable product"
|
||||
# expect(page).to have_content "1 product found for your search criteria."
|
||||
expect_products_count_to_be 1
|
||||
expect(page).to have_field "Name", with: product_by_name.name
|
||||
|
||||
click_link "Clear search"
|
||||
expect(page).to have_field "search_term", with: ""
|
||||
expect(page).to have_content "Showing 1 to 15"
|
||||
expect_page_to_be 1
|
||||
expect_products_count_to_be 15
|
||||
end
|
||||
@@ -118,8 +128,11 @@ describe 'As an admin, I can see the new product page' do
|
||||
let!(:product_by_supplier) { create(:simple_product, supplier: producer) }
|
||||
|
||||
it "can search for a product" do
|
||||
visit admin_products_v3_index_url
|
||||
|
||||
search_by_producer "Producer 1"
|
||||
|
||||
# expect(page).to have_content "1 product found for your search criteria."
|
||||
expect(page).to have_select "producer_id", selected: "Producer 1"
|
||||
expect_products_count_to_be 1
|
||||
end
|
||||
@@ -132,8 +145,11 @@ describe 'As an admin, I can see the new product page' do
|
||||
}
|
||||
|
||||
it "can search for a product" do
|
||||
visit admin_products_v3_index_url
|
||||
|
||||
search_by_category "Category 1"
|
||||
|
||||
# expect(page).to have_content "1 product found for your search criteria."
|
||||
expect(page).to have_select "category_id", selected: "Category 1"
|
||||
expect_products_count_to_be 1
|
||||
expect(page).to have_field "Name", with: product_by_category.name
|
||||
|
||||
Reference in New Issue
Block a user