oesmith / puffing-billy

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

Hanging/unable to connect when using selenium_chrome_billy driver #250

Closed bcharna closed 5 years ago

bcharna commented 6 years ago

I was noticing some hanging and errors when using the selenium_chrome_billy driver in my own app, so I decided to see if the same issue happens in the gem's test suite and it seems it does.

First, I simplified the gem's spec_helper.rb just to eliminate some completely for this exercise to the following:

Dir[File.expand_path('../support/**/*.rb', __FILE__)].each { |f| require f }

require 'pry'
require 'billy/capybara/rspec'
require 'billy/watir/rspec'
require 'rack'
require 'logger'
require 'fileutils'

Capybara.app = Rack::Directory.new(File.expand_path('../../examples', __FILE__))
Capybara.server = :webrick
Capybara.javascript_driver = :poltergeist_billy

Billy.configure do |config|
  config.logger = Logger.new(File.expand_path('../../log/test.log', __FILE__))
end

Note that I kept Capybara.javascript_driver = :poltergeist_billy.

Then, a spec file is run:

bundle exec rspec spec/features/examples/tumblr_api_spec.rb

Output

..

Finished in 1.44 seconds (files took 0.76901 seconds to load)
2 examples, 0 failures

This output is correct and as expected.

However, changing Capybara.javascript_driver = :poltergeist_billy to Capybara.javascript_driver = :selenium_chrome_billy causes the following output when the same command is run:

FF

Failures:

  1) Tumblr API example without scope external references should show news stories
     Failure/Error: visit '/tumblr_api.html'

     Selenium::WebDriver::Error::WebDriverError:
       unable to connect to chromedriver 127.0.0.1:9523
     Shared Example Group: "tumblr/expectations" called from ./spec/features/examples/tumblr_api_spec.rb:39
     # ./spec/features/examples/tumblr_api_spec.rb:11:in `block (2 levels) in <top (required)>'

  2) Tumblr API example with scope external references should show news stories
     Failure/Error: visit '/tumblr_api.html'

     Selenium::WebDriver::Error::WebDriverError:
       unable to connect to chromedriver 127.0.0.1:9523
     Shared Example Group: "tumblr/expectations" called from ./spec/features/examples/tumblr_api_spec.rb:63
     # ./spec/features/examples/tumblr_api_spec.rb:11:in `block (2 levels) in <top (required)>'

Finished in 40.41 seconds (files took 0.73721 seconds to load)
2 examples, 2 failures

Any insight into why just changing the driver to selenium_chrome_billy causes the suite to not pass with the above errors?

ronwsmith commented 6 years ago

Looks like you may be missing the chromedriver itself. We use the chromedriver-helper gem in our projects.

ronwsmith commented 5 years ago

@bcharna has this issue been resolved for you?

bcharna commented 5 years ago

Yeah, last time I revisited this, I did not encounter the issue. Thank you!