You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In our test suite we reset the database between scenario's to ensure test isolation, we also do this because for some upgrade paths we require a specifically prepared database.
However in a feature file that has:
Scenario: One
Given I am logged in as a user with the authenticated role
And I am on "/user/2/edit"
Scenario: Two
Given I am logged in as a user with the authenticated role
And I am on "/user/2/edit"
Then Scenario "Two" will fail on the "/user/2/edit" page because the user doesn't exist. Even when we reset the session, Mink doesn't throw away the page. So the logic in DrupalAuthenticationManager::loggedIn will see a started session and the previous (logged in) page and assume that the user is still logged in. However, the user will no longer exist in the database so when actually visiting a page that requires authentication this will now fail.
I would expect the DrupalExtension to just assume people are logged out when a new scenario is started. I also don't see an easy way to make it do this without an internal change to the extension.
The text was updated successfully, but these errors were encountered:
Kingdutch
added a commit
to goalgorilla/open_social
that referenced
this issue
May 4, 2023
In newly written tests we were already doin this manually in each
scenario. Between scenario's the user manager in the DrupalExtension was
not correctly keeping track of the logged in user status which could
prevent a new scenario from logging a user in.
With the removal of clean-up in scenario's we now need that logout step
literally everywhere, so it's easier to add it as an `@afterScenario`
and run it every time than to require developers to decide about 100s of
places whether it's needed.
See jhedstrom/drupalextension#641
robertragas
pushed a commit
to goalgorilla/open_social
that referenced
this issue
Jul 22, 2023
In newly written tests we were already doin this manually in each
scenario. Between scenario's the user manager in the DrupalExtension was
not correctly keeping track of the logged in user status which could
prevent a new scenario from logging a user in.
With the removal of clean-up in scenario's we now need that logout step
literally everywhere, so it's easier to add it as an `@afterScenario`
and run it every time than to require developers to decide about 100s of
places whether it's needed.
See jhedstrom/drupalextension#641
In our test suite we reset the database between scenario's to ensure test isolation, we also do this because for some upgrade paths we require a specifically prepared database.
However in a feature file that has:
Then Scenario "Two" will fail on the "/user/2/edit" page because the user doesn't exist. Even when we reset the session, Mink doesn't throw away the page. So the logic in
DrupalAuthenticationManager::loggedIn
will see a started session and the previous (logged in) page and assume that the user is still logged in. However, the user will no longer exist in the database so when actually visiting a page that requires authentication this will now fail.I would expect the DrupalExtension to just assume people are logged out when a new scenario is started. I also don't see an easy way to make it do this without an internal change to the extension.
The text was updated successfully, but these errors were encountered: