Add expectations to check requests are complete

We want to make sure the request is finished after clicking a button and
before visiting a different page, so we need to check the page has
changed.

Usually this shouldn't be a problem because most of our forms are sent
with regular HTTP requests instead of AJAX ones, so the `visit` method
wouldn't be called before the request is finished.

However, we're experiencing problems with certain version of
Chromedriver, and in general it's a good practice because we might send
forms using AJAX/Turbolinks in the future.
This commit is contained in:
Javi Martín
2021-04-10 21:33:34 +02:00
parent 2732c08f3d
commit 74ca332989
4 changed files with 19 additions and 0 deletions

View File

@@ -301,6 +301,8 @@ describe "System Emails" do
click_on "Moderate notification send"
end
expect(page).not_to have_content("Proposal A Title")
visit admin_system_email_preview_pending_path("proposal_notification_digest")
expect(page).to have_content("Proposal B")