From 62b3521a0fa9598123c48a27bac07a99204870c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 24 Aug 2022 18:01:23 +0200 Subject: [PATCH] Fix flaky budget results test We were checking that the price of the investment isn't present on the page. However, the text "200" could be present in either the title of the budget or the title of the heading ("Heading 200"), for instance. So now we're making sure we look for the text on the relevant part of the page. --- spec/system/budgets/results_spec.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/spec/system/budgets/results_spec.rb b/spec/system/budgets/results_spec.rb index 136df7e69..b17618ef6 100644 --- a/spec/system/budgets/results_spec.rb +++ b/spec/system/budgets/results_spec.rb @@ -69,16 +69,14 @@ describe "Results" do scenario "Does not show price and available budget when hide money" do budget.update!(voting_style: "approval", hide_money: true) - visit budget_path(budget) - click_link "See results" - expect(page).to have_content "First selected" - expect(page).to have_content "Second selected" - expect(page).not_to have_content 200 - expect(page).not_to have_content 300 + visit budget_results_path(budget) + expect(page).not_to have_content "Price" expect(page).not_to have_content "Available budget" expect(page).not_to have_content "€" + within("tr", text: "First selected") { expect(page).not_to have_content 200 } + within("tr", text: "Second selected") { expect(page).not_to have_content 300 } end scenario "Does not raise error if budget (slug or id) is not found" do