Search code examples
javascriptruby-on-railsrspeccapybaracapybara-webkit

Check if JS box exists with RSpec + capybara-webkit


I'm using RSpec + capybara, and the capybara-webkit as driver. I have to check if a JS box exists in the page after clicking on a button, but with no results. If I use selenium as a driver, the test passes, but I need to use capybara-webkit.

I'm using

expect(page).to have_selector(#js_window)

My configuration is

Capybara.run_server = false
Capybara.default_selector = :css
Capybara.default_max_wait_time = 1
Capybara.javascript_driver = :webkit

RSpec.configure do |config|
 config.include Capybara::DSL
end  

Solution

  • In the end, it was a problem with my config.block_unknown_urls (I was blocking the url I needed) and the default_max_wait_time (I changed it from 1 to 3). Solved now!