From 686b5e806cf873b70083484968415ad4ffcc66c7 Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Sun, 15 Oct 2023 20:54:00 +0100 Subject: [PATCH] Scrolls to bottom, before selecting white_label tab This was failing in master https://github.com/openfoodfoundation/openfoodnetwork/actions/runs/6526053987/job/17719399175 but somehow passing locally; scrolling down should allow finding the element --- spec/system/admin/enterprises_spec.rb | 45 ++++++++++----------------- 1 file changed, 16 insertions(+), 29 deletions(-) diff --git a/spec/system/admin/enterprises_spec.rb b/spec/system/admin/enterprises_spec.rb index d15ed6167c4..a8f0041ea55 100644 --- a/spec/system/admin/enterprises_spec.rb +++ b/spec/system/admin/enterprises_spec.rb @@ -614,10 +614,7 @@ context "white label settings" do 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 @@ -628,9 +625,7 @@ 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' @@ -647,9 +642,7 @@ 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" @@ -664,9 +657,7 @@ 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 @@ -686,9 +677,7 @@ 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 @@ -742,9 +731,7 @@ 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' @@ -756,9 +743,7 @@ 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 @@ -780,9 +765,7 @@ 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 @@ -805,9 +788,7 @@ 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 @@ -932,7 +913,6 @@ expect(page).to have_content "Profile Only" expect(page).to have_content "Hub Shop" - # Producer hub option is selected page.find('a', class: 'selected', text: "Hub Shop") expect(enterprise.reload.is_primary_producer).to eq false @@ -1150,3 +1130,10 @@ def assert_profile expect(page).to have_content "Edit profile details" end end + +def select_white_label + within(".side_menu") do + scroll_to(:bottom) + click_link "White Label" + end +end