1

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?

vue-coder
  • 317
  • 1
  • 3
  • 10
  • Have you tried: https://stackoverflow.com/a/44907379/1033654 ? – Rwd Nov 27 '21 at 12:15
  • @Rwd yeah, I can see that session()->flush(); gets hit once the tests have finished, but when I run the tests again, the user is still logged in. – vue-coder Nov 27 '21 at 22:16

0 Answers0