Changeset View
Changeset View
Standalone View
Standalone View
src/tests/Browser/UserProfileTest.php
Show First 20 Lines • Show All 97 Lines • ▼ Show 20 Lines | public function testProfile(): void | ||||
->click('button[type=submit]'); | ->click('button[type=submit]'); | ||||
}) | }) | ||||
->with(new Toast(Toast::TYPE_SUCCESS), function (Browser $browser) { | ->with(new Toast(Toast::TYPE_SUCCESS), function (Browser $browser) { | ||||
$browser->assertToastTitle('') | $browser->assertToastTitle('') | ||||
->assertToastMessage('User data updated successfully') | ->assertToastMessage('User data updated successfully') | ||||
->closeToast(); | ->closeToast(); | ||||
}); | }); | ||||
// Test error handling | // Test error handling | ||||
$browser->with('@form', function (Browser $browser) { | $browser->with('@form', function (Browser $browser) { | ||||
$browser->type('#phone', 'aaaaaa') | $browser->type('#phone', 'aaaaaa') | ||||
->type('#external_email', 'bbbbb') | ->type('#external_email', 'bbbbb') | ||||
->click('button[type=submit]') | ->click('button[type=submit]') | ||||
->waitFor('#phone + .invalid-feedback') | ->waitFor('#phone + .invalid-feedback') | ||||
->assertSeeIn('#phone + .invalid-feedback', 'The phone format is invalid.') | ->assertSeeIn('#phone + .invalid-feedback', 'The phone format is invalid.') | ||||
->assertSeeIn( | ->assertSeeIn( | ||||
'#external_email + .invalid-feedback', | '#external_email + .invalid-feedback', | ||||
'The external email must be a valid email address.' | 'The external email must be a valid email address.' | ||||
) | ) | ||||
->assertFocused('#phone'); | ->assertFocused('#phone'); | ||||
}) | }) | ||||
->with(new Toast(Toast::TYPE_ERROR), function (Browser $browser) { | ->with(new Toast(Toast::TYPE_ERROR), function (Browser $browser) { | ||||
$browser->assertToastTitle('Error') | $browser->assertToastTitle('Error') | ||||
->assertToastMessage('Form validation error') | ->assertToastMessage('Form validation error') | ||||
->closeToast(); | ->closeToast(); | ||||
}); | }); | ||||
}); | }); | ||||
// TODO: Test acting as non-controller user, decide what he can change beside the password | |||||
// TODO: Test "Delete account" button and /profile/delete page | |||||
$this->markTestIncomplete(); | |||||
} | } | ||||
} | } |