Skip to content

Commit

Permalink
Adapt puffing billing to newer versions selenium webdriver (#314)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alfonso Uceda authored Feb 15, 2022
1 parent fcec680 commit c7e19f1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
22 changes: 13 additions & 9 deletions lib/billy/browsers/capybara.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand All @@ -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
)
Expand All @@ -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
)
Expand All @@ -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}")
Expand Down
7 changes: 3 additions & 4 deletions puffing-billy.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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'
Expand Down

0 comments on commit c7e19f1

Please sign in to comment.