|
1 | 1 | <?php
|
| 2 | + |
| 3 | +use App\Models\User; |
| 4 | + |
| 5 | +use function Pest\Laravel\actingAs; |
| 6 | + |
| 7 | +test('confirm password screen can be rendered', function () { |
| 8 | + actingAs(User::factory()->create()); |
| 9 | + |
| 10 | + visit(route('password.confirm')) |
| 11 | + ->assertSee('Confirm your password') |
| 12 | + ->assertSee('This is a secure area of the application. Please confirm your password before continuing.') |
| 13 | + ->assertNoConsoleLogs() |
| 14 | + ->assertNoJavaScriptErrors(); |
| 15 | +}); |
| 16 | + |
| 17 | +test('password can be confirmed', function () { |
| 18 | + actingAs(User::factory()->create()); |
| 19 | + |
| 20 | + visit(route('password.confirm')) |
| 21 | + ->fill('password', 'password') |
| 22 | + ->press('Confirm Password') |
| 23 | + ->assertUrlIs(route('dashboard')) |
| 24 | + ->assertNoConsoleLogs() |
| 25 | + ->assertNoJavaScriptErrors(); |
| 26 | +}); |
| 27 | + |
| 28 | +test('password is not confirmed with invalid password', function () { |
| 29 | + actingAs(User::factory()->create()); |
| 30 | + |
| 31 | + visit(route('password.confirm')) |
| 32 | + ->fill('password', 'wrong-password') |
| 33 | + ->press('Confirm Password') |
| 34 | + ->assertUrlIs(route('password.confirm')) |
| 35 | + ->assertSee('The provided password is incorrect.') |
| 36 | + ->assertNoConsoleLogs() |
| 37 | + ->assertNoJavaScriptErrors(); |
| 38 | +}); |
0 commit comments