From ed3ad35142713202d1b4caf36e7acc0228b012e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 18 Aug 2021 03:46:18 +0200 Subject: [PATCH] Fix flaky investments order spec We were clicking links and visiting pages without checking the previous request had already finished. This might cause concurrent requests, leading to unpredictable results. It might be the reason why this test failed once when running our continuous integration [1]. [1] https://github.com/consul/consul/runs/3295502777 --- spec/system/budgets/investments_spec.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/spec/system/budgets/investments_spec.rb b/spec/system/budgets/investments_spec.rb index bb4d0a24c..9f3086b46 100644 --- a/spec/system/budgets/investments_spec.rb +++ b/spec/system/budgets/investments_spec.rb @@ -297,8 +297,13 @@ describe "Budget Investments" do expect(order).not_to be_empty click_link "highest rated" + + expect(page).to have_css "h2", exact_text: "highest rated" + click_link "random" + expect(page).to have_css "h2", exact_text: "random" + visit budget_investments_path(budget, heading_id: heading.id) new_order = all(".budget-investment h3").map(&:text)