This worked for me:
$browser->visit('/logout')->logout()
No idea why it works.
LATER EDIT: probably because it logs out both remote accessed Chromedriver session and locally stored session.
Update.
I understand. My bad. Login works through POST.
Hi!
I have Laravel 5.4 with standard auth system. I try do test for logout, but have error.
My test:
<?php
namespace Tests\Browser;
use App\User;
use Laravel\Dusk\Browser;
use Tests\DuskTestCase;
use Illuminate\Foundation\Testing\DatabaseMigrations;
class LoginTest extends DuskTestCase
{
use DatabaseMigrations;
public function testLogout()
{
factory(User::class)->create([
'email' => '[email protected]',
]);
$this->browse(function (Browser $browser) {
$browser->loginAs(User::find(1))
->visit('/logout')
->assertGuest()
;
});
}
}
Error: There was 1 failure:
/var/www/getinterlude/vendor/laravel/dusk/src/Concerns/InteractsWithAuthentication.php:80 /var/www/getinterlude/tests/Browser/LoginTest.php:42 /var/www/getinterlude/vendor/laravel/dusk/src/TestCase.php:88 /var/www/getinterlude/tests/Browser/LoginTest.php:44
I have tried many other options. But nothing is working. What is wrong?
Update.
I understand. My bad. Login works through POST.
Please or to participate in this conversation.