bencarter78@hotmail.com's avatar

Laravel Dusk Test Hanging On Login

Hi

I'm just getting started with Dusk and am failing at the first hurdle! I'm simply trying to login to my application and see the dashboard.

However, it just hangs on http://myurl.dev/_dusk/login/1 and then fails saying it couldn't see the expected text.

Here's my test...

function test_it_displays_the_dashboard()
    {
        $user = factory(User::class)->create();

        $this->browse(function ($browser) use ($user) {
            $browser->loginAs($user)
                    ->visit('/dashboard')
                    ->assertSee('Dashboard');
        });
    }

Any ideas what's going wrong?

Thanks

0 likes
5 replies
bencarter78@hotmail.com's avatar
Level 14

I think this was actually caused by the user not having permission to view the page (my bad), however, it was just getting stuck on the url, and not returning to one of my application pages. With the flash error message.

If anyone else finds this thread check the permission of the user, it might be the problem.

1 like
elgabo.msn@gmail.com's avatar

I'm having the same issue, currently running Laravel 5.4 through Homestead. How did you fix this?

bencarter78@hotmail.com's avatar

@gabiyo In my case, I was trying to access a part of my application as a normal user when it needed to be a super user with admin privileges

hesamurai's avatar

I am having the exact same problem. It seems like $browser->loginAs($user) does not work at all.

Any help would be much appreciated.

wamae's avatar

Having the same issue also. Mine returns a blank page.

Please or to participate in this conversation.