Capybara with AJAX

I have a table that is populated using AJAX pagination (Kaminari). What I’m trying to do is view this page and make sure there is certain content within the table. This causes a problem with my Capybara test because it doesn’t wait for the pagination to finish before it checks the page for the content. I’m thinking it’s something simple that I’m overlooking, but I have been unable to find a solution through google. I suppose I could just wait for a given amount of time, but this solution seems hacky to me.

Here is my test:

 visit accounts_path

#This is the text that should be inside the paginated table
page.should have_content('test.test@mail.com')

This should work fine - capybara is pretty good at waiting for stuff to load automatically. What capybara driver are you using? The default rack_test driver won't work here because it doesn't run javascript (since there is no browser). There are several drivers that do run javascript such as selenium (which runs an actual browser) or ones like poltergeist or capybara_webkit that run a headless WebKit browser

Fred

Does this help? GitHub - teamcapybara/capybara: Acceptance test framework for web applications

This is typically why I use watir-webdriver — testing async stuff just seems more intuitive with wait_until and wait_for.