From 791370a61cb96be4daae349ae811febc1af7f204 Mon Sep 17 00:00:00 2001 From: Joonas Date: Thu, 2 May 2024 15:50:02 +0300 Subject: [PATCH] Fix specs --- Gemfile.lock | 38 +++++++++---------- .../spec/system/answer_questionnaire_spec.rb | 29 +++++++++----- 2 files changed, 39 insertions(+), 28 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 5a894b0..fceede9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/mainio/decidim-module-locations.git - revision: 99760120dfe2d309511e4ad73a47ab152b513d7e + revision: def0ba5cc4891ed226f20893af0b4a05b3cbaa01 branch: develop specs: decidim-locations (0.27.4) @@ -98,7 +98,7 @@ GEM addressable (2.8.6) public_suffix (>= 2.0.2, < 6.0) ast (2.4.2) - axe-core-api (4.8.2) + axe-core-api (4.9.0) dumb_delegator virtus axe-core-rspec (4.1.0) @@ -173,7 +173,7 @@ GEM bigdecimal rexml crass (1.0.6) - css_parser (1.16.0) + css_parser (1.17.1) addressable date (3.3.4) date_validator (0.12.0) @@ -354,7 +354,7 @@ GEM declarative-option (0.1.0) descendants_tracker (0.0.4) thread_safe (~> 0.3, >= 0.3.1) - devise (4.9.3) + devise (4.9.4) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) @@ -371,7 +371,7 @@ GEM nokogiri (>= 1.13.2, < 1.17.0) rubyzip (~> 2.3.0) docile (1.4.0) - doorkeeper (5.6.9) + doorkeeper (5.7.0) railties (>= 5) doorkeeper-i18n (4.0.1) dumb_delegator (1.0.0) @@ -462,7 +462,7 @@ GEM ruby-vips (>= 2.0.17, < 3) invisible_captcha (0.13.0) rails (>= 3.2.0) - json (2.7.1) + json (2.7.2) jwt (2.8.1) base64 kaminari (1.2.2) @@ -483,8 +483,8 @@ GEM kramdown (~> 2.0) launchy (2.5.2) addressable (~> 2.8) - letter_opener (1.9.0) - launchy (>= 2.2, < 3) + letter_opener (1.10.0) + launchy (>= 2.2, < 4) letter_opener_web (2.0.0) actionmailer (>= 5.2) letter_opener (~> 1.7) @@ -509,7 +509,7 @@ GEM mixlib-cli (~> 2.1, >= 2.1.1) mixlib-config (>= 2.2.1, < 4) mixlib-shellout - method_source (1.0.0) + method_source (1.1.0) mime-types (3.5.2) mime-types-data (~> 3.2015) mime-types-data (3.2024.0305) @@ -536,7 +536,7 @@ GEM net-smtp (0.5.0) net-protocol nio4r (2.7.1) - nokogiri (1.16.3-x86_64-linux) + nokogiri (1.16.4-x86_64-linux) racc (~> 1.4) oauth (1.1.0) oauth-tty (~> 1.0, >= 1.0.1) @@ -557,11 +557,11 @@ GEM rack-protection omniauth-facebook (5.0.0) omniauth-oauth2 (~> 1.2) - omniauth-google-oauth2 (1.1.1) + omniauth-google-oauth2 (1.1.2) jwt (>= 2.0) - oauth2 (~> 2.0.6) + oauth2 (~> 2.0) omniauth (~> 2.0) - omniauth-oauth2 (~> 1.8.0) + omniauth-oauth2 (~> 1.8) omniauth-oauth (1.2.0) oauth omniauth (>= 1.0, < 3) @@ -581,7 +581,7 @@ GEM parallel (1.24.0) parallel_tests (3.13.0) parallel - parser (3.3.0.5) + parser (3.3.1.0) ast (~> 2.4.1) racc pg (1.1.4) @@ -596,7 +596,7 @@ GEM actionmailer (>= 3) net-smtp premailer (~> 1.7, >= 1.7.9) - public_suffix (5.0.4) + public_suffix (5.0.5) puma (5.6.8) nio4r (~> 2.0) racc (1.7.3) @@ -647,7 +647,7 @@ GEM rake (>= 12.2) thor (~> 1.0) rainbow (3.1.1) - rake (13.1.0) + rake (13.2.1) ransack (2.4.2) activerecord (>= 5.2.4) activesupport (>= 5.2.4) @@ -707,8 +707,8 @@ GEM rubocop-ast (>= 1.17.0, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 1.4.0, < 3.0) - rubocop-ast (1.31.2) - parser (>= 3.3.0.4) + rubocop-ast (1.31.3) + parser (>= 3.3.1.0) rubocop-faker (1.1.0) faker (>= 2.12.0) rubocop (>= 0.82.0) @@ -724,7 +724,7 @@ GEM ruby-progressbar (1.13.0) ruby-vips (2.2.1) ffi (~> 1.12) - rubyXL (3.4.26) + rubyXL (3.4.27) nokogiri (>= 1.10.8) rubyzip (>= 1.3.0) rubyzip (2.3.2) 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 455f583..f1d1bdf 100644 --- a/decidim-module-forms_locations/spec/system/answer_questionnaire_spec.rb +++ b/decidim-module-forms_locations/spec/system/answer_questionnaire_spec.rb @@ -167,10 +167,12 @@ def add_marker(latitude: 11.521, longitude: 5.521) before do Decidim::Forms::Question.first.answer_options.first.update( - geojson: '{"type":"Feature","geometry":{"type":"Point","coordinates":[12.12345,5.12345]}}' + geojson: '{"type":"Feature","geometry":{"type":"Point","coordinates":[12.12645,5.12345]}}', + tooltip_direction: "top" ) Decidim::Forms::Question.first.answer_options.second.update( - geojson: '{"type":"Feature","geometry":{"type":"Point","coordinates":[12.12346,5.12346]}}' + geojson: '{"type":"Feature","geometry":{"type":"Point","coordinates":[12.12346,5.12346]}}', + tooltip_direction: "bottom" ) component.update!( step_settings: { @@ -195,9 +197,19 @@ def add_marker(latitude: 11.521, longitude: 5.521) end context "when markers are close" do + before do + Decidim::Forms::Question.first.answer_options.first.update( + geojson: '{"type":"Feature","geometry":{"type":"Point","coordinates":[12.123456789,5.12346]}}' + ) + Decidim::Forms::Question.first.answer_options.second.update( + geojson: '{"type":"Feature","geometry":{"type":"Point","coordinates":[12.123456788,5.12346]}}' + ) + end + it "generates a marker cluster" do expect(page).to have_css("[data-decidim-map]") expect(page).to have_css(".leaflet-marker-icon") + find(".leaflet-control-zoom-out").click expect(page).to have_css(".marker-cluster") end @@ -205,6 +217,8 @@ 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") + find(".leaflet-control-zoom-out").click + expect(page).to have_css(".marker-cluster") find(".marker-cluster").click expect(page).to have_css(".leaflet-marker-pane > img", count: 2) end @@ -214,17 +228,15 @@ def add_marker(latitude: 11.521, longitude: 5.521) context "when marker is clicked" do it "changes color to green if selected" do expect(page).to have_css("[data-decidim-map]") - find(".marker-cluster").click - find(".leaflet-tooltip", match: :first).click + find(".leaflet-marker-pane").find(".leaflet-interactive", match: :first).click expect(page).to have_css('img[style*="hue-rotate(275deg)"]') end it "changes the color back to blue if unselected" do expect(page).to have_css("[data-decidim-map]") - find(".marker-cluster").click - find(".leaflet-tooltip", match: :first).click + find(".leaflet-marker-pane").find(".leaflet-interactive", match: :first).click expect(page).to have_css('img[style*="hue-rotate(275deg)"]') - find(".leaflet-tooltip", match: :first).click + find(".leaflet-marker-pane").find(".leaflet-interactive", match: :first).click expect(page).not_to have_css('img[style*="hue-rotate(275deg)"]') end end @@ -232,8 +244,7 @@ def add_marker(latitude: 11.521, longitude: 5.521) context "when mandatory question" do it "submits form when option picked" do expect(page).to have_css("[data-decidim-map]") - find(".marker-cluster").click - find(".leaflet-tooltip", match: :first).click + find(".leaflet-marker-pane").find(".leaflet-interactive", match: :first).click expect(page).to have_css('img[style*="hue-rotate(275deg)"]') find("#questionnaire_tos_agreement").click click_button "Submit"