Make Capybara check the page between comment votes

As pointed out in PR consul#2734:

"After clicking the first link, there's an AJAX request which replaces
the existing `.in-favor a` and `.against a` links with new elements. So
if Capybara tries to click the existing `.against a` link at the same
moment it's being replaced, clicking the link won't generate a new
request".

Making Capybara check the page for new content before clicking the
second link solves the problem.

This commit solves issues afecting both Madrid's fork and the original
CONSUL repo.
This commit is contained in:
Javi Martín
2018-08-08 12:33:09 +02:00
committed by decabeza
parent a7a9355a58
commit dc13533371
2 changed files with 10 additions and 0 deletions

View File

@@ -499,6 +499,11 @@ feature 'Commenting legislation questions' do
within("#comment_#{@comment.id}_votes") do
find('.in_favor a').click
within('.in_favor') do
expect(page).to have_content "1"
end
find('.against a').click
within('.in_favor') do

View File

@@ -464,6 +464,11 @@ feature 'Commenting proposals' do
within("#comment_#{@comment.id}_votes") do
find('.in_favor a').click
within('.in_favor') do
expect(page).to have_content "1"
end
find('.against a').click
within('.in_favor') do