browse(function (Browser $browser) { // 1. Test Registration $browser->visit('/register') ->waitForText('Create an account') ->type('name', 'New Browser User') ->type('email', 'newbrowseruser@example.com') ->type('password', 'password') ->type('password_confirmation', 'password') ->press('Create account') ->waitForLocation('/dashboard') ->assertPathIs('/dashboard') ->assertSee('New Browser User'); // 2. Test Logout // Open the user menu (trigger button shows initials or user name) $browser->click('button[aria-haspopup="menu"]') ->waitForText('Log out') ->clickLink('Log out') ->waitForLocation('/login') // Fortify logs out and redirects to login or home ->assertPathIs('/login'); // 3. Test Login $browser->type('email', 'newbrowseruser@example.com') ->type('password', 'password') ->press('Log in') ->waitForLocation('/dashboard') ->assertPathIs('/dashboard') ->assertSee('New Browser User'); }); });