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!
```
This commit is contained in:
Javi Martín
2025-03-12 01:42:32 +01:00
parent 148ac6dcb4
commit f913ca75c6
2 changed files with 3 additions and 0 deletions

View File

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

View File

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