File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -295,6 +295,8 @@ def debug_url
295
295
end
296
296
297
297
def build_remote_debug_url ( path :)
298
+ return path if Addressable ::URI . parse ( path ) . absolute?
299
+
298
300
"http://#{ process . host } :#{ process . port } #{ path } "
299
301
end
300
302
end
Original file line number Diff line number Diff line change 632
632
end
633
633
end
634
634
635
+ describe "#debug_url" do
636
+ it "parses the devtools frontend url correctly when devtoolsFrontendUrl is relative" do
637
+ browser = Ferrum ::Browser . new ( port : 12_345 )
638
+ uri = instance_double ( URI )
639
+
640
+ allow ( browser ) . to receive ( :URI ) . with ( "http://127.0.0.1:12345/json" ) . and_return ( uri )
641
+ allow ( Net ::HTTP ) . to receive ( :get ) . with ( uri ) . and_return ( %([{"devtoolsFrontendUrl":"/works"}]) )
642
+
643
+ expect ( browser . send ( :debug_url ) ) . to eq ( "http://127.0.0.1:12345/works" )
644
+ end
645
+
646
+ it "parses the devtools frontend url correctly when devtoolsFrontendUrl is fully qualified" do
647
+ browser = Ferrum ::Browser . new ( port : 12_346 )
648
+ uri = instance_double ( URI )
649
+
650
+ allow ( browser ) . to receive ( :URI ) . with ( "http://127.0.0.1:12346/json" ) . and_return ( uri )
651
+ allow ( Net ::HTTP ) . to receive ( :get ) . with ( uri ) . and_return (
652
+ %([{"devtoolsFrontendUrl":"https://chrome-devtools-frontend.appspot.com/serve_rev?ws=123"}])
653
+ )
654
+
655
+ expect ( browser . send ( :debug_url ) ) . to eq ( "https://chrome-devtools-frontend.appspot.com/serve_rev?ws=123" )
656
+ end
657
+ end
658
+
635
659
context "with pty" , if : Ferrum ::Utils ::Platform . mri? && !Ferrum ::Utils ::Platform . windows? do
636
660
require "pty"
637
661
require "timeout"
You can’t perform that action at this time.
0 commit comments