Search code examples
ruby-on-railsrspeccapybarapoltergeist

Increasing timeout of poltergeist


I need to increase the length of the timeout in Poltergeist. The poltergeist documentation says I need to put this code in my test setup

Capybara.register_driver :poltergeist do |app|
  Capybara::Poltergeist::Driver.new(app, options)
end

I am new to testing I am not sure where the test setup. I am using Rpsec and Capybara. Could somebody help out please?


Solution

  • This should work:

    Capybara.register_driver :poltergeist do |app|
      Capybara::Poltergeist::Driver.new(app, timeout: 1.minute)
    end
    

    Are you having long running javascript or ajax?

    https://coderwall.com/p/aklybw/wait-for-ajax-with-capybara-2-0 and http://robots.thoughtbot.com/automatically-wait-for-ajax-with-capybara - how to handle ajax

    There is also a way to disable animation in tests, to make it run faster. And if you have some elements with position: fixed then poltergeist will see text behind it as invisible.