marcoCarcangiu
2 years ago
1933
3
Testing

Laravel Dusk not picking up APP_URL in .env.dusk.local file

Posted 2 years ago by marcoCarcangiu

Laravel dusk does not seem to use the APP_URL set in .env.dusk.local file.

This is my .env.dusk.local file:

 APP_URL=http://local.project/
 BASE_URL=http://local.project/
 APP_ENV=testing
 DB_CONNECTION=dusk

This is my login test:

 <?php

     namespace Tests\Browser;

     use Tests\DuskTestCase;

         class LoginTest extends DuskTestCase
         {

         /**
         * test_I_can_login_successfully
         *
         * @return void
         */
          public function test_I_can_login_successfully()
          {
                 $this->browse(function ($browser) {
                 $browser->visit('login')
                        ->keys('#email', '[email protected]')
                        ->keys('#password', 'test')
                        ->click('.btn-primary')
                        ->assertPathIs('dashboard')
                        ->assertSee('Marco');
                    });
            }

       }

But when I run the test instead of going to http://local.project/login goes to http://localhost/public/local

Why is that?

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