Simplify navigation in budget executions tests

We're already testing the navigation in one test, and in some of these
tests we were checking, for instance, that the title of an investment is
present after a click, but since it is also present before that click,
that could lead to the test finishing before the request does.
This commit is contained in:
Javi Martín
2025-03-16 03:38:20 +01:00
parent 533d2198ee
commit 99932e0aaf

View File

@@ -29,8 +29,6 @@ describe "Executions" do
visit budget_path(budget)
click_link "See results"
expect(page).to have_link("Milestones")
click_link "Milestones"
expect(page).to have_content(investment1.title)
@@ -60,10 +58,7 @@ describe "Executions" do
scenario "Show message when there are no winning investments with the selected status" do
create(:milestone_status, name: I18n.t("seeds.budgets.statuses.executed"))
visit budget_path(budget)
click_link "See results"
click_link "Milestones"
visit budget_executions_path(budget)
expect(page).to have_content("No winner investments in this state")
@@ -83,10 +78,7 @@ describe "Executions" do
scenario "renders default image if no milestone nor investment images are available" do
create(:milestone, milestoneable: investment4)
visit budget_path(budget)
click_link "See results"
click_link "Milestones"
visit budget_executions_path(budget)
expect(page).to have_content investment4.title
expect(page).to have_css "img[alt='#{investment4.title}']"
@@ -106,10 +98,7 @@ describe "Executions" do
publication_date: Date.yesterday,
status: status2)
visit budget_path(budget)
click_link "See results"
click_link "Milestones"
visit budget_executions_path(budget)
expect(page).to have_content("All (2)")
expect(page).to have_content("#{status1.name} (1)")
@@ -121,10 +110,7 @@ describe "Executions" do
create(:milestone, milestoneable: investment2, status: status2)
create(:milestone_status, name: I18n.t("seeds.budgets.statuses.executing_project"))
visit budget_path(budget)
click_link "See results"
click_link "Milestones"
visit budget_executions_path(budget)
expect(page).to have_content(investment1.title)
expect(page).to have_content(investment2.title)
@@ -157,9 +143,7 @@ describe "Executions" do
publication_date: Date.yesterday,
status: status2)
visit budget_path(budget)
click_link "See results"
click_link "Milestones"
visit budget_executions_path(budget)
select "Studying the project (0)", from: "Project's current state"
click_button "Filter"
@@ -181,9 +165,7 @@ describe "Executions" do
publication_date: Date.tomorrow,
status: status2)
visit budget_path(budget)
click_link "See results"
click_link "Milestones"
visit budget_executions_path(budget)
select "Studying the project (1)", from: "Project's current state"
click_button "Filter"
@@ -207,10 +189,7 @@ describe "Executions" do
investment3.milestone_tag_list.add("tag2")
investment3.save!
visit budget_path(budget)
click_link "See results"
click_link "Milestones"
visit budget_executions_path(budget)
expect(page).to have_content(investment1.title)
expect(page).to have_content(investment2.title)