Setting up Dusk with testing database

Posted 1 month ago by bencarter78


I'm having real issues with getting Dusk to work with a testing database. I seem to have gone through every piece of advice and still no luck. Dusk is not loading my .env.dusk.local file for some reason. Can anyone help?

// test
class ApplicationTest extends DuskTestCase
    use DatabaseMigrations;

    /** @test */
    public function it_works()
        $this->browse(function (Browser $browser) {
            $browser->visit('/test')->assertSee('It works!');

// .env.dusk.local


// database.php
'dusk' => [
    'driver' => 'sqlite',
    'database' => database_path('dusk.sqlite'),
    'prefix' => '',

Then I run the PHP web server with php artisan serve --env=dusk.local however Dusk uses the .env file and goes to my development site using the development database.

What am I doing wrong?

Please sign in or create an account to participate in this conversation.