use of org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters 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.CreateQuestionGroupParameters in project head by mifos.
the class QuestionGroupHelper method getCreateQuestionGroupParameters.
private CreateQuestionGroupParameters getCreateQuestionGroupParameters(String questionGroupTitle, String question1, String appliesTo) {
CreateQuestionGroupParameters parameters = new CreateQuestionGroupParameters();
parameters.setTitle(questionGroupTitle);
parameters.setAppliesTo(appliesTo);
parameters.setAnswerEditable(true);
parameters.addExistingQuestion("Default Section", question1);
return parameters;
}
use of org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters 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);
}
use of org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters in project head by mifos.
the class ClientTest method createQuestionGroup.
private void createQuestionGroup() {
Random random = new Random();
questionGroupTitle = "QG1" + random.nextInt(100);
question1 = "FT_" + random.nextInt(100);
question2 = "MS_" + random.nextInt(100);
response = "Hello World";
AdminPage adminPage = navigationHelper.navigateToAdminPage();
CreateQuestionPage createQuestionPage = adminPage.navigateToCreateQuestionPage();
createQuestionPage.addQuestion(getCreateQuestionParams(question1, "Free Text", null));
createQuestionPage.addQuestion(getCreateQuestionParams(question2, MULTI_SELECT, asList("Choice1", "Choice2", "Choice3", "Choice4")));
adminPage = createQuestionPage.submitQuestions();
CreateQuestionGroupPage createQuestionGroupPage = adminPage.navigateToCreateQuestionGroupPage();
CreateQuestionGroupParameters parameters;
parameters = questionGroupTestHelper.getCreateQuestionGroupParameters(questionGroupTitle, asList(question1), "View Client", "Section1");
for (String section : parameters.getExistingQuestions().keySet()) {
createQuestionGroupPage.addExistingQuestion(section, parameters.getExistingQuestions().get(section));
}
createQuestionGroupPage.markEveryOtherQuestionsMandatory(asList(question1));
parameters = questionGroupTestHelper.getCreateQuestionGroupParameters(questionGroupTitle, asList(question2), "View Client", "Section2");
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 GroupTest method createGroupWithQuestionGroup.
@Test(singleThreaded = true, groups = { "group", "acceptance", "ui", "no_db_unit" }, enabled = true)
// https://mifosforge.jira.com/browse/MIFOS-5850
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void createGroupWithQuestionGroup() throws Exception {
//Given
CreateQuestionGroupParameters questionGroupParams = new CreateQuestionGroupParameters();
questionGroupParams.setTitle("CreateGroupQG");
questionGroupParams.setAppliesTo("Create Group");
questionGroupParams.setAnswerEditable(true);
questionGroupParams.addExistingQuestion("Sec 1", "Date");
questionGroupParams.addExistingQuestion("Sec 1", "ToBeDisabled");
questionGroupParams.addExistingQuestion("Sec 2", "FreeText");
questionGroupParams.addExistingQuestion("Sec 2", "SingleSelect");
questionGroupTestHelper.createQuestionGroup(questionGroupParams);
CreateQuestionGroupParameters questionGroupParams2 = new CreateQuestionGroupParameters();
questionGroupParams2.setTitle("CreateGroupQG2");
questionGroupParams2.setAppliesTo("Create Group");
questionGroupParams2.setAnswerEditable(true);
questionGroupParams2.addExistingQuestion("Sec 1", "DateQuestion");
questionGroupParams2.addExistingQuestion("Sec 1", "Number");
questionGroupParams2.addExistingQuestion("Sec 2", "MultiSelect");
questionGroupParams2.addExistingQuestion("Sec 2", "Text");
questionGroupTestHelper.createQuestionGroup(questionGroupParams2);
CreateGroupSubmitParameters groupParams = new CreateGroupSubmitParameters();
groupParams.setGroupName("GroupTest");
String centerName = "Default Center";
String qG_1 = "CreateGroupQG";
String qG_2 = "CreateGroupQG2";
QuestionResponseParameters responseParams = getQuestionResponseParametersForGroupCreation("answer1");
QuestionResponseParameters responseParams2 = getQuestionResponseParametersForGroupCreation("answer2");
List<CreateQuestionParameters> questionsList = new ArrayList<CreateQuestionParameters>();
questionsList.add(newFreeTextQuestionParameters("new question 1"));
questionsList.add(newFreeTextQuestionParameters("new question 2"));
questionsList.add(newFreeTextQuestionParameters("new question 3"));
String[] newActiveQuestions = { "new question 1", "new question 2" };
String[] deactivateArray = { "new question 3", "SingleSelect", "ToBeDisabled" };
String[] deactivatedGroupArray = { "MultiSelect", "DateQuestion" };
List<String> deactivateList = Arrays.asList(deactivateArray);
//When / Then
GroupViewDetailsPage groupViewDetailsPage = groupTestHelper.createGroupWithQuestionGroupsEdited(groupParams, centerName, responseParams, responseParams2);
groupViewDetailsPage.navigateToViewAdditionalInformationPage().navigateBack();
QuestionGroupTestHelper questionTestHelper = new QuestionGroupTestHelper(selenium);
questionTestHelper.addNewQuestionsToQuestionGroup(qG_1, questionsList);
questionTestHelper.markQuestionsAsInactive(deactivateList);
questionTestHelper.markQuestionGroupAsInactive(qG_2);
QuestionResponsePage responsePage = groupTestHelper.navigateToQuestionResponsePageWhenCreatingGroup(groupParams, centerName);
responsePage.verifyQuestionsDoesnotappear(deactivateArray);
responsePage.verifyQuestionsDoesnotappear(deactivatedGroupArray);
responsePage.verifyQuestionsExists(newActiveQuestions);
groupViewDetailsPage = navigationHelper.navigateToGroupViewDetailsPage(groupParams.getGroupName());
ViewQuestionResponseDetailPage responseDetailsPage = groupViewDetailsPage.navigateToViewAdditionalInformationPage();
responseDetailsPage.verifyQuestionsDoesnotappear(deactivateArray);
QuestionnairePage questionnairePage = responseDetailsPage.navigateToEditSection("0");
questionnairePage.verifyField("details[0].sectionDetails[0].questions[0].value", "");
questionnairePage.verifyField("details[0].sectionDetails[0].questions[1].value", "");
questionGroupTestHelper.markQuestionGroupAsInactive(qG_1);
questionTestHelper.markQuestionAsActive("SingleSelect");
questionTestHelper.markQuestionAsActive("ToBeDisabled");
}
Aggregations