From 8b8b1b7a431dba28b98012ff2c75554476ee8953 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Mon, 14 Jun 2021 01:52:45 +0200 Subject: [PATCH] Fix flaky hidden budget investments spec The test was failing sometimes because the conditions we were checking were the same before and after clicking the "Pending" link. So there was a race condition between the request generated by clicking the "Pending" link and the order to click the "Confirm moderation" link. This sometimes resulted in the "Confirm moderation" link not being correctly clicked. --- spec/system/admin/hidden_budget_investments_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/system/admin/hidden_budget_investments_spec.rb b/spec/system/admin/hidden_budget_investments_spec.rb index 0baa84ea8..759385343 100644 --- a/spec/system/admin/hidden_budget_investments_spec.rb +++ b/spec/system/admin/hidden_budget_investments_spec.rb @@ -31,7 +31,9 @@ describe "Admin hidden budget investments", :admin do investment = create(:budget_investment, :hidden, heading: heading) visit admin_hidden_budget_investments_path - click_link("Pending") + click_link "Pending" + + expect(page).not_to have_link "Pending" expect(page).to have_content(investment.title) click_link "Confirm moderation"