Skip to content

Commit

Permalink
Make Capybara check the page between custom votes
Browse files Browse the repository at this point in the history
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 affecting Madrid's fork but not the original
CONSUL repo.
  • Loading branch information
javierm committed Oct 23, 2018
1 parent 66914e6 commit 8b8a191
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions spec/features/comments/spending_proposals_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,11 @@

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
Expand Down
5 changes: 5 additions & 0 deletions spec/features/custom/probe_option_comments_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,11 @@

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
Expand Down

0 comments on commit 8b8a191

Please sign in to comment.