From ca40e657fb2bff4226b2059d9374d6f5807ca95e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Thu, 25 Apr 2019 11:36:29 +0200 Subject: [PATCH] Check page after an AJAX call removing a ballot We were sending a new request without checking the previous one had finished, and if it hadn't finished, the test failed. This test started to fail after upgrading to Rails 5, since we removed the change done in commit eda47eff which set `config.allow_concurrency` to `false` in the test environment. While we could re-introduce that configuration option, which might have side effects, an easier solution is to check an AJAX request has been completed before sending a new request depending on the previous one seems to be a more solid option. Note this test failed with two possible errors: "undefined method `heading' for nil:NilClass" and "stale element reference: element is not attached to the page document". This change fixes the second error; it might fix the first error as well, but since I couldn't reproduce it locally, we'll only be sure when this test stops failing in travis builds. --- spec/features/budgets/ballots_spec.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/spec/features/budgets/ballots_spec.rb b/spec/features/budgets/ballots_spec.rb index 639c4e75a..d849ccfc5 100644 --- a/spec/features/budgets/ballots_spec.rb +++ b/spec/features/budgets/ballots_spec.rb @@ -307,6 +307,7 @@ feature "Ballots" do within("#budget_investment_#{investment1.id}") do find(".remove a").click + expect(page).to have_link "Vote" end visit budget_investments_path(budget, heading_id: new_york.id)