From 014ffef16cf7ecc1a733ebbc52428ac91d55d935 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Bellet Date: Mon, 15 Mar 2021 21:51:52 +0100 Subject: [PATCH] Add tests about unit price inside the cart sidebar - Test if the question mark icon is present - Click to show the tooltip - Another click to hide the tooltip --- .../consumer/shopping/unit_price_spec.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/spec/features/consumer/shopping/unit_price_spec.rb b/spec/features/consumer/shopping/unit_price_spec.rb index 262d966cfb..c2ac3d951b 100644 --- a/spec/features/consumer/shopping/unit_price_spec.rb +++ b/spec/features/consumer/shopping/unit_price_spec.rb @@ -43,6 +43,25 @@ feature "As a consumer, I want to check unit price information for a product", j expect(page).not_to have_selector '.joyride-tip-guide.question-mark-tooltip' expect(page).to have_no_content I18n.t('js.shopfront.unit_price_tooltip') end + end + describe "into the cart sidebar" do + before do + visit shop_path + click_button "Add" + toggle_cart + end + + it "shows/hide the unit price information with the question mark icon in the sidebar" do + expect(page).to have_selector ".cart-content .question-mark-icon" + find(".cart-content .question-mark-icon").click + expect(page).to have_selector '.joyride-tip-guide.question-mark-tooltip' + within '.joyride-tip-guide.question-mark-tooltip' do + expect(page).to have_content I18n.t('js.shopfront.unit_price_tooltip') + end + page.find("body").click + expect(page).not_to have_selector '.joyride-tip-guide.question-mark-tooltip' + expect(page).to have_no_content I18n.t('js.shopfront.unit_price_tooltip') + end end end