use of org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters in project head by mifos.
the class ClientTest method createQuestionGroup2.
private void createQuestionGroup2() {
String qG_1 = "CloseClientQG";
String qG_2 = "CloseClientQG2";
AdminPage adminPage = navigationHelper.navigateToAdminPage();
CreateQuestionGroupPage createQuestionGroupPage = adminPage.navigateToCreateQuestionGroupPage();
CreateQuestionGroupParameters parameters;
parameters = questionGroupTestHelper.getCreateQuestionGroupParameters(qG_1, asList(question1, question2, question3, question4, question5), "Close Client", "Section1");
parameters.addExistingQuestion("Section2", question7);
parameters.addExistingQuestion("Section2", question6);
parameters.addExistingQuestion("Section2", question9);
parameters.addExistingQuestion("Section2", question8);
for (String section : parameters.getExistingQuestions().keySet()) {
createQuestionGroupPage.addExistingQuestion(section, parameters.getExistingQuestions().get(section));
}
createQuestionGroupPage.markEveryOtherQuestionsMandatory(asList(question1));
createQuestionGroupPage.submit(parameters);
adminPage = navigationHelper.navigateToAdminPage();
createQuestionGroupPage = adminPage.navigateToCreateQuestionGroupPage();
parameters = questionGroupTestHelper.getCreateQuestionGroupParameters(qG_2, asList(question1, question6, question3, question5), "Close Client", "Section1");
parameters.addExistingQuestion("Section2", question9);
parameters.addExistingQuestion("Section2", question10);
parameters.addExistingQuestion("Section2", question8);
parameters.addExistingQuestion("Section2", question11);
for (String section : parameters.getExistingQuestions().keySet()) {
createQuestionGroupPage.addExistingQuestion(section, parameters.getExistingQuestions().get(section));
}
createQuestionGroupPage.submit(parameters);
}
use of org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters in project head by mifos.
the class ClientTest method createClientWithQuestionGroups.
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
// http://mifosforge.jira.com/browse/MIFOSTEST-681
@Test(enabled = true)
public void createClientWithQuestionGroups() throws Exception {
createQuestions();
CreateQuestionGroupParameters qg = questionGroupTestHelper.getCreateQuestionGroupParameters("CreateClientQG", asList("q1", "q2", "q3"), "Create Client", "Sec 1");
questionGroupTestHelper.createQuestionGroup(qg);
CreateQuestionGroupParameters qg2 = questionGroupTestHelper.getCreateQuestionGroupParameters("CreateClientQG2", asList("q6"), "Create Client", "Sec 2");
questionGroupTestHelper.createQuestionGroup(qg2);
CreateClientEnterPersonalDataPage.SubmitFormParameters formParameters = createFormParameters();
QuestionResponseParameters responseParams = new QuestionResponseParameters();
responseParams.addSingleSelectAnswer("questionGroups[0].sectionDetails[0].questions[0].value", "yes");
responseParams.addSingleSelectAnswer("questionGroups[0].sectionDetails[0].questions[1].value", "good");
responseParams.addTextAnswer("questionGroups[0].sectionDetails[0].questions[2].value", "qwer");
// When
clientTestHelper.createClientWithQuestionGroups(formParameters, "group1", responseParams);
List<String> questionToAdd = new ArrayList<String>();
questionToAdd.add("q4");
questionToAdd.add("q5");
List<String> questionToDeactivate = new ArrayList<String>();
questionToDeactivate.add("q6");
CreateQuestionGroupParameters createQuestionGroupParameters = new CreateQuestionGroupParameters();
for (String question : questionToAdd) {
createQuestionGroupParameters.addExistingQuestion("Sec 1", question);
}
questionGroupTestHelper.addQuestionsToQuestionGroup("CreateClientQG", createQuestionGroupParameters.getExistingQuestions());
for (String question : questionToDeactivate) {
questionGroupTestHelper.markQuestionAsInactive(question);
}
questionGroupTestHelper.markQuestionGroupAsInactive("CreateClientQG2");
QuestionResponsePage questionResponsePage = clientTestHelper.navigateToQuestionResponsePage(formParameters, "group1");
// Then
questionResponsePage.verifyQuestionsDoesnotappear(questionToDeactivate.toArray(new String[questionToDeactivate.size()]));
questionResponsePage.verifyQuestionsExists(questionToAdd.toArray(new String[questionToAdd.size()]));
questionResponsePage.verifySectionDoesnotappear("Sec 2");
questionGroupTestHelper.markQuestionGroupAsInactive("CreateClientQG");
}
use of org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters in project head by mifos.
the class QuestionGroupTest method verifyAttachingQuestionGroupToGroup.
@Test(enabled = true)
//http://mifosforge.jira.com/browse/MIFOSTEST-660
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void verifyAttachingQuestionGroupToGroup() throws Exception {
Map<String, List<String>> sectionQuestions = new HashMap<String, List<String>>();
List<String> questions = new ArrayList<String>();
String title = "TestQuestionGroup" + StringUtil.getRandomString(6);
questions.add("Date");
questions.add("question 3");
questions.add("question 4");
sectionQuestions.put("Sec 1", questions);
questions = new ArrayList<String>();
questions.add("DateQuestion");
questions.add("Number");
questions.add("question 1");
questions.add("Text");
sectionQuestions.put("Sec 2", questions);
CreateQuestionGroupParameters createQuestionGroupParameters = new CreateQuestionGroupParameters();
createQuestionGroupParameters.setAnswerEditable(true);
createQuestionGroupParameters.setAppliesTo("View Group");
createQuestionGroupParameters.setTitle(title);
createQuestionGroupParameters.setExistingQuestions(sectionQuestions);
AttachQuestionGroupParameters attachParams = new AttachQuestionGroupParameters();
attachParams.setTarget("Default Group");
attachParams.setQuestionGroupName(createQuestionGroupParameters.getTitle());
attachParams.addTextResponse("Date", "09/02/2011");
attachParams.addCheckResponse("question 4", "yes");
attachParams.addTextResponse("DateQuestion", "19/02/2011");
attachParams.addTextResponse("question 3", "25/02/2011");
attachParams.addTextResponse("Number", "60");
attachParams.addTextResponse("question 1", "tekst tekst");
attachParams.addTextResponse("Text", "ale alo olu");
AttachQuestionGroupParameters attachErrorParams = new AttachQuestionGroupParameters();
attachErrorParams.setTarget("Default Group");
attachErrorParams.setQuestionGroupName(createQuestionGroupParameters.getTitle());
attachErrorParams.addTextResponse("Number", "sdfsdf");
attachErrorParams.addTextResponse("question 3", "25/02/2011");
attachErrorParams.addCheckResponse("question 4", "yes");
attachErrorParams.addError("Please specify a number for Number.");
//When
questionGroupTestHelper.createQuestionGroup(createQuestionGroupParameters);
questionGroupTestHelper.verifyErrorsWhileAttachingQuestionGroupToGroup(attachErrorParams);
questionGroupTestHelper.attachQuestionGroupToGroup(attachParams);
attachParams.addTextResponse("Number", "20");
attachParams.addTextResponse("question 3", "21/02/2011");
//Then
questionGroupTestHelper.editQuestionGroupResponsesInGroup(attachParams);
questionGroupTestHelper.markQuestionGroupAsInactive(title);
}
use of org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters in project head by mifos.
the class QuestionGroupTest method verifyAttachingQuestionGroupToViewClient.
@Test(enabled = true)
//http://mifosforge.jira.com/browse/MIFOSTEST-680
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void verifyAttachingQuestionGroupToViewClient() throws Exception {
String title = "TestQuestionGroup" + StringUtil.getRandomString(6);
try {
Map<String, List<String>> sectionQuestions = new HashMap<String, List<String>>();
List<String> questions = new ArrayList<String>();
questions.add("Date");
questions.add("question 4");
questions.add("question 3");
sectionQuestions.put("Sec 1", questions);
questions = new ArrayList<String>();
questions.add("Number");
questions.add("DateQuestion");
questions.add("question 1");
questions.add("Text");
sectionQuestions.put("Sec 2", questions);
CreateQuestionGroupParameters createQuestionGroupParameters = new CreateQuestionGroupParameters();
createQuestionGroupParameters.setExistingQuestions(sectionQuestions);
createQuestionGroupParameters.setAnswerEditable(true);
createQuestionGroupParameters.setAppliesTo("View Client");
createQuestionGroupParameters.setTitle(title);
AttachQuestionGroupParameters attachParams = new AttachQuestionGroupParameters();
attachParams.setTarget("0002-000000003");
attachParams.setQuestionGroupName(createQuestionGroupParameters.getTitle());
attachParams.addTextResponse("Number", "60");
attachParams.addTextResponse("question 1", "tekst tekst");
attachParams.addCheckResponse("question 4", "yes");
attachParams.addTextResponse("question 3", "25/02/2011");
attachParams.addTextResponse("Date", "09/02/2011");
attachParams.addTextResponse("DateQuestion", "19/02/2011");
attachParams.addTextResponse("Text", "ale alo olu");
AttachQuestionGroupParameters attachErrorParams = new AttachQuestionGroupParameters();
attachErrorParams.setTarget("0002-000000003");
attachErrorParams.addError("Please specify a number for Number.");
attachErrorParams.setQuestionGroupName(createQuestionGroupParameters.getTitle());
attachErrorParams.addTextResponse("Number", "sdfsdf");
attachErrorParams.addCheckResponse("question 4", "yes");
attachErrorParams.addTextResponse("question 3", "25/02/2011");
//When
questionGroupTestHelper.createQuestionGroup(createQuestionGroupParameters);
questionGroupTestHelper.verifyErrorsWhileAttachingQuestionGroupToClient(attachErrorParams);
questionGroupTestHelper.attachQuestionGroupToClient(attachParams);
attachParams.addTextResponse("Number", "20");
attachParams.addTextResponse("question 3", "21/02/2011");
//Then
questionGroupTestHelper.editQuestionGroupResponsesInClient(attachParams);
} finally {
questionGroupTestHelper.markQuestionGroupAsInactive(title);
}
}
use of org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters in project head by mifos.
the class QuestionGroupTest method verifyAttachingQuestionGroupToLoan.
@Test(enabled = true)
//http://mifosforge.jira.com/browse/MIFOSTEST-662
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void verifyAttachingQuestionGroupToLoan() throws Exception {
String title = "TestQuestionGroup" + StringUtil.getRandomString(6);
try {
Map<String, List<String>> sectionQuestions = new HashMap<String, List<String>>();
List<String> questions = new ArrayList<String>();
questions.add("question 4");
questions.add("question 3");
questions.add("Date");
sectionQuestions.put("Sec 1", questions);
questions = new ArrayList<String>();
questions.add("question 1");
questions.add("Number");
questions.add("DateQuestion");
questions.add("Text");
sectionQuestions.put("Sec 2", questions);
CreateQuestionGroupParameters createQuestionGroupParameters = new CreateQuestionGroupParameters();
createQuestionGroupParameters.setAppliesTo("View Loan");
createQuestionGroupParameters.setAnswerEditable(true);
createQuestionGroupParameters.setTitle(title);
createQuestionGroupParameters.setExistingQuestions(sectionQuestions);
AttachQuestionGroupParameters attachParams = new AttachQuestionGroupParameters();
attachParams.setTarget("000100000000012");
attachParams.setQuestionGroupName(createQuestionGroupParameters.getTitle());
attachParams.addCheckResponse("question 4", "yes");
attachParams.addTextResponse("Date", "09/02/2011");
attachParams.addTextResponse("DateQuestion", "19/02/2011");
attachParams.addTextResponse("question 3", "25/02/2011");
attachParams.addTextResponse("question 1", "tekst tekst");
attachParams.addTextResponse("Text", "ale alo olu");
attachParams.addTextResponse("Number", "60");
AttachQuestionGroupParameters attachErrorParams = new AttachQuestionGroupParameters();
attachErrorParams.setTarget("000100000000012");
attachErrorParams.setQuestionGroupName(createQuestionGroupParameters.getTitle());
attachErrorParams.addError("Please specify a number for Number.");
attachErrorParams.addTextResponse("Number", "sdfsdf");
attachErrorParams.addTextResponse("question 3", "25/02/2011");
attachErrorParams.addCheckResponse("question 4", "yes");
//When
questionGroupTestHelper.createQuestionGroup(createQuestionGroupParameters);
questionGroupTestHelper.verifyErrorsWhileAttachingQuestionGroupToLoan(attachErrorParams);
questionGroupTestHelper.attachQuestionGroupToLoan(attachParams);
attachParams.addTextResponse("Number", "20");
attachParams.addTextResponse("question 3", "21/02/2011");
//Then
questionGroupTestHelper.editQuestionGroupResponsesInLoan(attachParams);
} finally {
questionGroupTestHelper.markQuestionGroupAsInactive(title);
}
}
Aggregations