use of org.mifos.test.acceptance.framework.office.ChooseOfficePage in project head by mifos.
the class UserHelper method createUser.
/**
* Creates a user.
* @param userParameters Parameters for the user that is created.
* @param officeName The name of the office that this user will belong to.
* @return The user details page for the newly created user.
*/
public UserViewDetailsPage createUser(CreateUserParameters userParameters, String officeName) {
ChooseOfficePage chooseOfficePage = navigationHelper.navigateToCreateUserPage();
CreateUserEnterDataPage userEnterDataPage = chooseOfficePage.selectOffice(officeName);
CreateUserPreviewDataPage userPreviewDataPage = userEnterDataPage.submitAndGotoCreateUserPreviewDataPage(userParameters);
CreateUserConfirmationPage userConfirmationPage = userPreviewDataPage.submit();
userConfirmationPage.verifyPage();
UserViewDetailsPage userDetailsPage = userConfirmationPage.navigateToUserViewDetailsPage();
userDetailsPage.verifyPage();
if (userParameters.getSecondLastName() == null) {
Assert.assertTrue(userDetailsPage.getFullName().contains(userParameters.getFirstName() + " " + userParameters.getLastName()));
} else if (userParameters.getSecondLastName() != null) {
Assert.assertTrue(userDetailsPage.getFullName().contains(userParameters.getFirstName() + " " + userParameters.getSecondLastName() + " " + userParameters.getLastName()));
}
return userDetailsPage;
}
use of org.mifos.test.acceptance.framework.office.ChooseOfficePage 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()));
}
use of org.mifos.test.acceptance.framework.office.ChooseOfficePage in project head by mifos.
the class CustomizeTextTest method verifyCustomizedTextOnVariousPages.
/*
* http://mifosforge.jira.com/browse/MIFOSTEST-1171
* Verify customized text on various Mifos pages
*/
@SuppressWarnings("PMD")
@Test
public void verifyCustomizedTextOnVariousPages() {
TreeMap<String, String> originalCustomText = new TreeMap<String, String>();
originalCustomText.put("Complete the fields below.", "Fill necessary");
originalCustomText.put("Click Cancel to return", "Cancel button is to back");
originalCustomText.put("Product category", "搜索工具");
originalCustomText.put("Date", "عر");
originalCustomText.put("fields", "information");
originalCustomText.put("Targeted Deposits and Withdrawal Restrictions", "deposits and withdrawals");
originalCustomText.put("details", "有");
originalCustomText.put("Create new Center", "Define center");
originalCustomText.put("Create multiple Loan Accounts", "下面的搜索工具");
originalCustomText.put("Approve multiple loans", "أبجدية");
originalCustomText.put("Client", "Person");
originalCustomText.put("Home", "Main");
originalCustomText.put("Clients & Accounts", "òèßñ 有 عربية");
originalCustomText.put("Then click Preview", "After that click on Preview button");
originalCustomText.put("Fields marked with an asterisk are required.", "Mandatory information are necessary");
originalCustomText.put("Date of Birth", "搜索工具");
originalCustomText.put("Name", "عر");
originalCustomText.put("User", "Mifos");
originalCustomText.put("User Title", "Personnel Role");
originalCustomText.put("Login information", "漢字");
originalCustomText.put("description", "info");
originalCustomText.put("recommended Amount for Deposit", "عبية");
originalCustomText.put("create New group", "Define Group");
originalCustomText.put("create Loan Account", "عربة");
originalCustomText.put("reports", "Summaries");
originalCustomText.put("admin", "عربية");
originalCustomText.put("first", "1th");
originalCustomText.put("postal code", "ية عر");
CustomizeTextViewPage customizeTextViewPage = navigationHelper.navigateToAdminPage().navigateToCustomizeTextViewPage();
String value;
for (String key : originalCustomText.keySet()) {
CustomizeTextAddPage customizeTextAddPage = customizeTextViewPage.navigateToCustomizeTextAddPage();
customizeTextAddPage.setOriginalText(key);
value = originalCustomText.get(key);
customizeTextAddPage.setCustomText(value);
customizeTextAddPage.submit();
verifyCustomTextIsAdded(key, value);
}
ClientsAndAccountsHomepage clientsAndAccountsHomepage = navigationHelper.navigateToClientsAndAccountsPage();
verifyClientsAndAccountsCreateCenterLink(originalCustomText.get("Create new Center"), clientsAndAccountsHomepage);
verifyClientsAndAccountsCreateMultipleLoansLink(originalCustomText.get("Create multiple Loan Accounts"), clientsAndAccountsHomepage);
verifyClientsAndAccountsApproveMultipleLoansLink(originalCustomText.get("Approve multiple loans"), clientsAndAccountsHomepage);
verifyClientsAndAccountsCreateClientLink(originalCustomText.get("Client"), clientsAndAccountsHomepage);
verifyClientsAndAccountsCreateNewClientsText(originalCustomText.get("Client"));
verifyClientsAndAccountsCreateGroupLink(originalCustomText.get("create New group"), clientsAndAccountsHomepage);
verifyClientsAndAccountsCreateLoanAccountLink(originalCustomText.get("create Loan Account"), clientsAndAccountsHomepage);
verifyClientsAndAccountsHomeTab(originalCustomText.get("Home"), clientsAndAccountsHomepage);
verifyClientsAndAccountsTab(originalCustomText.get("Clients & Accounts"), clientsAndAccountsHomepage);
verifyClientsAndAccountsAdminTab(originalCustomText.get("admin"), clientsAndAccountsHomepage);
verifyClientsAndAccountsReportsTab(originalCustomText.get("reports"), clientsAndAccountsHomepage);
AdminPage adminPage = navigationHelper.navigateToAdminPage();
adminPage.navigateToDefineSavingsProduct();
verifyDefineNewSavingsProductText(originalCustomText.get("Complete the fields below."));
verifyDefineNewSavingsProductText(originalCustomText.get("Click Cancel to return"));
verifyDefineNewSavingsProductText(originalCustomText.get("Product category"));
verifyDefineNewSavingsProductTextDate(originalCustomText.get("Date"));
verifyDefineNewSavingsProductTextFields(originalCustomText.get("fields"));
verifyDefineNewSavingsProductText(originalCustomText.get("Targeted Deposits and Withdrawal Restrictions"));
verifyDefineNewSavingsProductTextDetails(originalCustomText.get("details"));
verifyDefineNewSavingsProductTextDescription(originalCustomText.get("description"));
verifyDefineNewSavingsProductTextDeposit(originalCustomText.get("recommended Amount for Deposit"));
AdminPage adminPageAgain = navigationHelper.navigateToAdminPage();
ChooseOfficePage chooseOfficePage = adminPageAgain.navigateToCreateUserPage();
chooseOfficePage.selectOffice("branch1");
verifyDefineNewSystemUserText(originalCustomText.get("Then click Preview"));
verifyDefineNewSystemUserText(originalCustomText.get("Fields marked with an asterisk are required."));
verifyDefineNewSystemUserText(originalCustomText.get("Date of Birth"));
verifyDefineNewSystemUserTextName(originalCustomText.get("Name"));
verifyDefineNewSystemUserText(originalCustomText.get("User"));
verifyDefineNewSystemUserText(originalCustomText.get("User Title"));
verifyDefineNewSystemUserText(originalCustomText.get("Login information"));
verifyDefineNewSystemUserTextFirst(originalCustomText.get("first"));
verifyDefineNewSystemUserTextPostal(originalCustomText.get("postal code"));
AdminPage goToAdminPage = navigationHelper.navigateToAdminPage();
goToAdminPage.navigateToCustomizeTextViewPage();
for (Entry<String, String> entry : originalCustomText.entrySet()) {
customizeTextViewPage.removeCustomizedText(entry.getKey());
}
Assert.assertThat(customizeTextViewPage.getCustomizedTextCount(), is(0));
ClientsAndAccountsHomepage clientsAndAccountsPage = navigationHelper.navigateToClientsAndAccountsPage();
verifyClientsAndAccountsCreateCenterLink("Create new Center", clientsAndAccountsPage);
verifyClientsAndAccountsCreateMultipleLoansLink("Create multiple Loan Accounts", clientsAndAccountsPage);
verifyClientsAndAccountsApproveMultipleLoansLink("Approve multiple loans", clientsAndAccountsPage);
verifyClientsAndAccountsCreateClientLink("Client", clientsAndAccountsPage);
verifyClientsAndAccountsCreateNewClientsText("Client");
verifyClientsAndAccountsCreateGroupLink(originalCustomText.get("create New group"), clientsAndAccountsPage);
verifyClientsAndAccountsCreateLoanAccountLink(originalCustomText.get("create Loan Account"), clientsAndAccountsPage);
verifyClientsAndAccountsHomeTab("Home", clientsAndAccountsPage);
verifyClientsAndAccountsTab("Clients & Accounts", clientsAndAccountsPage);
verifyClientsAndAccountsAdminTab(originalCustomText.get("admin"), clientsAndAccountsPage);
verifyClientsAndAccountsReportsTab(originalCustomText.get("reports"), clientsAndAccountsPage);
AdminPage adminHomePage = navigationHelper.navigateToAdminPage();
adminHomePage.navigateToDefineSavingsProduct();
verifyDefineNewSavingsProductText("Complete the fields below.");
verifyDefineNewSavingsProductText("Click Cancel to return");
verifyDefineNewSavingsProductText("Product category");
verifyDefineNewSavingsProductTextDate("Date");
verifyDefineNewSavingsProductTextFieldsRemoved("fields");
verifyDefineNewSavingsProductText("Targeted Deposits and Withdrawal Restrictions");
verifyDefineNewSavingsProductTextDetails("details");
verifyDefineNewSavingsProductTextDescription(originalCustomText.get("description"));
verifyDefineNewSavingsProductTextDeposit(originalCustomText.get("recommended Amount for Deposit"));
AdminPage adminHomePageAgain = navigationHelper.navigateToAdminPage();
adminHomePageAgain.navigateToCreateUserPage();
chooseOfficePage.selectOffice("branch1");
verifyDefineNewSystemUserText("Then click Preview");
verifyDefineNewSystemUserText("Fields marked with an asterisk are required.");
verifyDefineNewSystemUserText("Date of Birth");
verifyDefineNewSystemUserTextNameRemoved("Name");
verifyDefineNewSystemUserText("User");
verifyDefineNewSystemUserText("User Title");
verifyDefineNewSystemUserText("Login information");
verifyDefineNewSystemUserTextFirst(originalCustomText.get("first"));
verifyDefineNewSystemUserTextPostal(originalCustomText.get("postal code"));
}
use of org.mifos.test.acceptance.framework.office.ChooseOfficePage in project head by mifos.
the class NavigationHelper method navigateToCreateUserPage.
public ChooseOfficePage navigateToCreateUserPage() {
AdminPage adminPage = navigateToAdminPage();
ChooseOfficePage createUserPage = adminPage.navigateToCreateUserPage();
createUserPage.verifyPage();
return createUserPage;
}
use of org.mifos.test.acceptance.framework.office.ChooseOfficePage in project head by mifos.
the class PersonnelTest method createUserWithQuestionGroup.
//http://mifosforge.jira.com/browse/MIFOSTEST-670
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void createUserWithQuestionGroup() throws Exception {
//Given
createQuestions();
//When
Map<String, List<String>> sectionQuestions = new HashMap<String, List<String>>();
List<String> questions = new ArrayList<String>();
questions.add("user question 1");
sectionQuestions.put("Sec 1", questions);
questions = new ArrayList<String>();
questions.add("user question 2");
questions.add("user question 3");
sectionQuestions.put("Sec 2", questions);
CreateQuestionGroupParameters createQuestionGroupParameters = new CreateQuestionGroupParameters();
createQuestionGroupParameters.setAnswerEditable(true);
createQuestionGroupParameters.setAppliesTo("Create Personnel");
createQuestionGroupParameters.setTitle("Create Personnel QG1");
createQuestionGroupParameters.setExistingQuestions(sectionQuestions);
questionGroupTestHelper.createQuestionGroup(createQuestionGroupParameters);
sectionQuestions = new HashMap<String, List<String>>();
questions = new ArrayList<String>();
questions.add("user question 4");
sectionQuestions.put("Sec 3", questions);
createQuestionGroupParameters = new CreateQuestionGroupParameters();
createQuestionGroupParameters.setAnswerEditable(true);
createQuestionGroupParameters.setAppliesTo("Create Personnel");
createQuestionGroupParameters.setTitle("Create Personnel QG2");
createQuestionGroupParameters.setExistingQuestions(sectionQuestions);
questionGroupTestHelper.createQuestionGroup(createQuestionGroupParameters);
AdminPage adminPage = navigationHelper.navigateToAdminPage();
CreateUserParameters userParameters = adminPage.getAdminUserParameters();
ChooseOfficePage createUserPage = adminPage.navigateToCreateUserPage();
createUserPage.verifyPage();
CreateUserEnterDataPage userEnterDataPage = createUserPage.selectOffice("MyOfficeDHMFT");
QuestionResponsePage questionResponsePage = userEnterDataPage.submitAndNavigateToQuestionResponsePage(userParameters);
questionResponsePage.verifyPage();
QuestionResponseParameters responseParameters = new QuestionResponseParameters();
responseParameters.addSingleSelectAnswer("questionGroups[0].sectionDetails[0].questions[0].value", "yes");
responseParameters.addTextAnswer("questionGroups[0].sectionDetails[1].questions[1].value", "text1");
questionResponsePage.populateAnswers(responseParameters);
CreateUserPreviewDataPage createUserPreviewDataPage = questionResponsePage.continueAndNavigateToCreateUserPreviewPage();
questionResponsePage = createUserPreviewDataPage.navigateToEditAdditionalInformation();
questionResponsePage.populateTextAnswer("questionGroups[0].sectionDetails[1].questions[1].value", "text2");
createUserPreviewDataPage = questionResponsePage.continueAndNavigateToCreateUserPreviewPage();
CreateUserConfirmationPage userConfirmationPage = createUserPreviewDataPage.submit();
QuestionnairePage questionnairePage = userConfirmationPage.navigateToUserViewDetailsPage().navigateToQuestionnairePage();
//Then
questionnairePage.verifyRadioGroup("details[0].sectionDetails[0].questions[0].value", "yes", true);
questionnairePage.verifyRadioGroup("details[0].sectionDetails[1].questions[0].value", "good", false);
questionnairePage.verifyField("details[0].sectionDetails[1].questions[1].value", "text2");
//When
questionnairePage.typeText("details[0].sectionDetails[1].questions[1].value", "text3");
questionnairePage.submitAndNavigateToPersonnalDetailsPage();
List<String> questionToAdd = new ArrayList<String>();
questionToAdd.add("user question 5");
questionToAdd.add("user question 6");
List<String> questionToDesactivate = new ArrayList<String>();
questionToDesactivate.add("user question 1");
questionToDesactivate.add("user question 2");
questionToDesactivate.add("user question 3");
createQuestionGroupParameters = new CreateQuestionGroupParameters();
for (String question : questionToAdd) {
createQuestionGroupParameters.addExistingQuestion("Sec 1", question);
}
questionGroupTestHelper.addQuestionsToQuestionGroup("Create Personnel QG1", createQuestionGroupParameters.getExistingQuestions());
for (String question : questionToDesactivate) {
questionGroupTestHelper.markQuestionAsInactive(question);
}
questionGroupTestHelper.markQuestionGroupAsInactive("Create Personnel QG2");
adminPage = navigationHelper.navigateToAdminPage();
userParameters = adminPage.getAdminUserParameters();
createUserPage = adminPage.navigateToCreateUserPage();
createUserPage.verifyPage();
userEnterDataPage = createUserPage.selectOffice("MyOfficeDHMFT");
questionResponsePage = userEnterDataPage.submitAndNavigateToQuestionResponsePage(userParameters);
questionResponsePage.verifyPage();
//Then
questionResponsePage.verifyQuestionsDoesnotappear(questionToDesactivate.toArray(new String[questionToDesactivate.size()]));
questionResponsePage.verifyQuestionsExists(questionToAdd.toArray(new String[questionToAdd.size()]));
questionResponsePage.verifySectionDoesnotappear("Sec 2");
questionGroupTestHelper.markQuestionGroupAsInactive("Create Personnel QG1");
}
Aggregations