From a5e5209eafbacdb5ec4548adc1b4f175db89108e Mon Sep 17 00:00:00 2001 From: filipefurtad0 Date: Sun, 15 Oct 2023 20:54:00 +0100 Subject: [PATCH] Selects white_label tab with trigger(click) Scrolling down did no fix it, it still fails https://github.com/openfoodfoundation/openfoodnetwork/actions/runs/6526149195/job/17719815533?pr=11645, selecting the element with trigger(click) should work --- spec/system/admin/enterprises_spec.rb | 44 +++++++++------------------ 1 file changed, 15 insertions(+), 29 deletions(-) diff --git a/spec/system/admin/enterprises_spec.rb b/spec/system/admin/enterprises_spec.rb index d15ed6167c4..4c1bf959a00 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,9 @@ def assert_profile expect(page).to have_content "Edit profile details" end end + +def select_white_label + within(".side_menu") do + find(:link, "White Label").trigger("click") + end +end