use of org.xwiki.user.test.po.PreferencesUserProfilePage in project xwiki-platform by xwiki.
the class UserProfileTest method testChangePassword.
/**
* Functionality check: changing the password.
*/
@Test
@IgnoreBrowsers({ @IgnoreBrowser(value = "internet.*", version = "8\\.*", reason = "See https://jira.xwiki.org/browse/XE-1146"), @IgnoreBrowser(value = "internet.*", version = "9\\.*", reason = "See https://jira.xwiki.org/browse/XE-1177") })
public void testChangePassword() {
// Change the password
PreferencesUserProfilePage preferencesPage = this.customProfilePage.switchToPreferences();
ChangePasswordPage changePasswordPage = preferencesPage.changePassword();
String newPassword = RandomStringUtils.randomAlphanumeric(6);
changePasswordPage.changePassword(DEFAULT_PASSWORD, newPassword, newPassword);
changePasswordPage.submit();
// Logout
getUtil().forceGuestUser();
// Login with the new password and navigate to a page to verify that the user is logged in
getUtil().loginAndGotoPage(this.userName, newPassword, getUtil().getURL(getTestClassName(), getTestMethodName()));
ViewPage vp = new ViewPage();
Assert.assertTrue(vp.isAuthenticated());
getUtil().recacheSecretToken();
// Reset the password
getUtil().loginAsSuperAdminAndGotoPage(this.customProfilePage.getURL());
preferencesPage = this.customProfilePage.switchToPreferences();
changePasswordPage = preferencesPage.changePassword();
changePasswordPage.changePasswordAsAdmin(DEFAULT_PASSWORD, DEFAULT_PASSWORD);
changePasswordPage.submit();
Assert.assertEquals("Your password has been successfully changed.", changePasswordPage.getSuccessMessage());
}
Aggregations