title: Unable to find link with Capybara in rails
body: <p>I'm trying to test code that has asynchronous javascript and my test  fails from time to time.</p>
  
  <pre><code>scenario 'User can delete his comment', js: true do
    within('.answer') do
      click_link 'Comments (0)'
      find_link('Add Comment').click
      fill_in 'comment[content]', with: 'MyComment'
      click_on 'Post comment'
    end
  
    within('.comment') do
      click_link 'Delete'
    end
  
    expect(page).to have_text('Your comment has been deleted.')
  end
  </code></pre>
  
  <p>The failure message is:</p>
  
  <pre><code>Capybara::ElementNotFound:
    Unable to find link "Add Comment"
  </code></pre>
  
  <p>As I understand, <code>find_link</code> method has built-in wait functionality. Where is my mistake?</p>
  
  <p>I use poltergeist as js driver and my config is:</p>
  
  <pre><code>Capybara.javascript_driver = :poltergeist
  Capybara.default_max_wait_time = 10
  
  options = { js_errors: false }
  Capybara.register_driver :poltergeist do |app|
    Capybara::Poltergeist::Driver.new(app, options)
  end
  </code></pre>