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

@@ -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