Check flash messages in some system tests

This way it's more clear what the user experience is during the process.

Note this did not result in flaky tests, since the tests continue by
clicking links, that are only present after the request has finished.
However, we're adding expectations so we don't have to think whether the
tests could be flaky and because this way we're also testing the user
experience; it would be strange for a user if they were redirected to a
page without a flash message.
This commit is contained in:
Javi Martín
2025-03-10 23:33:30 +01:00
parent 548e282564
commit 3a9263f6e6
3 changed files with 16 additions and 0 deletions

View File

@@ -65,7 +65,12 @@ describe "SMS Verification" do
5.times do
fill_in "sms_phone", with: "611111111"
click_button "Send"
expect(page).to have_content "Enter the confirmation code sent to you by text message"
click_link "Click here to send it again"
expect(page).not_to have_content "Enter the confirmation code sent to you by text message"
end
expect(page).to have_content "You have reached the maximum number of attempts. Please try again later."