use of org.mifos.test.acceptance.framework.login.ChangePasswordPage in project head by mifos.
the class PersonnelTest method changePasswordTest.
//http://mifosforge.jira.com/browse/MIFOSTEST-296
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void changePasswordTest() throws Exception {
HomePage homePage = loginSuccessfully();
AdminPage adminPage = homePage.navigateToAdminPage();
CreateUserParameters userParameters = adminPage.getAdminUserParameters();
ChooseOfficePage createUserPage = adminPage.navigateToCreateUserPage();
createUserPage.verifyPage();
CreateUserEnterDataPage userEnterDataPage = createUserPage.selectOffice("MyOfficeDHMFT");
CreateUserPreviewDataPage userPreviewDataPage = userEnterDataPage.submitAndGotoCreateUserPreviewDataPage(userParameters);
CreateUserConfirmationPage userConfirmationPage = userPreviewDataPage.submit();
//Then
userConfirmationPage.verifyPage();
UserViewDetailsPage userDetailsPage = userConfirmationPage.navigateToUserViewDetailsPage();
userDetailsPage.verifyPage();
Assert.assertTrue(userDetailsPage.getFullName().contains(userParameters.getFirstName() + " " + userParameters.getLastName()));
//When
EditUserDataPage editUserPage = userDetailsPage.navigateToEditUserDataPage();
CreateUserParameters passwordParameters = new CreateUserParameters();
passwordParameters.setPassword("tester1");
passwordParameters.setPasswordRepeat("tester");
//Then
editUserPage = editUserPage.submitWithInvalidData(passwordParameters);
editUserPage.verifyPasswordChangeError();
//When
passwordParameters.setPasswordRepeat("tester1");
//Then
EditUserPreviewDataPage editPreviewDataPage = editUserPage.submitAndGotoEditUserPreviewDataPage(passwordParameters);
UserViewDetailsPage submitUserpage = editPreviewDataPage.submit();
submitUserpage.verifyPage();
//When
LoginPage loginPage = (new MifosPage(selenium)).logout();
// tester1
ChangePasswordPage changePasswordPage = loginPage.loginAndGoToChangePasswordPageAs(userParameters.getUserName(), passwordParameters.getPassword());
ChangePasswordPage.SubmitFormParameters changePasswordParameters = new ChangePasswordPage.SubmitFormParameters();
// wrong old password
changePasswordParameters.setOldPassword("tester");
// empty new password
changePasswordParameters.setNewPassword("");
changePasswordParameters.setConfirmPassword("");
//Then
changePasswordPage = changePasswordPage.submitWithInvalidData(changePasswordParameters);
//When
//wrong old password with good new
changePasswordParameters.setNewPassword("tester2");
changePasswordParameters.setConfirmPassword("tester2");
//Then
changePasswordPage = changePasswordPage.submitWithInvalidData(changePasswordParameters);
//When
// good old password and good new
changePasswordParameters.setOldPassword("tester1");
changePasswordParameters.setNewPassword("tester2");
changePasswordParameters.setConfirmPassword("tester2");
//Then
HomePage homePage2 = changePasswordPage.submitAndGotoHomePage(changePasswordParameters);
Assert.assertTrue(homePage2.getWelcome().contains(userParameters.getFirstName()));
loginPage = (new MifosPage(selenium)).logout();
homePage = loginPage.loginSuccessfulAs(userParameters.getUserName(), "tester2");
changePasswordPage = homePage.navigateToYourSettingsPage().navigateToChangePasswordPage();
changePasswordPage = changePasswordPage.submitWithInvalidData(changePasswordParameters);
//When
//wrong old password with good new
changePasswordParameters.setNewPassword("tester2");
changePasswordParameters.setConfirmPassword("tester2");
//Then
changePasswordPage = changePasswordPage.submitWithInvalidData(changePasswordParameters);
//When
// good old password and good new
changePasswordParameters.setOldPassword("tester2");
changePasswordParameters.setNewPassword("tester3");
changePasswordParameters.setConfirmPassword("tester3");
changePasswordPage.submitAndGotoHomePage(changePasswordParameters);
loginPage = (new MifosPage(selenium)).logout();
homePage = loginPage.loginSuccessfulAs(userParameters.getUserName(), changePasswordParameters.getNewPassword());
Assert.assertTrue(homePage.getWelcome().contains(userParameters.getFirstName()));
}
Aggregations