From 675e8bec834dac7a307336c2a4415e5618ff7b2a Mon Sep 17 00:00:00 2001 From: Joonas Date: Thu, 28 Nov 2024 15:41:57 +0200 Subject: [PATCH] Fix spec --- .../spec/system/answer_questionnaire_spec.rb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/decidim-module-forms_locations/spec/system/answer_questionnaire_spec.rb b/decidim-module-forms_locations/spec/system/answer_questionnaire_spec.rb index fb216fd..9a1d866 100644 --- a/decidim-module-forms_locations/spec/system/answer_questionnaire_spec.rb +++ b/decidim-module-forms_locations/spec/system/answer_questionnaire_spec.rb @@ -211,9 +211,7 @@ def add_marker(latitude: 11.521, longitude: 5.521) it "generates a marker cluster" do expect(page).to have_css("[data-decidim-map]") expect(page).to have_css(".leaflet-marker-icon") - 5.times do - find(".leaflet-control-zoom-out").click - end + zoom_out_max expect(page).to have_css(".marker-cluster-small") end @@ -221,9 +219,7 @@ def add_marker(latitude: 11.521, longitude: 5.521) it "shows markers separately" do expect(page).to have_css("[data-decidim-map]") expect(page).to have_css(".leaflet-marker-icon") - 5.times do - find(".leaflet-control-zoom-out").click - end + zoom_out_max expect(page).to have_css(".marker-cluster-small") find(".marker-cluster-small").click expect(page).to have_css(".leaflet-marker-pane > img", count: 2) @@ -282,3 +278,11 @@ def add_marker(latitude: 11.521, longitude: 5.521) end end end + +def zoom_out_max + page.execute_script( + <<~JS + $("[data-decidim-map]").data("map").zoomOut(10) + JS + ) +end