Can't test applications with Laravel Dusk if the app uses Laravel Passport for authentication. It's always 404 and if you stop the test with ->stop()
it starts working.
The app is located: localhost:3000
and all requests are proxied to api.example.test
I've tried to authenticate the user inside the test:
$this->actingAs(User::find(1), 'api');
$browser->loginAs(User::find(1));
Passport::actingAs($this->user);
But still the same.
That's not the only problem, I think the main issue is also that I can't log in with Dusk by filling out the form and click "login"
$browser->visit('/login')
->type('@email', '[email protected]')
->type('@password', 'password')
->click('@login-button')
->waitForLocation('/');
But again, if you stop the test with ->stop()
you can manually click the button and it will log you in.
Is Laravel Dusk useless if your app does not use basic auth?