From e2eead0f864b3b3f689b3fddb7ad2dbbdbeca867 Mon Sep 17 00:00:00 2001 From: Maikel Linke Date: Fri, 22 Dec 2023 16:06:04 +1100 Subject: [PATCH] Scroll to reveal White Label tab The Vouchers tab pushed the White Label tab further down and it was hidden by the savebar. The CSS adjustment in this commit makes sure that users can always see all menu items. The automatic scrolling by Capybara fails because of the savebar but scrolling to the bottom works. --- app/webpacker/css/admin/side_menu.scss | 3 ++ spec/system/admin/enterprises_spec.rb | 44 ++++++++++---------------- 2 files changed, 20 insertions(+), 27 deletions(-) diff --git a/app/webpacker/css/admin/side_menu.scss b/app/webpacker/css/admin/side_menu.scss index 398787b7b8..f746c45cda 100644 --- a/app/webpacker/css/admin/side_menu.scss +++ b/app/webpacker/css/admin/side_menu.scss @@ -2,6 +2,9 @@ border-right: 2px solid #f6f6f6; border-top: 2px solid #f6f6f6; + /* Reserve space for the save bar to avoid hidden menu items. */ + margin-bottom: 2em; + .menu_item { display: block; padding: 8px 15px; diff --git a/spec/system/admin/enterprises_spec.rb b/spec/system/admin/enterprises_spec.rb index a70ed7084a..69c52cf6b1 100644 --- a/spec/system/admin/enterprises_spec.rb +++ b/spec/system/admin/enterprises_spec.rb @@ -623,9 +623,7 @@ describe ' before do visit edit_admin_enterprise_path(distributor1) - within(".side_menu") do - click_link "White Label" - end + select_white_label end it "set the hide_ofn_navigation preference for the current shop" do @@ -636,9 +634,7 @@ describe ' expect(distributor1.reload.hide_ofn_navigation).to be true visit edit_admin_enterprise_path(distributor1) - within(".side_menu") do - click_link "White Label" - end + select_white_label uncheck "Hide OFN navigation" click_button 'Update' @@ -655,9 +651,7 @@ describe ' expect(distributor1.reload.hide_ofn_navigation).to be true visit edit_admin_enterprise_path(distributor1) - within(".side_menu") do - click_link "White Label" - end + select_white_label expect(page).to have_content "LOGO USED IN SHOPFRONT" uncheck "Hide OFN navigation" @@ -672,9 +666,7 @@ describe ' distributor1.update_attribute(:hide_ofn_navigation, true) visit edit_admin_enterprise_path(distributor1) - within(".side_menu") do - click_link "White Label" - end + select_white_label end it "can updload the white label logo for the current shop" do @@ -694,9 +686,7 @@ describe ' distributor1.update white_label_logo: white_logo_file visit edit_admin_enterprise_path(distributor1) - within(".side_menu") do - click_link "White Label" - end + select_white_label end it "can remove the white label logo for the current shop" do @@ -750,9 +740,7 @@ describe ' expect(distributor1.reload.hide_groups_tab).to be true visit edit_admin_enterprise_path(distributor1) - within(".side_menu") do - click_link "White Label" - end + select_white_label uncheck "Hide groups tab in shopfront" click_button 'Update' @@ -764,9 +752,7 @@ describe ' context "creating custom tabs" do before do visit edit_admin_enterprise_path(distributor1) - within(".side_menu") do - click_link "White Label" - end + select_white_label check "Create custom tab in shopfront" end @@ -788,9 +774,7 @@ describe ' expect(page).to have_content("Custom tab title can't be blank") expect(distributor1.reload.custom_tab).to be_nil - within(".side_menu") do - click_link "White Label" - end + select_white_label expect(page).to have_checked_field "Create custom tab in shopfront" end @@ -813,9 +797,7 @@ describe ' before do distributor1.update(custom_tab:) visit edit_admin_enterprise_path(distributor1) - within(".side_menu") do - click_link "White Label" - end + select_white_label end it "display the custom tab fields with the current values" do @@ -1094,6 +1076,14 @@ describe ' end end end + + def select_white_label + # The savebar sits on top of the bottom menu item until we scroll. + scroll_to :bottom + within(".side_menu") do + click_link "White Label" + end + end end def update_message