From c7e19f1fc98c7a9adcf43fff60e21062c809e957 Mon Sep 17 00:00:00 2001 From: Alfonso Uceda Date: Tue, 15 Feb 2022 19:03:53 +0100 Subject: [PATCH] Adapt puffing billing to newer versions selenium webdriver (#314) --- lib/billy/browsers/capybara.rb | 22 +++++++++++++--------- puffing-billy.gemspec | 7 +++---- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/lib/billy/browsers/capybara.rb b/lib/billy/browsers/capybara.rb index 811244d..424e472 100644 --- a/lib/billy/browsers/capybara.rb +++ b/lib/billy/browsers/capybara.rb @@ -47,19 +47,24 @@ def self.register_webkit_driver def self.register_selenium_driver ::Capybara.register_driver :selenium_billy do |app| - options = build_selenium_options_for_firefox - capabilities = Selenium::WebDriver::Remote::Capabilities.firefox(accept_insecure_certs: true) + capabilities = [ + build_selenium_options_for_firefox, + Selenium::WebDriver::Remote::Capabilities.firefox(accept_insecure_certs: true) + ] - ::Capybara::Selenium::Driver.new(app, options: options, desired_capabilities: capabilities) + ::Capybara::Selenium::Driver.new(app, capabilities: capabilities) end ::Capybara.register_driver :selenium_headless_billy do |app| options = build_selenium_options_for_firefox.tap do |opts| opts.add_argument '-headless' end - capabilities = Selenium::WebDriver::Remote::Capabilities.firefox(accept_insecure_certs: true) - - ::Capybara::Selenium::Driver.new(app, options: options, desired_capabilities: capabilities) + capabilities = [ + options, + Selenium::WebDriver::Remote::Capabilities.firefox(accept_insecure_certs: true) + ] + + ::Capybara::Selenium::Driver.new(app, capabilities: capabilities) end ::Capybara.register_driver :selenium_chrome_billy do |app| @@ -70,7 +75,7 @@ def self.register_selenium_driver ::Capybara::Selenium::Driver.new( app, browser: :chrome, - options: options, + capabilities: options, clear_local_storage: true, clear_session_storage: true ) @@ -88,7 +93,7 @@ def self.register_selenium_driver ::Capybara::Selenium::Driver.new( app, browser: :chrome, - options: options, + capabilities: options, clear_local_storage: true, clear_session_storage: true ) @@ -105,7 +110,6 @@ def self.register_apparition_driver def self.build_selenium_options_for_firefox profile = Selenium::WebDriver::Firefox::Profile.new.tap do |prof| - prof.assume_untrusted_certificate_issuer = false prof.proxy = Selenium::WebDriver::Proxy.new( http: "#{Billy.proxy.host}:#{Billy.proxy.port}", ssl: "#{Billy.proxy.host}:#{Billy.proxy.port}") diff --git a/puffing-billy.gemspec b/puffing-billy.gemspec index 8ad2c06..3007809 100644 --- a/puffing-billy.gemspec +++ b/puffing-billy.gemspec @@ -8,13 +8,12 @@ Gem::Specification.new do |gem| gem.summary = 'Easy request stubs for browser tests.' gem.homepage = 'https://github.com/oesmith/puffing-billy' - gem.files = `git ls-files`.split($OUTPUT_RECORD_SEPARATOR) - gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) } - gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) + gem.files = %w[LICENSE CHANGELOG.md README.md] + Dir['lib/**/*.rb'] gem.name = 'puffing-billy' gem.require_paths = ['lib'] gem.version = Billy::VERSION gem.required_ruby_version = '>= 2.6.0' + gem.license = 'MIT' gem.add_development_dependency 'rspec' gem.add_development_dependency 'thin' @@ -28,7 +27,7 @@ Gem::Specification.new do |gem| gem.add_development_dependency 'rb-inotify' gem.add_development_dependency 'pry' gem.add_development_dependency 'cucumber' - gem.add_development_dependency 'watir', '>= 7.0.0' + gem.add_development_dependency 'watir', '~> 7.1.0' gem.add_development_dependency 'webdrivers', '>= 5.0.0' gem.add_development_dependency 'webrick' gem.add_runtime_dependency 'addressable', '~> 2.5'