Laravel Dusk - Fails test but how can I see what test sees?

Posted 1 year ago by longestdrive

Hi I'm getting started with Laravel Dusk (v2) with a Laravel 5.5 app

I'm starting small and want to test that a user can log in so have created this test:

public function test_user_can_browse_to_login_page_and_log_in()
    {
//        $this->logout();

        $this->browse(function (Browser $browser) {
            $browser->visit('/')
                ->assertSee('You have arrived')
                ->click('@dashboard-link')
                ->assertSee('login')
                ->type('email', '[email protected]')
                ->type('password', 'password')
                ->click('@login-button') 
                ->assertPathIs('/dashboard')
                ->assertSee('seven days');

        });
    }

It all works fine until the last assertion - it doesn't see seven days which should be on the dashboard page.

So, to debug how can I see what the test is seeing? Is there a method to view the results?

Also, I don't see a browser opening (which I understand is correct) - I've followed another post and removed --headless from the DustTestCase.php but that then hangs completely. So I'm unable to watch the tests. (I have replaced the --headless option)

New to this so be kind!!

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

Reply to

Use Markdown with GitHub-flavored code blocks.