Search in sources :

Example 1 with ChangePasswordPage

use of org.xwiki.user.test.po.ChangePasswordPage in project xwiki-platform by xwiki.

the class UserProfileTest method testChangePasswordOfAnotherUserWithTwoDifferentPasswords.

@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 testChangePasswordOfAnotherUserWithTwoDifferentPasswords() {
    // Login as superadmin (to have Admin rights) and change the password of another user.
    getUtil().loginAsSuperAdminAndGotoPage(this.customProfilePage.getURL());
    PreferencesUserProfilePage preferencesPage = this.customProfilePage.switchToPreferences();
    ChangePasswordPage changePasswordPage = preferencesPage.changePassword();
    changePasswordPage.changePasswordAsAdmin(PASSWORD_1, PASSWORD_2);
    changePasswordPage.submit();
    Assert.assertEquals("The two passwords do not match.", changePasswordPage.getValidationErrorMessage());
}
Also used : ChangePasswordPage(org.xwiki.user.test.po.ChangePasswordPage) PreferencesUserProfilePage(org.xwiki.user.test.po.PreferencesUserProfilePage) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test) AbstractTest(org.xwiki.test.ui.AbstractTest)

Example 2 with ChangePasswordPage

use of org.xwiki.user.test.po.ChangePasswordPage in project xwiki-platform by xwiki.

the class UserProfileTest method testChangePasswordWithTwoDifferentPasswords.

@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 testChangePasswordWithTwoDifferentPasswords() {
    PreferencesUserProfilePage preferencesPage = this.customProfilePage.switchToPreferences();
    ChangePasswordPage changePasswordPage = preferencesPage.changePassword();
    changePasswordPage.changePassword(DEFAULT_PASSWORD, PASSWORD_1, PASSWORD_2);
    changePasswordPage.submit();
    Assert.assertEquals("The two passwords do not match.", changePasswordPage.getValidationErrorMessage());
}
Also used : ChangePasswordPage(org.xwiki.user.test.po.ChangePasswordPage) PreferencesUserProfilePage(org.xwiki.user.test.po.PreferencesUserProfilePage) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test) AbstractTest(org.xwiki.test.ui.AbstractTest)

Example 3 with ChangePasswordPage

use of org.xwiki.user.test.po.ChangePasswordPage in project xwiki-platform by xwiki.

the class UserProfileTest method testChangePasswordWithWrongOriginalPassword.

@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 testChangePasswordWithWrongOriginalPassword() {
    PreferencesUserProfilePage preferencesPage = this.customProfilePage.switchToPreferences();
    ChangePasswordPage changePasswordPage = preferencesPage.changePassword();
    changePasswordPage.changePassword("badPassword", PASSWORD_1, PASSWORD_1);
    changePasswordPage.submit();
    Assert.assertEquals("Current password is invalid.", changePasswordPage.getErrorMessage());
}
Also used : ChangePasswordPage(org.xwiki.user.test.po.ChangePasswordPage) PreferencesUserProfilePage(org.xwiki.user.test.po.PreferencesUserProfilePage) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test) AbstractTest(org.xwiki.test.ui.AbstractTest)

Example 4 with ChangePasswordPage

use of org.xwiki.user.test.po.ChangePasswordPage in project xwiki-platform by xwiki.

the class UserProfileTest method testChangePasswordWithoutEnteringPasswords.

@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 testChangePasswordWithoutEnteringPasswords() {
    ChangePasswordPage changePasswordPage = this.customProfilePage.switchToPreferences().changePassword();
    changePasswordPage.submit();
    Assert.assertEquals("Your new password should be at least 6 characters long.", changePasswordPage.getValidationErrorMessage());
}
Also used : ChangePasswordPage(org.xwiki.user.test.po.ChangePasswordPage) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test) AbstractTest(org.xwiki.test.ui.AbstractTest)

Example 5 with ChangePasswordPage

use of org.xwiki.user.test.po.ChangePasswordPage 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());
}
Also used : ChangePasswordPage(org.xwiki.user.test.po.ChangePasswordPage) ViewPage(org.xwiki.test.ui.po.ViewPage) PreferencesUserProfilePage(org.xwiki.user.test.po.PreferencesUserProfilePage) IgnoreBrowsers(org.xwiki.test.ui.browser.IgnoreBrowsers) Test(org.junit.Test) AbstractTest(org.xwiki.test.ui.AbstractTest)

Aggregations

Test (org.junit.Test)5 AbstractTest (org.xwiki.test.ui.AbstractTest)5 IgnoreBrowsers (org.xwiki.test.ui.browser.IgnoreBrowsers)5 ChangePasswordPage (org.xwiki.user.test.po.ChangePasswordPage)5 PreferencesUserProfilePage (org.xwiki.user.test.po.PreferencesUserProfilePage)4 ViewPage (org.xwiki.test.ui.po.ViewPage)1