File tree 2 files changed +19
-2
lines changed 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -379,7 +379,11 @@ def dismiss_modal(type, options = {})
379
379
private
380
380
381
381
def build_remote_debug_url ( path :)
382
- "http://#{ browser . process . host } :#{ browser . process . port } #{ path } "
382
+ uri = URI . parse ( path )
383
+ uri . scheme ||= "http"
384
+ uri . host ||= browser . process . host
385
+ uri . port ||= browser . process . port
386
+ uri . to_s
383
387
end
384
388
385
389
def default_domain
Original file line number Diff line number Diff line change 30
30
end
31
31
32
32
describe "debug_url" do
33
- it "parses the devtools frontend url correctly" do
33
+ it "parses the devtools frontend url correctly when devtoolsFrontendUrl is relative " do
34
34
driver = described_class . new ( nil , { port : 12_345 } )
35
35
driver . browser # initialize browser before stubbing Net::HTTP as it also calls it
36
36
uri = instance_double ( URI )
40
40
41
41
expect ( driver . debug_url ) . to eq ( "http://127.0.0.1:12345/works" )
42
42
end
43
+
44
+ it "parses the devtools frontend url correctly when devtoolsFrontendUrl is fully qualified" do
45
+ driver = described_class . new ( nil , { port : 12_346 } )
46
+ driver . browser # initialize browser before stubbing Net::HTTP as it also calls it
47
+ uri = instance_double ( URI )
48
+
49
+ allow ( driver ) . to receive ( :URI ) . with ( "http://127.0.0.1:12346/json" ) . and_return ( uri )
50
+ allow ( Net ::HTTP ) . to receive ( :get ) . with ( uri ) . and_return (
51
+ %([{"devtoolsFrontendUrl":"https://chrome-devtools-frontend.appspot.com/serve_rev?ws=123"}])
52
+ )
53
+
54
+ expect ( driver . debug_url ) . to eq ( "https://chrome-devtools-frontend.appspot.com/serve_rev?ws=123" )
55
+ end
43
56
end
44
57
45
58
private
You can’t perform that action at this time.
0 commit comments