oesmith / puffing-billy

A rewriting web proxy for testing interactions between your browser and external sites. Works with ruby + rspec.
MIT License
662 stars 168 forks source link

Adds a configurable Cuprite driver #327

Closed zedtux closed 2 years ago

zedtux commented 2 years ago

This PR adds support for a configurable Cuprite driver.

What I mean is that it allows passing additional flags to the driver like that :

# Some code here to build the `remote_chrome` variable and the `REMOTE_CHROME_URL` constant.

remote_options = remote_chrome ? { url: REMOTE_CHROME_URL } : {}

Billy.configure do |c|
  c.cuprite_options = {
    browser_options: remote_chrome ? { 'no-sandbox' => nil } : {},
    inspector: true,
    js_errors: true,
    # See features/support/download_helpers.rb
    save_path: File.join(Capybara.save_path, 'downloads'),
    window_size: [810, 1080]
  }.merge(remote_options)

  c.cache = true
  # ...
end

require 'billy/capybara/cucumber'

Capybara.default_driver =
    Capybara.javascript_driver =
      Capybara.current_driver = :cuprite_billy

This PR also update the README.md file in order to explain how to configure a remote Chrome with nice tip about ActionCable taken from #252.

ronwsmith commented 2 years ago

Released in 3.0.4. Thanks for the contribution!

zedtux commented 2 years ago

Thank you !