use of org.mifos.test.acceptance.framework.questionnaire.CreateQuestionParameters in project head by mifos.
the class QuestionGroupSavingsAccountTest method verifyCapturingResponsesDuringSavingsCreation.
//http://mifosforge.jira.com/browse/MIFOSTEST-669
/*
* need to fix up commonality between questionaire pages for loan and savings.
*/
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
//TODO http://mifosforge.jira.com/browse/MIFOS-5081
@Test(enabled = false)
public void verifyCapturingResponsesDuringSavingsCreation() throws Exception {
DateTimeUpdaterRemoteTestingService dateTimeUpdaterRemoteTestingService = new DateTimeUpdaterRemoteTestingService(selenium);
DateTime targetTime = new DateTime(2011, 2, 28, 15, 0, 0, 0);
dateTimeUpdaterRemoteTestingService.setDateTime(targetTime);
setQuestionGroup();
createClient("669");
CreateSavingsAccountSearchParameters searchParameters = new CreateSavingsAccountSearchParameters();
searchParameters.setSearchString("Joe669 Doe669");
searchParameters.setSavingsProduct("MonthlyClientSavingsAccount");
CreateSavingsAccountSubmitParameters submitAccountParameters = new CreateSavingsAccountSubmitParameters();
submitAccountParameters.setAmount("248.0");
QuestionResponseParameters questionResponseParameters = new QuestionResponseParameters();
questionResponseParameters.addTextAnswer("questionGroups[1].sectionDetails[0].questions[0].value", "textquestion");
questionResponseParameters.addTextAnswer("questionGroups[1].sectionDetails[0].questions[1].value", "100");
questionResponseParameters.addTextAnswer("questionGroups[1].sectionDetails[0].questions[2].value", "Text");
questionResponseParameters.addSingleSelectAnswer("questionGroups[1].sectionDetails[0].questions[3].value", "blue");
questionResponseParameters.addSingleSelectAnswer("questionGroups[1].sectionDetails[1].questions[0].values", "two");
questionResponseParameters.addTextAnswer("questionGroups[1].sectionDetails[1].questions[1].value", "6");
questionResponseParameters.addTextAnswer("questionGroups[0].sectionDetails[0].questions[0].value", "04/02/2011");
questionResponseParameters.addSingleSelectAnswer("questionGroups[0].sectionDetails[0].questions[1].values", "one");
questionResponseParameters.addTextAnswer("questionGroups[0].sectionDetails[0].questions[2].value", "123");
questionResponseParameters.addTextAnswer("questionGroups[0].sectionDetails[0].questions[3].value", "7");
questionResponseParameters.addTextAnswer("questionGroups[0].sectionDetails[1].questions[0].value", "Text");
questionResponseParameters.addSingleSelectAnswer("questionGroups[0].sectionDetails[1].questions[1].value", "red");
questionResponseParameters.addTextAnswer("questionGroups[0].sectionDetails[2].questions[0].value", "Text");
QuestionResponseParameters questionResponseParameters2 = new QuestionResponseParameters();
questionResponseParameters2.addTextAnswer("questionGroups[1].sectionDetails[0].questions[0].value", "textQuestion");
questionResponseParameters2.addTextAnswer("questionGroups[0].sectionDetails[0].questions[3].value", "9");
savingsAccountHelper.fillQuestionGroupsDurringCreationSavingsAccount(searchParameters, submitAccountParameters, questionResponseParameters);
SavingsAccountDetailPage savingsAccountDetailPage = savingsAccountHelper.editAdditionalInformationDurringCreationSavingsAccount(questionResponseParameters2);
String savingsId = savingsAccountDetailPage.getAccountId();
questionGroupTestHelper.markQuestionGroupAsInactive("QGForCreateSavingsAccount");
questionGroupTestHelper.markQuestionAsInactive("SingleSelect");
questionGroupTestHelper.markQuestionAsInactive("NumberBetween5And10");
questionGroupTestHelper.markQuestionAsInactive("Question1");
questionGroupTestHelper.markQuestionAsInactive("question 1");
CreateQuestionParameters createQuestionParameters = new CreateQuestionParameters();
createQuestionParameters.setType(CreateQuestionParameters.TYPE_FREE_TEXT);
createQuestionParameters.setText("newQuestion232");
List<CreateQuestionParameters> newQuestionList = new ArrayList<CreateQuestionParameters>();
newQuestionList.add(createQuestionParameters);
questionGroupTestHelper.addNewQuestionsToQuestionGroup("QGForCreateSavingsAccount2", newQuestionList);
Map<String, String> questionsAndAnswers = new HashMap<String, String>();
questionsAndAnswers.put("MultiSelect", "two");
questionsAndAnswers.put("Number", "100");
questionsAndAnswers.put("FreeText", "textquestion");
String[] questionsExist = { "newQuestion232", "MultiSelect", "Number", "FreeText" };
String[] questionsInactive = { "SingleSelect", "NumberBetween5And10", "Question1", "question 1", "Date" };
QuestionnairePage questionnairePage = savingsAccountHelper.navigateToQuestionResponseDuringCreateSavings(searchParameters, submitAccountParameters);
questionnairePage.verifyQuestionsExists(questionsExist);
questionnairePage.verifyQuestionsDoesnotappear(questionsInactive);
verifyQuestionResponsesExistInDatabase(savingsId, "Create Savings", questionsAndAnswers);
questionGroupTestHelper.markQuestionGroupAsInactive("QGForCreateSavingsAccount2");
questionGroupTestHelper.markQuestionAsActive("SingleSelect");
questionGroupTestHelper.markQuestionAsActive("NumberBetween5And10");
questionGroupTestHelper.markQuestionAsActive("Question1");
questionGroupTestHelper.markQuestionAsActive("question 1");
}
use of org.mifos.test.acceptance.framework.questionnaire.CreateQuestionParameters in project head by mifos.
the class PersonnelTest method createQuestions.
private void createQuestions() {
List<CreateQuestionParameters> questions = new ArrayList<CreateQuestionParameters>();
CreateQuestionParameters q1 = new CreateQuestionParameters();
q1.setType(CreateQuestionParameters.TYPE_SINGLE_SELECT);
q1.setText("user question 1");
q1.setChoicesFromStrings(Arrays.asList(new String[] { "yes", "no" }));
questions.add(q1);
CreateQuestionParameters q2 = new CreateQuestionParameters();
q2.setType(CreateQuestionParameters.TYPE_SINGLE_SELECT);
q2.setText("user question 2");
q2.setChoicesFromStrings(Arrays.asList(new String[] { "good", "bad", "average" }));
questions.add(q2);
CreateQuestionParameters q3 = new CreateQuestionParameters();
q3.setType(CreateQuestionParameters.TYPE_FREE_TEXT);
q3.setText("user question 3");
questions.add(q3);
CreateQuestionParameters q4 = new CreateQuestionParameters();
q4.setType(CreateQuestionParameters.TYPE_DATE);
q4.setText("user question 4");
questions.add(q4);
CreateQuestionParameters q5 = new CreateQuestionParameters();
q5.setType(CreateQuestionParameters.TYPE_FREE_TEXT);
q5.setText("user question 5");
questions.add(q5);
CreateQuestionParameters q6 = new CreateQuestionParameters();
q6.setType(CreateQuestionParameters.TYPE_NUMBER);
q6.setText("user question 6");
q6.setNumericMax(10);
q6.setNumericMin(0);
questions.add(q6);
questionGroupTestHelper.createQuestions(questions);
}
use of org.mifos.test.acceptance.framework.questionnaire.CreateQuestionParameters in project head by mifos.
the class QuestionGroupTest method testValidationAddQuestion.
private void testValidationAddQuestion() {
CreateQuestionPage createQuestionPage = questionGroupTestHelper.navigateToCreateQuestionPage();
CreateQuestionParameters createQuestionParameters = new CreateQuestionParameters();
createQuestionParameters.setText("");
createQuestionParameters.setType(CreateQuestionParameters.TYPE_FREE_TEXT);
createQuestionPage.addQuestion(createQuestionParameters);
createQuestionPage.verifyTextPresent("Please specify the question", "No text <Please specify the question> present on the page");
createQuestionPage.verifySubmitButtonStatus("true");
createQuestionPage.cancelQuestion();
createQuestionPage = questionGroupTestHelper.navigateToCreateQuestionPage();
createQuestionPage.setNumberQuestion("NumberQuestion", noNumber, noNumber);
createQuestionPage.verifyNumberQuestion("", "");
createQuestionPage.setNumberQuestion("NumberQuestion", "", "");
for (int i = 0; i < charactersList.size(); i++) {
createQuestionParameters.setText(charactersList.get(i));
createQuestionPage.addQuestion(createQuestionParameters);
createQuestionPage.verifyQuestionPresent(createQuestionParameters, i + 1);
}
}
use of org.mifos.test.acceptance.framework.questionnaire.CreateQuestionParameters in project head by mifos.
the class QuestionGroupTest method testEditQuestionGroupDetail.
private void testEditQuestionGroupDetail(QuestionGroupDetailPage questionGroupDetailPage) {
EditQuestionGroupPage editQuestionGroupPage = questionGroupDetailPage.navigateToEditPage();
editQuestionGroupPage.setTitle(qgTitle3);
CreateQuestionGroupParameters createQuestionGroupParameters = new CreateQuestionGroupParameters();
createQuestionGroupParameters.addExistingQuestion("New Section", qTitle4);
for (String section : createQuestionGroupParameters.getExistingQuestions().keySet()) {
editQuestionGroupPage.addExistingQuestion(section, createQuestionGroupParameters.getExistingQuestions().get(section));
}
CreateQuestionParameters createQuestionParameters = new CreateQuestionParameters();
createQuestionParameters.setType("Free Text");
createQuestionParameters.setText(qTitle5);
editQuestionGroupPage.setSection("Hello World");
editQuestionGroupPage.addNewQuestion(createQuestionParameters);
editQuestionGroupPage.submit();
questionGroupDetailPage.verifyPage();
questionGroupDetailPage.navigateToViewQuestionGroupsPage();
}
use of org.mifos.test.acceptance.framework.questionnaire.CreateQuestionParameters in project head by mifos.
the class CenterTest method createCenterTest.
/**
* Capturing responses during the Center creation http://mifosforge.jira.com/browse/MIFOSTEST-665
*
* @throws Exception
*/
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
@Test(enabled = true)
public void createCenterTest() throws Exception {
String officeName = "MyOfficeDHMFT";
String qG1Name = "CreateCenterQG";
String qG2Name = "CreateCenterQG2";
createQuestions();
CreateQuestionGroupParameters qG1 = questionTestHelper.getCreateQuestionGroupParameters(qG1Name, asList("center question 1", "center question 2", "center question 3"), "Create Center", "Sec 1");
questionTestHelper.createQuestionGroup(qG1);
CreateQuestionGroupParameters qG2 = questionTestHelper.getCreateQuestionGroupParameters(qG2Name, asList("center question 4", "center question 5", "center question 6"), "Create Center", "Sec 2");
questionTestHelper.createQuestionGroup(qG2);
String testCenterName = "Center" + StringUtil.getRandomString(6);
CreateCenterEnterDataPage.SubmitFormParameters centerParams = getCenterParameters(testCenterName, "loan officer");
QuestionResponseParameters responseParams = getQuestionResponseParameters("answer1");
QuestionResponseParameters responseParams2 = getQuestionResponseParameters("answer2");
List<CreateQuestionParameters> questionsList = new ArrayList<CreateQuestionParameters>();
questionsList.add(newFreeTextQuestionParameters("new center question 1"));
questionsList.add(newFreeTextQuestionParameters("new center question 2"));
String[] newActiveQuestions = { "new center question 1", "center question 2" };
String[] deactivateArray = { "center question 3", "center question 4" };
List<String> deactivateList = Arrays.asList(deactivateArray);
CenterViewDetailsPage centerViewDetailsPage = centerTestHelper.createCenterWithQuestionGroupsEdited(centerParams, officeName, responseParams, responseParams2);
centerViewDetailsPage.navigateToViewAdditionalInformation().navigateBack();
questionTestHelper.addNewQuestionsToQuestionGroup(qG1Name, questionsList);
questionTestHelper.markQuestionsAsInactive(deactivateList);
questionTestHelper.markQuestionGroupAsInactive(qG2Name);
QuestionResponsePage responsePage = centerTestHelper.navigateToQuestionResponsePageWhenCreatingCenter(centerParams, officeName);
responsePage.verifyQuestionsDoesnotappear(deactivateArray);
responsePage.verifyQuestionsExists(newActiveQuestions);
centerViewDetailsPage = centerTestHelper.navigateToCenterViewDetailsPage(testCenterName);
centerViewDetailsPage.verifyActiveCenter(centerParams);
ViewQuestionResponseDetailPage responseDetailsPage = centerViewDetailsPage.navigateToViewAdditionalInformation();
responseDetailsPage.verifyQuestionsDoesnotappear(deactivateArray);
responseDetailsPage.verifyEditButtonDisabled("1");
QuestionnairePage questionnairePage = responseDetailsPage.navigateToEditSection("0");
questionnairePage.verifyField("details[0].sectionDetails[0].questions[0].value", "");
questionnairePage.verifyField("details[0].sectionDetails[0].questions[1].value", "");
questionTestHelper.markQuestionGroupAsInactive(qG1Name);
}
Aggregations