Add missing expectations in common actions

We weren't checking that the request caused by clicking on the "Send
instructions" button had finished before continuing with the test.
Perhaps that's why this test has recently failed on our CI:

```
3) Emails Reset password
     Failure/Error: email = open_last_email

     RuntimeError:
       No email has been sent!
```

We're also adding an expectation to the `login_as_manager` method and
the methods to submit proposal and investment forms to make sure that,
when these method finish, the request finishes as well.
This commit is contained in:
Javi Martín
2025-03-10 17:36:38 +01:00
parent 8350b787f9
commit 6c055f2713
2 changed files with 9 additions and 0 deletions

View File

@@ -7,9 +7,12 @@ module Maps
def submit_proposal_form
check :proposal_terms_of_service
click_button "Create proposal"
expect(page).to have_content "Proposal created successfully."
if page.has_content?("Not now, go to my proposal")
click_link "Not now, go to my proposal"
expect(page).not_to have_link "Not now, go to my proposal"
end
end
@@ -22,6 +25,7 @@ module Maps
def submit_budget_investment_form
check :budget_investment_terms_of_service
click_button "Create Investment"
expect(page).to have_content "Budget Investment created successfully"
end
def set_arguments(arguments, mappable, mappable_path_arguments)

View File

@@ -49,6 +49,8 @@ module Users
def login_as_manager(manager = create(:manager))
login_as(manager.user)
visit management_sign_in_path
expect(page).to have_content "Management"
end
def login_managed_user(user)
@@ -74,6 +76,9 @@ module Users
fill_in "user_email", with: "manuela@consul.dev"
click_button "Send instructions"
expect(page).to have_content "If your email address is in our database, in a few minutes " \
"you will receive a link to use to reset your password."
end
def expect_to_be_signed_in