Capybara not finding element after AJAX


I’m seeing some strange behavior from capybara. My view is structured like this:

<div class="row qc">
  <%= render partial: 'shared/votebox', locals: {voteable: @question} %>

In the partial I have a link that recalculates and replaces the partial. After this occurs, capybara can’t find the parent (".qc").

Can you help me figure out what’s going on?

Thank you!

There’s not enough here to really help - there are any number of things that could be going on. It could be a problem with markup, the JavaScript, the spec itself, your spec_helper… My first thought is that your JavaScript is actually replacing more markup than you want it to, but it really could be anything.

My advice to you is to simplify greatly your partial and the JavaScript. Verify the behavior is correct in browser (being sure to check your selectors just as capybara would).