Skip to content

Instantly share code, notes, and snippets.

@thbar
Created August 6, 2020 08:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thbar/8e383969792b75ea61ccebc181d891d9 to your computer and use it in GitHub Desktop.
Save thbar/8e383969792b75ea61ccebc181d891d9 to your computer and use it in GitHub Desktop.
Apparition with Puffing Billy configuration for RSpec
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