Open the newly created test file in tests/Browser/LoginTest.php . Inside your test method, you will call $this->browse() to gain an instance of the browser.
create([ 'email' => 'artisan@laravel.com', 'password' => bcrypt('secret123'), ]); // 2. Put together the feature simulation using browse() $this->browse(function (Browser $browser) use ($user) { $browser->visit('/login') ->type('email', $user->email) ->type('password', 'secret123') ->press('Log In') ->assertPathIs('/dashboard') ->assertSee('Welcome back!'); }); } } Use code with caution. Copied to clipboard ⚡ Feature Best Practices dusk browse
Generate a dedicated browser test file using Artisan. Let's assume we are building a feature to test a . php artisan dusk:make LoginTest Use code with caution. Copied to clipboard 💻 3. Implement the browse Method Open the newly created test file in tests/Browser/LoginTest
Laravel Dusk - The clean stack for Artisans and agents - Laravel 'password' => bcrypt('secret123')