Between test runs (e.g. individual php artisan dusk
commands) the browser is storing that the user from a previous test is still logged in. This just started happening today, when I had to re-install dusk due to a ChromeDriver issue.
In my DuskTestCase file I have this, which I believe previously was working:
protected function setUp(): void {
parent::setUp();
foreach (static::$browsers as $browser) {
$browser->driver->manage()->deleteAllCookies();
}
}
However, when I run tests, and add a breakpoint to $browser->driver->manage()->deleteAllCookies();
it never hits this point as static::$browsers
is an array of 0.
It then opens the browser and tries to run the test (in this case Register a new user), but it can't because a user is already logged in from the previous test.
Any ideas?