From 2ba9d250f2366ddf299cf994468b23a661621687 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Fri, 24 Jun 2022 18:24:35 +0100 Subject: [PATCH 1/2] Adds assertion on price breakdown modal --- .../consumer/shopping/variant_overrides_spec.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/spec/system/consumer/shopping/variant_overrides_spec.rb b/spec/system/consumer/shopping/variant_overrides_spec.rb index 9ae0b5dd21..7268a4dd45 100644 --- a/spec/system/consumer/shopping/variant_overrides_spec.rb +++ b/spec/system/consumer/shopping/variant_overrides_spec.rb @@ -102,6 +102,23 @@ describe "shopping with variant overrides defined", js: true do expect(page).to have_price with_currency(61.11) end + context "clicking the pie-chart icon" do + before do + visit shop_path + within "#variant-#{product1_variant1.id}" do + page.find(".graph-button").click + end + end + it "shows the price breakdown modal" do + within(:xpath, '//body') do + within(".price_breakdown") do + expect(page).to have_content("Price breakdown") + expect(page).to have_content("Packing fee") + end + end + end + end + # The two specs below reveal an unrelated issue with fee calculation. See: # https://github.com/openfoodfoundation/openfoodnetwork/issues/312 From 43b6ab5dc525af2749f7b4d34666a7ea1fd581d4 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Fri, 24 Jun 2022 20:56:19 +0100 Subject: [PATCH 2/2] Updates spec after merging #9325 --- spec/system/consumer/shopping/variant_overrides_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/system/consumer/shopping/variant_overrides_spec.rb b/spec/system/consumer/shopping/variant_overrides_spec.rb index 7268a4dd45..5fbb24de3e 100644 --- a/spec/system/consumer/shopping/variant_overrides_spec.rb +++ b/spec/system/consumer/shopping/variant_overrides_spec.rb @@ -109,11 +109,12 @@ describe "shopping with variant overrides defined", js: true do page.find(".graph-button").click end end + it "shows the price breakdown modal" do within(:xpath, '//body') do within(".price_breakdown") do expect(page).to have_content("Price breakdown") - expect(page).to have_content("Packing fee") + expect(page).to have_content(enterprise_fee.name.to_s) end end end