artisan('db:seed'); }); it('renders the profile page with its cards', function () { browserLogin(); visit('/profile') ->assertNoJavaScriptErrors() ->assertSee('My Profile') ->assertSee('User Details') ->assertSee('Login Details') ->assertSee('Change Photo'); }); it('updates the profile details', function () { $user = browserLogin(); visit('/profile') ->fill('#first_name', 'Grace') ->fill('#last_name', 'Hopper') ->click('Update Details') ->assertSee('Profile updated successfully.'); expect($user->fresh()->first_name)->toBe('Grace'); expect($user->fresh()->last_name)->toBe('Hopper'); }); it('keeps role and status read only on the profile', function () { browserLogin(); visit('/profile') ->assertSee('Role') ->assertAttribute('#role_id', 'disabled', '') ->assertAttribute('#status', 'disabled', ''); }); it('changes the password from the login details tab', function () { $user = browserLogin(); // The inactive tab panel is unmounted, so the two "Update Details" buttons // never coexist and the label stays unambiguous. visit('/profile') ->click('Login Details') ->assertSee('New Password') ->fill('#password', 'a-brand-new-password') ->fill('#password_confirmation', 'a-brand-new-password') ->click('Update Details') ->assertSee('Login details updated successfully.'); expect(Hash::check('a-brand-new-password', $user->fresh()->password))->toBeTrue(); }); it('shows the two-factor tab only when the feature is enabled', function () { $this->setSettings(['2fa.enabled' => false]); browserLogin(); visit('/profile') ->assertSee('Login Details') ->assertDontSee('Two-Factor Authentication'); $this->setSettings(['2fa.enabled' => true]); visit('/profile')->assertSee('Two-Factor Authentication'); });