Search in sources :

Example 11 with QuestionResponseParameters

use of org.mifos.test.acceptance.framework.loan.QuestionResponseParameters in project head by mifos.

the class ClientTest method getQuestionResponseParametersForClientAccountCloseAfterModyfication.

private QuestionResponseParameters getQuestionResponseParametersForClientAccountCloseAfterModyfication(String answer) {
    QuestionResponseParameters responseParams = new QuestionResponseParameters();
    responseParams.addTextAnswer("questionGroups[0].sectionDetails[0].questions[0].value", answer);
    responseParams.addTextAnswer("questionGroups[0].sectionDetails[0].questions[1].value", answer);
    responseParams.addTextAnswer("questionGroups[0].sectionDetails[1].questions[0].value", "24/01/2011");
    responseParams.addTextAnswer("questionGroups[0].sectionDetails[1].questions[1].value", "10");
    responseParams.addTextAnswer("questionGroups[0].sectionDetails[2].questions[0].value", "24/01/2011");
    responseParams.addSingleSelectAnswer("questionGroups[0].sectionDetails[2].questions[1].valuesAsArray", "jan");
    responseParams.addTextAnswer("questionGroups[0].sectionDetails[2].questions[2].value", answer);
    return responseParams;
}
Also used : QuestionResponseParameters(org.mifos.test.acceptance.framework.loan.QuestionResponseParameters)

Example 12 with QuestionResponseParameters

use of org.mifos.test.acceptance.framework.loan.QuestionResponseParameters in project head by mifos.

the class ClientTest method closeClientAccountWithQG.

// http://mifosforge.jira.com/browse/MIFOSTEST-663
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
@Test(enabled = true)
public void closeClientAccountWithQG() throws Exception {
    //Given
    String groupName = "group1";
    CreateClientEnterPersonalDataPage.SubmitFormParameters clientParams = clientParams();
    clientParams.setFirstName("John");
    clientParams.setLastName("Doe4321");
    ClientViewDetailsPage clientPage = clientTestHelper.createNewClient(groupName, clientParams);
    String clientName = clientPage.getGlobalCustNum();
    clientTestHelper.changeCustomerStatus(clientPage, ClientStatus.ACTIVE);
    createQuestions2();
    createQuestionGroup2();
    String qG_1 = "CloseClientQG";
    String qG_2 = "CloseClientQG2";
    QuestionResponseParameters responseParams = getQuestionResponseParametersForClientAccountClose("answer1");
    QuestionResponseParameters responseParams2 = getQuestionResponseParametersForClientAccountClose("answer2");
    QuestionResponseParameters responseParamsAfterModyfication = getQuestionResponseParametersForClientAccountCloseAfterModyfication("answer2");
    List<CreateQuestionParameters> questionsList = new ArrayList<CreateQuestionParameters>();
    questionsList.add(newFreeTextQuestionParameters("663new question 1"));
    questionsList.add(newFreeTextQuestionParameters("663new question 2"));
    questionsList.add(newFreeTextQuestionParameters("663new question 3"));
    String[] newActiveQuestions = { "663new question 1", "663new question 2" };
    String[] deactivateArray = { "663new question 3", question3, question6, question2, question5 };
    String[] deactivatedGroupArray = { question10, question11 };
    List<String> deactivateList = Arrays.asList(deactivateArray);
    Map<String, String> questionsAndAnswers = new HashMap<String, String>();
    questionsAndAnswers.put("663new question 1", "answer2");
    questionsAndAnswers.put("663new question 2", "answer2");
    questionsAndAnswers.put(question1, "24/01/2011");
    questionsAndAnswers.put(question4, "10");
    questionsAndAnswers.put(question7, "24/01/2011");
    questionsAndAnswers.put(question8, "jan");
    questionsAndAnswers.put(question9, "answer2");
    //When / Then
    QuestionResponsePage responsePage = clientTestHelper.navigateToQuestionResponsePageWhenCloseClientAccount(clientName);
    responsePage.populateAnswers(responseParams);
    responsePage.navigateToNextPage();
    responsePage = new CustomerChangeStatusPreviewPage(selenium).navigateToEditAdditionalInformation();
    responsePage.populateAnswers(responseParams2);
    responsePage.navigateToNextPage();
    new CustomerChangeStatusPreviewPage(selenium).cancelAndGotoClientViewDetailsPage();
    QuestionGroupTestHelper questionTestHelper = new QuestionGroupTestHelper(selenium);
    questionTestHelper.addNewQuestionsToQuestionGroup(qG_1, questionsList);
    questionTestHelper.markQuestionsAsInactive(deactivateList);
    questionTestHelper.markQuestionGroupAsInactive(qG_2);
    responsePage = clientTestHelper.navigateToQuestionResponsePageWhenCloseClientAccount(clientName);
    responsePage.verifyQuestionsDoesnotappear(deactivateArray);
    responsePage.verifyQuestionsDoesnotappear(deactivatedGroupArray);
    responsePage.verifyQuestionsExists(newActiveQuestions);
    clientTestHelper.closeClientWithQG(clientName, responseParamsAfterModyfication);
    verifyQuestionResponsesExistInDatabase(clientName, "Close Client", questionsAndAnswers);
    questionTestHelper.markQuestionsAsInactive(asList("663new question 1", "663new question 2", question1, question2, question4, question7, question8, question9, question10, question11));
    questionTestHelper.markQuestionGroupAsInactive(qG_1);
}
Also used : QuestionGroupTestHelper(org.mifos.test.acceptance.framework.testhelpers.QuestionGroupTestHelper) CreateClientEnterPersonalDataPage(org.mifos.test.acceptance.framework.client.CreateClientEnterPersonalDataPage) HashMap(java.util.HashMap) QuestionResponsePage(org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage) ClientViewDetailsPage(org.mifos.test.acceptance.framework.client.ClientViewDetailsPage) ArrayList(java.util.ArrayList) QuestionResponseParameters(org.mifos.test.acceptance.framework.loan.QuestionResponseParameters) CustomerChangeStatusPreviewPage(org.mifos.test.acceptance.framework.customer.CustomerChangeStatusPreviewPage) CreateQuestionParameters(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionParameters) Test(org.testng.annotations.Test)

Example 13 with QuestionResponseParameters

use of org.mifos.test.acceptance.framework.loan.QuestionResponseParameters in project head by mifos.

the class GroupTest method getQuestionResponseParametersForGroupCreation.

private QuestionResponseParameters getQuestionResponseParametersForGroupCreation(String answer) {
    QuestionResponseParameters responseParams = new QuestionResponseParameters();
    responseParams.addTextAnswer("questionGroups[0].sectionDetails[0].questions[0].value", "24/01/2011");
    //responseParams.addSingleSelectAnswer("questionGroups[0].sectionDetails[0].questions[1].valuesAsArray", "first");
    responseParams.addTextAnswer("questionGroups[0].sectionDetails[1].questions[0].value", "text");
    //responseParams.addTextAnswer("questionGroups[0].sectionDetails[1].questions[0].value", "24/01/2011");
    //responseParams.addTextAnswer("questionGroups[0].sectionDetails[1].questions[0].value", "text2");
    //responseParams.addSingleSelectAnswer("questionGroups[0].sectionDetails[1].questions[1].value", "red");
    //responseParams.addSingleSelectAnswer("questionGroups[0].sectionDetails[1].questions[2].valuesAsArray", "february:feb");
    responseParams.addTextAnswer("questionGroups[1].sectionDetails[0].questions[0].value", "24/01/2011");
    //responseParams.addSingleSelectAnswer("questionGroups[1].sectionDetails[0].questions[1].valuesAsArray", "first");
    responseParams.addTextAnswer("questionGroups[1].sectionDetails[0].questions[1].value", "10");
    responseParams.addSingleSelectAnswer("questionGroups[1].sectionDetails[1].questions[0].valuesAsArray", "one");
    responseParams.addSingleSelectAnswer("questionGroups[1].sectionDetails[1].questions[0].valuesAsArray", "four");
    responseParams.addTextAnswer("questionGroups[1].sectionDetails[1].questions[1].value", "text3");
    return responseParams;
}
Also used : QuestionResponseParameters(org.mifos.test.acceptance.framework.loan.QuestionResponseParameters)

Example 14 with QuestionResponseParameters

use of org.mifos.test.acceptance.framework.loan.QuestionResponseParameters 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)

Example 15 with QuestionResponseParameters

use of org.mifos.test.acceptance.framework.loan.QuestionResponseParameters 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");
}
Also used : AdminPage(org.mifos.test.acceptance.framework.admin.AdminPage) CreateQuestionGroupParameters(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters) HashMap(java.util.HashMap) QuestionResponsePage(org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage) CreateUserEnterDataPage(org.mifos.test.acceptance.framework.user.CreateUserEnterDataPage) QuestionnairePage(org.mifos.test.acceptance.framework.questionnaire.QuestionnairePage) ArrayList(java.util.ArrayList) CreateUserConfirmationPage(org.mifos.test.acceptance.framework.user.CreateUserConfirmationPage) ChooseOfficePage(org.mifos.test.acceptance.framework.office.ChooseOfficePage) QuestionResponseParameters(org.mifos.test.acceptance.framework.loan.QuestionResponseParameters) CreateUserPreviewDataPage(org.mifos.test.acceptance.framework.user.CreateUserPreviewDataPage) CreateUserParameters(org.mifos.test.acceptance.framework.user.CreateUserParameters) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

QuestionResponseParameters (org.mifos.test.acceptance.framework.loan.QuestionResponseParameters)21 ArrayList (java.util.ArrayList)10 QuestionResponsePage (org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage)10 Test (org.testng.annotations.Test)10 HashMap (java.util.HashMap)8 CreateQuestionParameters (org.mifos.test.acceptance.framework.questionnaire.CreateQuestionParameters)7 CreateLoanAccountSearchParameters (org.mifos.test.acceptance.framework.loan.CreateLoanAccountSearchParameters)5 LoanAccountPage (org.mifos.test.acceptance.framework.loan.LoanAccountPage)5 ViewQuestionResponseDetailPage (org.mifos.test.acceptance.framework.questionnaire.ViewQuestionResponseDetailPage)5 CreateQuestionGroupParameters (org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters)4 QuestionnairePage (org.mifos.test.acceptance.framework.questionnaire.QuestionnairePage)4 DateTime (org.joda.time.DateTime)3 EditAccountStatusParameters (org.mifos.test.acceptance.framework.account.EditAccountStatusParameters)3 CreateClientEnterPersonalDataPage (org.mifos.test.acceptance.framework.client.CreateClientEnterPersonalDataPage)3 QuestionGroupTestHelper (org.mifos.test.acceptance.framework.testhelpers.QuestionGroupTestHelper)3 DateTimeUpdaterRemoteTestingService (org.mifos.test.acceptance.remote.DateTimeUpdaterRemoteTestingService)3 CreateLoanAccountSubmitParameters (org.mifos.test.acceptance.framework.loan.CreateLoanAccountSubmitParameters)2 DisburseLoanParameters (org.mifos.test.acceptance.framework.loan.DisburseLoanParameters)2 CreateSavingsAccountSearchParameters (org.mifos.test.acceptance.framework.savings.CreateSavingsAccountSearchParameters)2 CreateSavingsAccountSubmitParameters (org.mifos.test.acceptance.framework.savings.CreateSavingsAccountSubmitParameters)2