Skip to content

Commit

Permalink
Selects white_label tab with trigger(click)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
filipefurtad0 committed Oct 15, 2023
1 parent e468443 commit a5e5209
Showing 1 changed file with 15 additions and 29 deletions.
44 changes: 15 additions & 29 deletions spec/system/admin/enterprises_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'
Expand All @@ -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"
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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'
Expand All @@ -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

Expand All @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit a5e5209

Please sign in to comment.