Created
August 6, 2020 08:07
-
-
Save thbar/8e383969792b75ea61ccebc181d891d9 to your computer and use it in GitHub Desktop.
Apparition with Puffing Billy configuration for RSpec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
build_driver = -> (app:, proxy:) { | |
options = { | |
window_size: [1500, 1224], | |
screen_size: [1500, 1224], | |
headless: true, | |
js_errors: true, | |
ignore_https_errors: true, | |
browser_options: { | |
'ignore-certificate-errors' => nil | |
} | |
} | |
Capybara::Apparition::Driver.new(app, options).tap do |d| | |
if proxy | |
d.set_proxy(Billy.proxy.host, Billy.proxy.port) | |
end | |
end | |
} | |
# https://github.com/twalpole/apparition/issues/2#issuecomment-458807373 | |
Capybara.register_driver :apparition_billy do |app| | |
build_driver.call(app: app, proxy: true) | |
end | |
Capybara.register_driver :apparition_no_billy do |app| | |
build_driver.call(app: app, proxy: false) | |
end | |
Capybara.javascript_driver = :apparition_no_billy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment