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-O5WfVfzUwx8@public.gmane.org'') -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/5b2387dd-60f6-4005-9c24-057c1f4f5d50%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
On Saturday, August 17, 2013 4:08:18 PM UTC+1, Garrett Wilson wrote:> > Here is my test: > > visit accounts_path > > #This is the text that should be inside the paginated table > page.should have_content(''test...-O5WfVfzUwx8@public.gmane.org'')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 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/81af0786-4a65-4470-b460-fa94b6b7027d%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
On Aug 17, 2013, at 10:08 AM, Garrett Wilson <garrett.l.wilson1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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-O5WfVfzUwx8@public.gmane.org'')Does this help? https://github.com/jnicklas/capybara#asynchronous-javascript-ajax-and-friends This is typically why I use watir-webdriver — testing async stuff just seems more intuitive with wait_until and wait_for. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/D23125C4-3254-4892-A2DE-CA0D48456213%40gmail.com. For more options, visit https://groups.google.com/groups/opt_out.