Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Capybara for AJAX integration tests

I am using Capybara for rails integration tests. When it comes to AJAX requests, I am getting the following error:

Capybara::TimeoutError: failed to resynchronize, ajax request timed out

Any idea what's wrong and how this can be fixed?

like image 677
Kranthi Avatar asked Jul 14 '11 07:07

Kranthi


2 Answers

I had this same issue once I upgraded my selenium/capybara gems. There is some AJAX synchronization logic that is causing this, so I just disabled it within my test hook.

Before do
  page.driver.options[:resynchronize] = false
end
like image 190
Jason Avatar answered Oct 02 '22 19:10

Jason


If you are on rail 3

change this in your gem file.

gem 'capybara', :git => 'git://github.com/jnicklas/capybara.git', :branch =>'async_is_my_bitch'

then do bundle update.

This will solve it.

like image 41
Siddhartha Mukherjee Avatar answered Oct 02 '22 18:10

Siddhartha Mukherjee