Re: page.should have_content is not working properly with content added via ajax

275 views
Skip to first unread message

Peter Philips

unread,
Feb 27, 2013, 10:51:48 PM2/27/13
to ruby-c...@googlegroups.com
bump! i'm now having this issue in another project where  either of the two workaround solve the issue.  What does screenshot_and_open_image(from the capybara-screenshot gem) and the find(selector).should have_selector(other_selector) do such that it seems to either fire the event or reload the dom such that capybara is aware that the elements i'm looking for exist....

On Thursday, February 7, 2013 11:19:24 PM UTC-8, Peter Philips wrote:
Hello,

I'm having an issue where 
 
page.should have_content('My error message - You forgot stuff')
 
is coming back with a failure when I'm checking for it after clicking on a submit button that triggers an ajax request to submit the form.

click_on "Submit Form"
 
But if I do one of two workarounds, it passes.  Here are two of the workarounds:

click_on "Submit Form"
screenshot_and_open_image
page.should have_content('My error message - You forgot stuff')
 
click_on "Submit Form"
page.find("#form_wrapper").should have_selector("li", text: "My error message - You forgot stuff") 

 Odd, no?  Am I missing something with page.should have_content()?

Here's my stack: 

ruby 1.9.3p327 
Rails 3.2.11 
capybara (2.0.2)
capybara-screenshot (0.3.4)
capybara-webkit (0.14.1)

 


Jonas Nicklas

unread,
Feb 28, 2013, 3:50:13 AM2/28/13
to ruby-c...@googlegroups.com
My guess would be "take time", maybe your Capybara.default_wait_time
is too low, i.e. your app is too slow ;) Try bumping it to 4 or
something and see if that helps.

/Jonas
> --
> You received this message because you are subscribed to the Google Groups
> "Capybara" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ruby-capybar...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
Reply all
Reply to author
Forward
0 new messages