Search in sources :

Example 11 with CreateQuestionGroupParameters

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();
}
Also used : CreateQuestionParameters(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionParameters) EditQuestionGroupPage(org.mifos.test.acceptance.framework.questionnaire.EditQuestionGroupPage) CreateQuestionGroupParameters(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters)

Example 12 with CreateQuestionGroupParameters

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;
}
Also used : CreateQuestionGroupParameters(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters)

Example 13 with CreateQuestionGroupParameters

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);
}
Also used : CreateCenterEnterDataPage(org.mifos.test.acceptance.framework.center.CreateCenterEnterDataPage) ViewQuestionResponseDetailPage(org.mifos.test.acceptance.framework.questionnaire.ViewQuestionResponseDetailPage) CreateQuestionGroupParameters(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters) QuestionResponsePage(org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage) QuestionnairePage(org.mifos.test.acceptance.framework.questionnaire.QuestionnairePage) ArrayList(java.util.ArrayList) QuestionResponseParameters(org.mifos.test.acceptance.framework.loan.QuestionResponseParameters) CreateQuestionParameters(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionParameters) CenterViewDetailsPage(org.mifos.test.acceptance.framework.center.CenterViewDetailsPage) Test(org.testng.annotations.Test)

Example 14 with CreateQuestionGroupParameters

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);
}
Also used : AdminPage(org.mifos.test.acceptance.framework.admin.AdminPage) Random(java.util.Random) CreateQuestionGroupParameters(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters) CreateQuestionPage(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionPage) CreateQuestionGroupPage(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupPage)

Example 15 with CreateQuestionGroupParameters

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");
}
Also used : QuestionGroupTestHelper(org.mifos.test.acceptance.framework.testhelpers.QuestionGroupTestHelper) ViewQuestionResponseDetailPage(org.mifos.test.acceptance.framework.questionnaire.ViewQuestionResponseDetailPage) CreateGroupSubmitParameters(org.mifos.test.acceptance.framework.group.CreateGroupEntryPage.CreateGroupSubmitParameters) CreateQuestionGroupParameters(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters) QuestionResponsePage(org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage) GroupViewDetailsPage(org.mifos.test.acceptance.framework.group.GroupViewDetailsPage) QuestionnairePage(org.mifos.test.acceptance.framework.questionnaire.QuestionnairePage) ArrayList(java.util.ArrayList) QuestionResponseParameters(org.mifos.test.acceptance.framework.loan.QuestionResponseParameters) CreateQuestionParameters(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionParameters) Test(org.testng.annotations.Test)

Aggregations

CreateQuestionGroupParameters (org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters)22 ArrayList (java.util.ArrayList)9 Test (org.testng.annotations.Test)8 AdminPage (org.mifos.test.acceptance.framework.admin.AdminPage)7 HashMap (java.util.HashMap)6 List (java.util.List)6 CreateQuestionGroupPage (org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupPage)6 QuestionResponsePage (org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage)5 QuestionResponseParameters (org.mifos.test.acceptance.framework.loan.QuestionResponseParameters)4 CreateQuestionPage (org.mifos.test.acceptance.framework.questionnaire.CreateQuestionPage)4 CreateQuestionParameters (org.mifos.test.acceptance.framework.questionnaire.CreateQuestionParameters)4 AttachQuestionGroupParameters (org.mifos.test.acceptance.framework.questionnaire.AttachQuestionGroupParameters)3 QuestionnairePage (org.mifos.test.acceptance.framework.questionnaire.QuestionnairePage)3 ViewQuestionResponseDetailPage (org.mifos.test.acceptance.framework.questionnaire.ViewQuestionResponseDetailPage)3 Arrays.asList (java.util.Arrays.asList)1 Random (java.util.Random)1 ManageRolePage (org.mifos.test.acceptance.framework.admin.ManageRolePage)1 ViewRolesPage (org.mifos.test.acceptance.framework.admin.ViewRolesPage)1 CenterViewDetailsPage (org.mifos.test.acceptance.framework.center.CenterViewDetailsPage)1 CreateCenterEnterDataPage (org.mifos.test.acceptance.framework.center.CreateCenterEnterDataPage)1