use of org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters 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");
}
use of org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters in project head by mifos.
the class QuestionGroupSavingsAccountTest method setQuestionGroup.
private void setQuestionGroup() {
String questionGroupName = "QGForCreateSavingsAccount";
questionGroupTestHelper.markQuestionGroupAsActive(questionGroupName);
CreateQuestionGroupParameters createQuestionGroupParameters = questionGroupTestHelper.getCreateQuestionGroupParameters(questionGroupName + "2", asList("Number", "SingleSelect", "FreeText", "question 1"), "Create Savings", "Sec 1");
createQuestionGroupParameters.addExistingQuestion("Sec 2", "NumberBetween5And10");
createQuestionGroupParameters.addExistingQuestion("Sec 2", "MultiSelect");
questionGroupTestHelper.createQuestionGroup(createQuestionGroupParameters);
Map<String, List<String>> sectionQuestions = new HashMap<String, List<String>>();
List<String> questions = new ArrayList<String>();
questions.add("Date");
questions.add("MultiSelect");
questions.add("Number");
questions.add("NumberBetween5And10");
sectionQuestions.put("Sec 1", questions);
questions = new ArrayList<String>();
questions.add("SingleSelect");
questions.add("FreeText");
sectionQuestions.put("Sec 2", questions);
questionGroupTestHelper.addQuestionsToQuestionGroup(questionGroupName, sectionQuestions);
}
use of org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters in project head by mifos.
the class QuestionGroupTest method testCreateQuestionGroup.
private void testCreateQuestionGroup(CreateQuestionGroupPage createQuestionGroupPage, String title, String appliesTo, boolean isAnswerEditable, String sectionName, List<String> questionsToSelect, List<String> questionsNotToSelect, String questionToAdd) {
CreateQuestionGroupParameters parameters = new CreateQuestionGroupParameters();
parameters.setTitle(title);
parameters.setAppliesTo(appliesTo);
parameters.setAnswerEditable(isAnswerEditable);
for (String question : questionsToSelect) {
parameters.addExistingQuestion(sectionName, question);
}
for (String section : parameters.getExistingQuestions().keySet()) {
createQuestionGroupPage.addExistingQuestion(section, parameters.getExistingQuestions().get(section));
}
createQuestionGroupPage.markEveryOtherQuestionsMandatory(questionsToSelect);
assertTrue(createQuestionGroupPage.getAvailableQuestions().containsAll(questionsNotToSelect));
CreateQuestionParameters createQuestionParameters = new CreateQuestionParameters();
createQuestionParameters.setType("Free Text");
createQuestionParameters.setText(questionToAdd);
createQuestionGroupPage.setSection(SECTION_MISC);
if (questionToAdd != null) {
createQuestionGroupPage.addNewQuestion(createQuestionParameters);
}
createQuestionGroupPage.submit(parameters);
assertPage(AdminPage.PAGE_ID);
}
use of org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters in project head by mifos.
the class QuestionGroupTest method testMissingMandatoryInputs.
private void testMissingMandatoryInputs(CreateQuestionGroupPage createQuestionGroupPage) {
CreateQuestionGroupParameters parameters = new CreateQuestionGroupParameters();
createQuestionGroupPage.submit(parameters);
assertTextFoundOnPage(TITLE_MISSING);
assertTextFoundOnPage(APPLIES_TO_MISSING);
assertTextFoundOnPage(SECTION_MISSING);
createQuestionGroupPage.addEmptySection("Empty Section");
for (String section : parameters.getExistingQuestions().keySet()) {
createQuestionGroupPage.addExistingQuestion(section, parameters.getExistingQuestions().get(section));
}
assertTextFoundOnPage(QUESTION_MISSING);
}
use of org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters in project head by mifos.
the class QuestionGroupTest method attachingQuestionGroupToMultipleFlowsTest.
/**
* Attaching a Question Group to Multiple flows
* http://mifosforge.jira.com/browse/MIFOSTEST-701
*
* @throws Exception
*/
@Test(enabled = true)
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void attachingQuestionGroupToMultipleFlowsTest() throws Exception {
String newClient = "Joe701 Doe701";
questionGroupTestHelper.markQuestionGroupAsInactive("CreateOffice");
createClient("Joe701", "Doe701");
//When
testValidationAddQuestionGroup();
Map<String, List<String>> sectionQuestions = new HashMap<String, List<String>>();
List<String> questions = new ArrayList<String>();
questions.add("Date");
questions.add("Number");
questions.add("Text");
sectionQuestions.put("Sec Test", questions);
CreateQuestionGroupParameters createQuestionGroupParameters = new CreateQuestionGroupParameters();
createQuestionGroupParameters.setAnswerEditable(true);
String testQuestionGroup = "TestQuestionGroup";
createQuestionGroupParameters.setTitle(testQuestionGroup);
createQuestionGroupParameters.setAppliesTo("View Client");
createQuestionGroupParameters.setAppliesTo("Close Client");
createQuestionGroupParameters.setExistingQuestions(sectionQuestions);
try {
questionGroupTestHelper.createQuestionGroup(createQuestionGroupParameters);
Map<String, String> answers = new HashMap<String, String>();
answers.put("Text", "Test - Text");
answers.put("Number", "2");
answers.put("Date", "11/11/2009");
ClientViewDetailsPage clientViewDetailsPage = questionGroupTestHelper.attachQuestionGroup(newClient, testQuestionGroup, asList("Sec Test"), answers);
CustomerChangeStatusPage customerChangeStatusPage = clientViewDetailsPage.navigateToCustomerChangeStatusPage();
EditCustomerStatusParameters customerStatusParameters = new EditCustomerStatusParameters();
customerStatusParameters.setNote("TEST");
customerStatusParameters.setClientStatus(ClientStatus.CLOSED);
customerStatusParameters.setClientCloseReason(ClientCloseReason.TRANSFERRED);
QuestionResponsePage questionResponsePage = customerChangeStatusPage.changeStatusAndNavigateToQuestionResponsePage(customerStatusParameters);
//Then
questionResponsePage.verifyQuestionsExists(questions.toArray(new String[questions.size()]));
//When
clientViewDetailsPage = questionResponsePage.cancel();
ViewQuestionResponseDetailPage viewQuestionResponseDetailPage = clientViewDetailsPage.navigateToViewAdditionalInformationPage();
//Then
viewQuestionResponseDetailPage.verifyQuestionsDoesnotappear(questions.toArray(new String[questions.size()]));
clientViewDetailsPage = viewQuestionResponseDetailPage.navigateToClientViewDetailsPage();
answers = new HashMap<String, String>();
answers.put("Text", "Test - Text - Edit");
answers.put("Number", "22");
questionGroupInstancesOfClient = clientViewDetailsPage.getQuestionGroupInstances();
questionGroupTestHelper.editResponses(clientViewDetailsPage, latestInstanceId(questionGroupInstancesOfClient), answers);
// extension MIFOS-5821
CreateLoanAccountSearchParameters searchParameters = new CreateLoanAccountSearchParameters();
searchParameters.setSearchString("Client - Mary Monthly");
searchParameters.setLoanProduct("MonthlyClientFlatLoanThirdFridayOfMonth");
loanTestHelper.createDefaultLoanAccount(searchParameters);
} finally {
questionGroupTestHelper.markQuestionGroupAsInactive(testQuestionGroup);
questionGroupTestHelper.markQuestionGroupAsInactive("CreateOffice");
}
}
Aggregations