Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions test/system/directions_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class DirectionsSystemTest < ApplicationSystemTestCase
test "swaps route endpoints on reverse button click" do
visit directions_path
stub_straight_routing(:start_instruction => "Start popup text")
stub_disable_reverse_geocoding

find_by_id("route_from").set("60 30").send_keys :enter
find_by_id("route_to").set("61 31").send_keys :enter
Expand Down Expand Up @@ -95,4 +96,19 @@ def stub_routing(callback_code)
});
SCRIPT
end

def stub_disable_reverse_geocoding
execute_script <<~SCRIPT
$(() => {
const originalFetch = window.fetch;
window.fetch = function(input, init) {
if (!input?.url?.startsWith(OSM.NOMINATIM_URL)) return originalFetch.apply(this, arguments);
Comment thread
hlfan marked this conversation as resolved.
return Promise.resolve(new Response(JSON.stringify({}), {
status: 200,
headers: { "Content-Type": "application/json" }
}));
};
});
SCRIPT
end
end