From 1b46afc95cb75ce58b23cfdc6b5e0f0f76ab6832 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sun, 6 Oct 2024 16:06:31 +0200 Subject: [PATCH] Check different content in select investments test Since we were checking something that was already there, if the form were submitted using an AJAX request (which is the default with Turbo, although we don't use it yet), there would be a chance that the request didn't finish before the test does, leading to potential failures in the next test. This way we're also checking that the "Filter" button actually does something when selecting the "Selected" filter. --- spec/system/admin/budget_investments_spec.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spec/system/admin/budget_investments_spec.rb b/spec/system/admin/budget_investments_spec.rb index cfa25f076..2df4ca0cf 100644 --- a/spec/system/admin/budget_investments_spec.rb +++ b/spec/system/admin/budget_investments_spec.rb @@ -1410,6 +1410,8 @@ describe "Admin budget investments", :admin do scenario "Selecting an investment" do visit admin_budget_budget_investments_path(budget) + expect(page).to have_content "Unfeasible project" + within("#budget_investment_#{feasible_vf_bi.id}") do click_button "Select" expect(page).to have_button "Selected" @@ -1420,6 +1422,8 @@ describe "Admin budget investments", :admin do within("#advanced_filters") { check("Selected") } click_button("Filter") + expect(page).not_to have_content "Unfeasible project" + within("#budget_investment_#{feasible_vf_bi.id}") do expect(page).not_to have_button "Select" expect(page).to have_button "Selected"