thoughtbot / capybara-webkit

A Capybara driver for headless WebKit to test JavaScript web apps
https://thoughtbot.com/open-source
MIT License
1.97k stars 428 forks source link

Is the Configuration Section in the README up-to-date? #1029

Closed jtrupiano closed 6 years ago

jtrupiano commented 6 years ago

Immediately after requiring capybara/webkit I have a block of code exactly as in the README. I get the following NoMethoderror. Is the README correct?

require 'capybara/webkit'

Capybara::Webkit.configure do |config|
  config.block_unknown_urls
  config.timeout = 10
  config.ignore_ssl_errors
  config.skip_image_loading
  config.raise_javascript_errors = false
end
>> undefined method `configure' for Capybara::Webkit:Module (NoMethodError)

I'm on Ruby 2.4.1, capybara 2.15.4, capybara-webkit 1.1.0.

Thanks.

twalpole commented 6 years ago

It’s correct for v1.14.0 - unfortunately 1.14 isn’t marked as compatible with the latest capybara so you’re getting a really old capybara-WebKit. Tell your gemfile to use the latest capybara-webkit (and a slightly old capybara)

jtrupiano commented 6 years ago

That is helpful, @twalpole, thanks. We seem to be in a bit of purgatory with this versioning....is there a writeup I can review to better understand where we currently are and what the roadmap looks like?

twalpole commented 6 years ago

@jtrupiano Not that I know of -- it appears capybara-webkit isn't really being worked on currently - There are a few open PRs that would bring it full compatibility with Capybara 2.14.x but they haven't been looked at/merged for quite some time. At this point it would be best if the maintainers just opened up the compatibility to 2.x (imho)

jtrupiano commented 6 years ago

Is there a different stack you'd recommend? I had been using poltergeist, but I also ran into a variety of upgrade issues there. That's what led me to poke around again here with capybara-webkit.

twalpole commented 6 years ago

@jtrupiano You'll get the most up to date compatibility with web technologies using Chrome with selenium, which can be run in headless mode. It will be slower though.

jtrupiano commented 6 years ago

I appreciate the advice, thanks. Is that a stack I can run on both Ubuntu and OSX?

twalpole commented 6 years ago

@jtrupiano Yes -- you'll need the selenium-webdriver gem in your project and chromedriver in your PATH. Then you can specify Capybara.javascript_driver = :selenium_chrome when using the latest Capybara (or :selenium_chrome_headless if that's what you want), or register your own driver configuration. Note you won't have the poltergeist/capybara-webkit extensions (blacklist/whitelist, etc)

jtrupiano commented 6 years ago

@twalpole, thanks a lot. Where's a good place to get q's about the selenium-webdriver setup in ruby answered? These projects used to have google groups and forums and such, I'm not sure what the kids are using these days. Maybe an IRC channel?

twalpole commented 6 years ago

@jtrupiano Recently, with the changes that have been going on in selenium, I’ve found it easiest to just read the selenium source.