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.
This commit is contained in:
Javi Martín
2022-08-24 18:01:23 +02:00
parent dce8400775
commit 62b3521a0f

View File

@@ -69,16 +69,14 @@ describe "Results" do
scenario "Does not show price and available budget when hide money" do scenario "Does not show price and available budget when hide money" do
budget.update!(voting_style: "approval", hide_money: true) budget.update!(voting_style: "approval", hide_money: true)
visit budget_path(budget)
click_link "See results"
expect(page).to have_content "First selected" visit budget_results_path(budget)
expect(page).to have_content "Second selected"
expect(page).not_to have_content 200
expect(page).not_to have_content 300
expect(page).not_to have_content "Price" expect(page).not_to have_content "Price"
expect(page).not_to have_content "Available budget" expect(page).not_to have_content "Available budget"
expect(page).not_to have_content "" 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 end
scenario "Does not raise error if budget (slug or id) is not found" do scenario "Does not raise error if budget (slug or id) is not found" do