Add an expectation after signing out in officing spec

In this test, we were signing out after confirming a vote, but we
weren't waiting for the request to finish before using the `login_as`
method. Sometimes this test failed with a screenshot showing that the
user wasn't signed in after the `login_as` call, so this might have been
the cause.

We could use the `logout` method instead, but since we don't have any
other tests that click the "Sign out" link from the officing area, we're
leaving it as it was; we might change it to `logout` in the future if
the test keeps failing once in a while.

Note we're also replacing a `visit` call which my guess is was there
because the "Sign out" link wasn't visible due to the notice covering
it. So we're closing the notice instead.
This commit is contained in:
Javi Martín
2024-06-17 16:34:46 +02:00
parent 9018048e06
commit a20f32401f

View File

@@ -293,8 +293,11 @@ describe "Polls" do
expect(page).to have_content "Vote introduced!"
visit new_officing_residence_path
within("#notice") { click_button "Close" }
click_link "Sign out"
expect(page).to have_content "You must sign in or register to continue."
login_as user
visit poll_path(poll)