X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/361dcbb1dfd05c09034ed92da9bbf4305fcb8da9..e6edca07dd626e5efa889bfdad9e105ef4445f27:/test/system/directions_test.rb diff --git a/test/system/directions_test.rb b/test/system/directions_test.rb index 08f5cb8e3..a0ca87ce7 100644 --- a/test/system/directions_test.rb +++ b/test/system/directions_test.rb @@ -22,9 +22,7 @@ class DirectionsSystemTest < ApplicationSystemTestCase assert_content "Start popup text" end - within_sidebar do - find("button[aria-label='Close']").click - end + find("#sidebar .sidebar-close-controls button[aria-label='Close']").click within "#map" do assert_no_content "Start popup text" @@ -37,7 +35,7 @@ class DirectionsSystemTest < ApplicationSystemTestCase stub_routing <<~CALLBACK const distance = points[0].distanceTo(points[1]); const time = distance * 30; - callback(false, { + return Promise.resolve({ line: points, steps: [ [points[0], 8, "1. #{start_instruction}", distance, points], @@ -53,10 +51,8 @@ class DirectionsSystemTest < ApplicationSystemTestCase execute_script <<~SCRIPT $(() => { for (const engine of OSM.Directions.engines) { - engine.getRoute = (points, callback) => { - setTimeout(() => { + engine.getRoute = (points, signal) => { #{callback_code} - }); }; } });