File tree Expand file tree Collapse file tree 2 files changed +51
-51
lines changed Expand file tree Collapse file tree 2 files changed +51
-51
lines changed Original file line number Diff line number Diff line change 1
- # # frozen_string_literal: true
2
- #
3
- # require "stringio"
4
- #
5
- # module Ferrum
6
- # describe Browser do
7
- # it "logs requests and responses" do
8
- # logger = StringIO.new
9
- # browser = Browser.new(logger: logger)
10
- #
11
- # browser.body
12
- #
13
- # expect(logger.string).to include("return document.documentElement.outerHTML")
14
- # expect(logger.string).to include("<html><head></head><body></body></html>")
15
- # end
16
- #
17
- # it "shows command line options passed" do
18
- # browser = Browser.new(browser_options: { "blink-settings" => "imagesEnabled=false" })
19
- #
20
- # arguments = browser.command("Browser.getBrowserCommandLine")["arguments"]
21
- #
22
- # expect(arguments).to include("--blink-settings=imagesEnabled=false")
23
- # end
24
- # end
25
- # end
1
+ # frozen_string_literal: true
2
+
3
+ require "stringio"
4
+
5
+ module Ferrum
6
+ describe Browser do
7
+ it "logs requests and responses" do
8
+ logger = StringIO . new
9
+ browser = Browser . new ( logger : logger )
10
+
11
+ browser . body
12
+
13
+ expect ( logger . string ) . to include ( "return document.documentElement.outerHTML" )
14
+ expect ( logger . string ) . to include ( "<html><head></head><body></body></html>" )
15
+ end
16
+
17
+ it "shows command line options passed" do
18
+ browser = Browser . new ( browser_options : { "blink-settings" => "imagesEnabled=false" } )
19
+
20
+ arguments = browser . command ( "Browser.getBrowserCommandLine" ) [ "arguments" ]
21
+
22
+ expect ( arguments ) . to include ( "--blink-settings=imagesEnabled=false" )
23
+ end
24
+ end
25
+ end
Original file line number Diff line number Diff line change 1
- # # frozen_string_literal: true
2
- #
3
- # module Ferrum
4
- # class Browser
5
- # describe Process do
6
- # subject { Browser.new(port: 6000, host: "127.0.0.1") }
7
- #
8
- # unless Ferrum.windows?
9
- # it "forcibly kills the child if it does not respond to SIGTERM" do
10
- # allow(::Process).to receive_messages(spawn: 5678)
11
- # allow(::Process).to receive(:wait).and_return(nil)
12
- # allow(Client).to receive(:new).and_return(double.as_null_object)
13
- #
14
- # allow_any_instance_of(Process).to receive(:parse_ws_url)
15
- #
16
- # subject.send(:start)
17
- #
18
- # expect(::Process).to receive(:kill).with("USR1", 5678).ordered
19
- # expect(::Process).to receive(:kill).with("KILL", 5678).ordered
20
- #
21
- # subject.quit
22
- # end
23
- # end
24
- # end
25
- # end
26
- # end
1
+ # frozen_string_literal: true
2
+
3
+ module Ferrum
4
+ class Browser
5
+ describe Process do
6
+ subject { Browser . new ( port : 6000 , host : "127.0.0.1" ) }
7
+
8
+ unless Ferrum . windows?
9
+ it "forcibly kills the child if it does not respond to SIGTERM" do
10
+ allow ( ::Process ) . to receive_messages ( spawn : 5678 )
11
+ allow ( ::Process ) . to receive ( :wait ) . and_return ( nil )
12
+ allow ( Client ) . to receive ( :new ) . and_return ( double . as_null_object )
13
+
14
+ allow_any_instance_of ( Process ) . to receive ( :parse_ws_url )
15
+
16
+ subject . send ( :start )
17
+
18
+ expect ( ::Process ) . to receive ( :kill ) . with ( "USR1" , 5678 ) . ordered
19
+ expect ( ::Process ) . to receive ( :kill ) . with ( "KILL" , 5678 ) . ordered
20
+
21
+ subject . quit
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
You can’t perform that action at this time.
0 commit comments