Skip to content

Commit 0021f9d

Browse files
committed
Compatibility with latest ferrum
1 parent aa6043f commit 0021f9d

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

lib/capybara/cuprite/driver.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,9 @@ def set_proxy(ip, port, type = nil, user = nil, password = nil, bypass = nil)
243243
server = type ? "#{type}=#{ip}:#{port}" : "#{ip}:#{port}"
244244
@options[:browser_options].merge!("proxy-server" => server)
245245
@options[:browser_options].merge!("proxy-bypass-list" => bypass) if bypass
246-
browser.network.authorize(type: :proxy, user: user, password: password)
246+
browser.network.authorize(type: :proxy, user: user, password: password) do |request|
247+
request.continue
248+
end
247249
end
248250

249251
def headers
@@ -296,7 +298,9 @@ def clear_memory_cache
296298
end
297299

298300
def basic_authorize(user, password)
299-
browser.network.authorize(user: user, password: password)
301+
browser.network.authorize(user: user, password: password) do |request|
302+
request.continue
303+
end
300304
end
301305
alias_method :authorize, :basic_authorize
302306

spec/integration/driver_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ def create_screenshot(file, *args)
657657
expect { @session.visit(url) }
658658
.to raise_error(
659659
Ferrum::StatusError,
660-
%(Request to #{url} failed to reach server, check DNS and/or server status)
660+
%(Request to #{url} failed to reach server, check DNS and server status)
661661
)
662662
end
663663

spec/spec_helper.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
CUPRITE_ROOT = File.expand_path("..", __dir__)
44
$:.unshift(CUPRITE_ROOT + "/lib")
55

6+
require "fileutils"
67
require "bundler/setup"
78
require "rspec"
89

@@ -84,6 +85,8 @@ module TestSessions
8485
end
8586

8687
config.around do |example|
88+
remove_temporary_folders
89+
8790
if ENV["CI"]
8891
session = @session || TestSessions::Cuprite
8992
session.driver.browser.logger.truncate(0)
@@ -113,4 +116,9 @@ def save_exception_aftifacts(browser, meta)
113116
log_name = "logfile-#{filename}-#{line_number}-#{timestamp}.txt"
114117
File.open("/tmp/cuprite/#{log_name}", "wb") { |f| f.write(browser.logger.string) }
115118
end
119+
120+
def remove_temporary_folders
121+
FileUtils.rm_rf(CUPRITE_ROOT + "/screenshots")
122+
FileUtils.rm_rf(CUPRITE_ROOT + "/save_path_tmp")
123+
end
116124
end

0 commit comments

Comments
 (0)