From f913ca75c6e811a5584da89cdc762c9734a177be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Wed, 12 Mar 2025 01:42:32 +0100 Subject: [PATCH] Add missing expectations before opening the last email We weren't checking that the requests had finished before checking the last sent email. That's probably why one of these tests has recently failed on our CI: ``` 1) System Emails Preview Pending #send_pending Failure/Error: email = open_last_email RuntimeError: No email has been sent! ``` --- spec/support/common_actions/users.rb | 1 + spec/system/admin/system_emails_spec.rb | 2 ++ 2 files changed, 3 insertions(+) diff --git a/spec/support/common_actions/users.rb b/spec/support/common_actions/users.rb index 4b49bd0b2..a9582225f 100644 --- a/spec/support/common_actions/users.rb +++ b/spec/support/common_actions/users.rb @@ -11,6 +11,7 @@ module Users check "user_terms_of_service" click_button "Register" + expect(page).to have_content "Thank you for registering" end def login_through_form_with_email_and_password(email = "manuela@consul.dev", password = "judgementday") diff --git a/spec/system/admin/system_emails_spec.rb b/spec/system/admin/system_emails_spec.rb index baefc2e2f..e8e5bcbad 100644 --- a/spec/system/admin/system_emails_spec.rb +++ b/spec/system/admin/system_emails_spec.rb @@ -359,6 +359,8 @@ describe "System Emails" do click_button "Send pending" + expect(page).to have_content "Pending notifications sent successfully" + email = open_last_email expect(email).to deliver_to(voter) expect(email).to have_body_text(proposal_notification.body)