Chromedriver does not store the cookie when running Laravel Dusk

Viewed 318

I am writing E2E tests using Laravel Dusk and have encountered a problem that my session starts again on each request. Digging deaper I have found that Chromedriver is not storing any cookies at all, so the user does not have a session as he cant store a session key and on each request is considered being a new user.

What might be the possible reason of Chromedriver not storing a cookie? By the way I am running it on Gitlab.

Here is the test code:

public function testBasicExample()
    {
        $this->browse(function (Browser $browser) {
            $browser->visit('/')
                ->assertSee("add cluster")
                ->assertPathIs('/add-cluster')
                ->waitForText('Cluster list')
                ->pause(1000)
                ->click("[href='#addClusterModal']")
                ->waitForText("New cluster")
                ->whenAvailable('#addClusterModal', function ($modal) {
                    $modal->type("name", 'first cluster')
                        ->type('url', config('app.test-cluster-host'))
                        ->type('port', '9200')
                        ->press('Add')
                        ->pause(1000);
                })
                ->screenshot('add-cluster')
                ->visit('/')
                ->assertSee('Simple summary of most important Cluster items');
        });
    }
0 Answers
Related