|
18 | 18 | puts "" |
19 | 19 |
|
20 | 20 | RSpec.configure do |config| |
| 21 | + ferrum_logger = nil |
21 | 22 | config.include_context "Global helpers" |
22 | 23 |
|
23 | 24 | config.before(:suite) do |
24 | 25 | @server = Ferrum::Server.boot |
25 | | - |
26 | | - begin |
27 | | - browser = Ferrum::Browser.new |
28 | | - puts "Browser: #{browser.process.browser_version}" |
29 | | - puts "Protocol: #{browser.process.protocol_version}" |
30 | | - puts "V8: #{browser.process.v8_version}" |
31 | | - puts "Webkit: #{browser.process.webkit_version}" |
32 | | - ensure |
33 | | - browser&.quit |
34 | | - end |
35 | 26 | end |
36 | 27 |
|
37 | 28 | config.before(:all) do |
|
40 | 31 | options.merge!(headless: false) if ENV["HEADLESS"] == "false" |
41 | 32 |
|
42 | 33 | if ENV["CI"] |
43 | | - FERRUM_LOGGER = StringIO.new |
44 | | - options.merge!(logger: FERRUM_LOGGER) |
| 34 | + ferrum_logger = StringIO.new |
| 35 | + options.merge!(logger: ferrum_logger) |
45 | 36 | end |
46 | 37 |
|
47 | 38 | @browser = Ferrum::Browser.new(**options) |
|
55 | 46 | server&.wait_for_pending_requests |
56 | 47 |
|
57 | 48 | if ENV["CI"] |
58 | | - FERRUM_LOGGER.truncate(0) |
59 | | - FERRUM_LOGGER.rewind |
| 49 | + ferrum_logger.truncate(0) |
| 50 | + ferrum_logger.rewind |
60 | 51 | end |
61 | 52 | end |
62 | 53 |
|
@@ -86,7 +77,7 @@ def save_exception_screenshot(browser, filename, line_number, timestamp) |
86 | 77 |
|
87 | 78 | def save_exception_log(_browser, filename, line_number, timestamp) |
88 | 79 | log_name = "logfile-#{filename}-#{line_number}-#{timestamp}.txt" |
89 | | - File.open("/tmp/ferrum/#{log_name}", "wb") { |file| file.write(FERRUM_LOGGER.string) } |
| 80 | + File.open("/tmp/ferrum/#{log_name}", "wb") { |file| file.write(ferrum_logger.string) } |
90 | 81 | rescue StandardError => e |
91 | 82 | puts "#{e.class}: #{e.message}" |
92 | 83 | end |
|
0 commit comments