I need to check has page a JavaScript error.
Solution for capybara-webkit http://blog.55minutes.com/2013/10/test-javascript-with-capybara-webkit/
require 'spec_helper' feature 'Home' do it 'should not have JavaScript errors', :js => true do visit(root_path) expect(page).not_to have_errors end end
How to make one look the same as for Poltergeist?
spec_helper.rb
...
require 'capybara/rails'
require 'capybara/selenium/driver'
...
selenium_hub_host = "selenium"
selenium_hub_port = "100"
selenium_url = "http://#{selenium_hub_host}:#{selenium_hub_port}/wd/hub"
...
Capybara.register_driver :selenium_remote do |app|
options = {}
options[:browser] = :remote
capabilities = Selenium::WebDriver::Remote::Capabilities.firefox
capabilities[:platform] = :any
capabilities[:takes_screenshot] = true
options[:url] = selenium_url
options[:desired_capabilities] = capabilities
Capybara::Selenium::Driver.new(app, options)
end
Capybara.javascript_driver = :selenium_remote
Capybara.default_max_wait_time = 30
Capybara.server do |app, port|
require 'rack/handler/thin'
Rack::Handler::Thin.run(app, :Host => '0.0.0.0', :Port => port)
end
...