Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/PasswordResetTest.php
Show First 20 Lines • Show All 140 Lines • ▼ Show 20 Lines | public function testPasswordResetStep2(): void | ||||
// Submit invalid code | // Submit invalid code | ||||
// We expect code input to have is-invalid class added, with .invalid-feedback element | // We expect code input to have is-invalid class added, with .invalid-feedback element | ||||
$browser->with('@step2', function ($step) use ($browser) { | $browser->with('@step2', function ($step) use ($browser) { | ||||
$step->type('#reset_short_code', 'XXXXX'); | $step->type('#reset_short_code', 'XXXXX'); | ||||
$step->click('[type=submit]'); | $step->click('[type=submit]'); | ||||
$browser->waitFor('.toast-error'); | $browser->waitFor('.toast-error'); | ||||
$step->assertVisible('#reset_short_code.is-invalid'); | $step->waitFor('#reset_short_code.is-invalid') | ||||
$step->assertVisible('#reset_short_code + .invalid-feedback'); | ->assertVisible('#reset_short_code.is-invalid') | ||||
$step->assertFocused('#reset_short_code'); | ->assertVisible('#reset_short_code + .invalid-feedback') | ||||
->assertFocused('#reset_short_code'); | |||||
$browser->click('.toast-error'); // remove the toast | $browser->click('.toast-error'); // remove the toast | ||||
}); | }); | ||||
// Submit valid code | // Submit valid code | ||||
// We expect error state on code input to be removed, and Step 3 form visible | // We expect error state on code input to be removed, and Step 3 form visible | ||||
$browser->with('@step2', function ($step) { | $browser->with('@step2', function ($step) { | ||||
// Get the code and short_code from database | // Get the code and short_code from database | ||||
▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | public function testPasswordResetStep3(): void | ||||
$step->type('#reset_password', '12345678'); | $step->type('#reset_password', '12345678'); | ||||
$step->type('#reset_confirm', '123456789'); | $step->type('#reset_confirm', '123456789'); | ||||
$step->click('[type=submit]'); | $step->click('[type=submit]'); | ||||
$browser->waitFor('.toast-error'); | $browser->waitFor('.toast-error'); | ||||
$step->assertVisible('#reset_password.is-invalid'); | $step->waitFor('#reset_password.is-invalid') | ||||
$step->assertVisible('#reset_password + .invalid-feedback'); | ->assertVisible('#reset_password.is-invalid') | ||||
$step->assertFocused('#reset_password'); | ->assertVisible('#reset_password + .invalid-feedback') | ||||
->assertFocused('#reset_password'); | |||||
$browser->click('.toast-error'); // remove the toast | $browser->click('.toast-error'); // remove the toast | ||||
}); | }); | ||||
// Submit valid data | // Submit valid data | ||||
$browser->with('@step3', function ($step) { | $browser->with('@step3', function ($step) { | ||||
$step->type('#reset_confirm', '12345678'); | $step->type('#reset_confirm', '12345678'); | ||||
Show All 12 Lines |