I am trying to test the Remember Me function using Behat / Mink. Here is my scenario:
Scenario: A user logs in ticking "Remember me". As he closes his browser and visits back the site, he should be automatically logged in
Given I am on "/login"
Then I should see "Site Login"
When I fill in "Username" with "test"
And I fill in "Password" with "test"
And I check "Remember me"
When I press "Login"
Then I should see "Welcome"
When I restart the browser
Then I go to "/login"
Then I should see "Welcome"
Here is the definition of browser restart:
public function iRestartTheBrowser()
{
$this->getSession()->restart();
}
I also tried $this->getSession()->reset();
The problem is that cookies are deleted when the browser restarts, the “remember me” function no longer works. Is there a way to restart in a mink without clearing cookies?
source
share