From 5d5438760d7db3bcf94e45826ac9eaae54b83bcf Mon Sep 17 00:00:00 2001 From: Thomas Schmidt Date: Sat, 17 Jan 2026 12:46:08 +0100 Subject: [PATCH 1/9] test --- spec/features/map_share_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/features/map_share_spec.rb b/spec/features/map_share_spec.rb index 7a71f4c8..0752167d 100644 --- a/spec/features/map_share_spec.rb +++ b/spec/features/map_share_spec.rb @@ -51,7 +51,7 @@ context 'export gpx' do subject(:map) { create(:map, user: create(:user), features: features) } - let(:features) { create_list(:feature, 2, :line_string) } + let(:features) { create_list(:feature, 2, :polygon) } before do visit map.private_map_path From b08c30c7abff513124b0b9bcd8772184f5b8b1ac Mon Sep 17 00:00:00 2001 From: Thomas Schmidt Date: Sat, 17 Jan 2026 12:58:45 +0100 Subject: [PATCH 2/9] specify lines --- spec/features/map_share_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/features/map_share_spec.rb b/spec/features/map_share_spec.rb index 0752167d..a04ccd74 100644 --- a/spec/features/map_share_spec.rb +++ b/spec/features/map_share_spec.rb @@ -51,7 +51,8 @@ context 'export gpx' do subject(:map) { create(:map, user: create(:user), features: features) } - let(:features) { create_list(:feature, 2, :polygon) } + let(:features) { [ create(:feature, geometry: [ [ 11.041, 49.481 ], [ 11.056, 49.463 ] ]), + create(:feature, geometry: [ [ 11.056, 49.463 ], [ 11.061, 49.450 ] ]) ] } before do visit map.private_map_path From f9673b844ada63523fb290e8f13d7c322b740f6d Mon Sep 17 00:00:00 2001 From: Thomas Schmidt Date: Sat, 17 Jan 2026 13:16:06 +0100 Subject: [PATCH 3/9] specify track --- spec/factories/features.rb | 1 + spec/features/map_share_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/factories/features.rb b/spec/factories/features.rb index 83bd9c78..cb51138d 100644 --- a/spec/factories/features.rb +++ b/spec/factories/features.rb @@ -12,6 +12,7 @@ end after :build do |feature, evaluator| + raise 'Specify feature type trait' if feature.geometry.empty? feature.geometry['coordinates'] = evaluator.coordinates if evaluator.coordinates feature.properties['title'] = evaluator.title if evaluator.title feature.properties['desc'] = evaluator.desc if evaluator.desc diff --git a/spec/features/map_share_spec.rb b/spec/features/map_share_spec.rb index a04ccd74..e18358b6 100644 --- a/spec/features/map_share_spec.rb +++ b/spec/features/map_share_spec.rb @@ -51,8 +51,8 @@ context 'export gpx' do subject(:map) { create(:map, user: create(:user), features: features) } - let(:features) { [ create(:feature, geometry: [ [ 11.041, 49.481 ], [ 11.056, 49.463 ] ]), - create(:feature, geometry: [ [ 11.056, 49.463 ], [ 11.061, 49.450 ] ]) ] } + let(:features) { [ create(:feature, :line_string, coordinates: [ [ 11.041, 49.481 ], [ 11.056, 49.463 ] ]), + create(:feature, :line_string, coordinates: [ [ 11.056, 49.463 ], [ 11.061, 49.450 ] ]) ] } before do visit map.private_map_path From b90c6e3c2564472a3638fba8af419d94d5d71f62 Mon Sep 17 00:00:00 2001 From: Thomas Schmidt Date: Sat, 17 Jan 2026 13:21:27 +0100 Subject: [PATCH 4/9] drop test --- spec/features/map_share_spec.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/spec/features/map_share_spec.rb b/spec/features/map_share_spec.rb index e18358b6..e8795e79 100644 --- a/spec/features/map_share_spec.rb +++ b/spec/features/map_share_spec.rb @@ -62,9 +62,10 @@ end it 'exports gpx with one track per linestring' do - click_link("GPX") - file = wait_for_download(subject.public_id + '.gpx', timeout: 10) - expect(File.read(file).scan(//i).size).to eq(2) + expect(page).to have_text('Share Map') + # click_link("GPX") + # file = wait_for_download(subject.public_id + '.gpx', timeout: 10) + # expect(File.read(file).scan(//i).size).to eq(2) end end From 5c64ec3766611d2091ae559bc36af428c848a2f7 Mon Sep 17 00:00:00 2001 From: Thomas Schmidt Date: Sat, 17 Jan 2026 13:27:35 +0100 Subject: [PATCH 5/9] click link --- spec/features/map_share_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/features/map_share_spec.rb b/spec/features/map_share_spec.rb index e8795e79..5f6d7abd 100644 --- a/spec/features/map_share_spec.rb +++ b/spec/features/map_share_spec.rb @@ -63,7 +63,7 @@ it 'exports gpx with one track per linestring' do expect(page).to have_text('Share Map') - # click_link("GPX") + click_link("GPX") # file = wait_for_download(subject.public_id + '.gpx', timeout: 10) # expect(File.read(file).scan(//i).size).to eq(2) end From 0ea3edb4e294818c329923e43b4a1b0adc8c7d37 Mon Sep 17 00:00:00 2001 From: Thomas Schmidt Date: Sat, 17 Jan 2026 13:39:29 +0100 Subject: [PATCH 6/9] don't open download in new window --- app/views/maps/modals/_feature.haml | 2 +- app/views/maps/modals/_share.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/maps/modals/_feature.haml b/app/views/maps/modals/_feature.haml index 0ea92a3b..511e6478 100644 --- a/app/views/maps/modals/_feature.haml +++ b/app/views/maps/modals/_feature.haml @@ -49,7 +49,7 @@ %i.bi.bi-download geojson %span.feature-export#feature-export-gpx.ms-2.link< - =link_to map_feature_gpx_path(id: @map.public_id, feature_id: 'feature_id'), target: '_blank', title: 'Download as GPX', 'data-toggle': "tooltip", 'data-bs-placement': "bottom", 'data-bs-trigger': "hover", 'data-bs-custom-class': "maplibregl-ctrl-tooltip" do + =link_to map_feature_gpx_path(id: @map.public_id, feature_id: 'feature_id'), title: 'Download as GPX', 'data-toggle': "tooltip", 'data-bs-placement': "bottom", 'data-bs-trigger': "hover", 'data-bs-custom-class': "maplibregl-ctrl-tooltip" do %i.bi.bi-download gpx / %span#feature-animation.ms-2.link diff --git a/app/views/maps/modals/_share.haml b/app/views/maps/modals/_share.haml index a8f59cfa..98822890 100644 --- a/app/views/maps/modals/_share.haml +++ b/app/views/maps/modals/_share.haml @@ -60,7 +60,7 @@ %i.bi.bi-download GeoJSON %button.btn.btn-secondary.btn-download{ type: "button" } - =link_to map_gpx_path(@map.public_id), target: '_blank' do + =link_to map_gpx_path(@map.public_id) do %i.bi.bi-download GPX %button.btn.btn-secondary.btn-download{ type: "button" } From c58d450b264d29fe80a55da5853963c86be4e288 Mon Sep 17 00:00:00 2001 From: Thomas Schmidt Date: Sat, 17 Jan 2026 13:46:35 +0100 Subject: [PATCH 7/9] skip test --- spec/features/map_share_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/features/map_share_spec.rb b/spec/features/map_share_spec.rb index 5f6d7abd..89d45c93 100644 --- a/spec/features/map_share_spec.rb +++ b/spec/features/map_share_spec.rb @@ -63,7 +63,8 @@ it 'exports gpx with one track per linestring' do expect(page).to have_text('Share Map') - click_link("GPX") + # TODO: Clicking the download link somehow breaks the browser test env in other threads + # click_link("GPX") # file = wait_for_download(subject.public_id + '.gpx', timeout: 10) # expect(File.read(file).scan(//i).size).to eq(2) end From 68cabb54f1091d0b54d2c5b3907851058652412f Mon Sep 17 00:00:00 2001 From: Thomas Schmidt Date: Sat, 17 Jan 2026 13:52:29 +0100 Subject: [PATCH 8/9] direct gpx access --- spec/features/map_share_spec.rb | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/spec/features/map_share_spec.rb b/spec/features/map_share_spec.rb index 89d45c93..5070e477 100644 --- a/spec/features/map_share_spec.rb +++ b/spec/features/map_share_spec.rb @@ -55,18 +55,12 @@ create(:feature, :line_string, coordinates: [ [ 11.056, 49.463 ], [ 11.061, 49.450 ] ]) ] } before do - visit map.private_map_path - expect_map_loaded - find('.maplibregl-ctrl-share').click - expect(page).to have_text('Share Map') + visit '/m/' + subject.public_id + '.gpx' end it 'exports gpx with one track per linestring' do - expect(page).to have_text('Share Map') - # TODO: Clicking the download link somehow breaks the browser test env in other threads - # click_link("GPX") - # file = wait_for_download(subject.public_id + '.gpx', timeout: 10) - # expect(File.read(file).scan(//i).size).to eq(2) + file = wait_for_download(subject.public_id + '.gpx', timeout: 10) + expect(File.read(file).scan(//i).size).to eq(2) end end From eca10e7f7ec00b1e6e3d32114107938d14487439 Mon Sep 17 00:00:00 2001 From: Thomas Schmidt Date: Sat, 17 Jan 2026 13:59:06 +0100 Subject: [PATCH 9/9] change map load --- spec/support/map_helpers.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/support/map_helpers.rb b/spec/support/map_helpers.rb index 1c209f8c..31220338 100644 --- a/spec/support/map_helpers.rb +++ b/spec/support/map_helpers.rb @@ -3,8 +3,8 @@ # * GeoJSON features loaded + drawn # * Websocket is established def expect_map_loaded - expect(page).to have_css("#maplibre-map[data-map-loaded='true']", wait: 45) - expect(page).to have_css("#maplibre-map[data-geojson-loaded='true']", wait: 45) + expect(page).to have_css("#maplibre-map[data-geojson-loaded='true']", wait: 30) + expect(page).to have_css("#maplibre-map[data-map-loaded='true']", wait: 30) expect(page).to have_css("#maplibre-map[data-online='true']") end