Add missing expectations after refreshing the page

This way we know for sure the page has finished refreshing.

Note that, for now, we aren't adding a check after every call to the
`refresh` method because sometimes the page remains identical after
refreshing. Not sure what we should do in these cases.
This commit is contained in:
Javi Martín
2025-03-24 16:49:32 +01:00
parent f63be041c1
commit 1dcfc38e41
7 changed files with 23 additions and 2 deletions

View File

@@ -1802,6 +1802,8 @@ describe "Admin budget investments", :admin do
click_button "Columns"
expect(page).to have_css "button[aria-expanded=true]", exact_text: "Columns"
within("#js-columns-selector-wrapper") do
uncheck "Title"
uncheck "Price"
@@ -1816,6 +1818,8 @@ describe "Admin budget investments", :admin do
refresh
expect(page).to have_css "button[aria-expanded=false]", exact_text: "Columns"
cookie_value = cookie_by_name("investments-columns")[:value]
expect(cookie_value).to eq("id,supports,admin,geozone,feasibility,valuation_finished," \

View File

@@ -110,9 +110,12 @@ describe "Admin legislation questions", :admin do
find("#nested_question_options input").set("Changed")
click_button "Save changes"
expect(page).to have_content "Question updated successfully"
expect(page).not_to have_css "#error_explanation"
refresh
expect(page).not_to have_content "Question updated successfully"
expect(page).to have_field(field_en[:id], with: "Changed")
end
@@ -136,6 +139,7 @@ describe "Admin legislation questions", :admin do
refresh
expect(page).not_to have_content "Question updated successfully"
expect(page).not_to have_field fields_for(:en).first[:id], with: "Yes"
expect(page).to have_field fields_for(:en).last[:id], with: "No"
end

View File

@@ -69,6 +69,8 @@ describe "Admin booths", :admin do
expect(page).to have_content "Booth created successfully"
refresh
expect(page).not_to have_content "Booth created successfully"
expect(page).to have_content "Upcoming booth"
expect(page).to have_content "39th Street, number 2, ground floor"
end

View File

@@ -66,6 +66,7 @@ describe "Poll question options", :admin do
refresh
expect(page).not_to have_content "Changes saved"
expect(page).not_to have_content "Answer title"
expect("Another title").to appear_before("New title")

View File

@@ -75,6 +75,9 @@ describe "Admin custom information texts", :admin do
expect(page).to have_content "Translation updated successfully"
refresh
expect(page).not_to have_content "Translation updated successfully"
select "Français", from: "Current language"
expect(page).to have_content "Aide personalise sur les débats"