diff --git a/test/system/directions_test.rb b/test/system/directions_test.rb index 20923b69983..6b42abe08db 100644 --- a/test/system/directions_test.rb +++ b/test/system/directions_test.rb @@ -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 @@ -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); + return Promise.resolve(new Response(JSON.stringify({}), { + status: 200, + headers: { "Content-Type": "application/json" } + })); + }; + }); + SCRIPT + end end