Search in sources :

Example 16 with QuestionResponsePage

use of org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage in project head by mifos.

the class QuestionGroupLoanAccountTest method verifyResponsesDuringLoanAccountClosing.

@Test(enabled = true)
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void verifyResponsesDuringLoanAccountClosing() throws Exception {
    questionGroupTestHelper.markQuestionGroupAsActive("QGForCloseLoan");
    try {
        DefineNewLoanProductPage.SubmitFormParameters productParams = FormParametersHelper.getWeeklyLoanProductParameters();
        CreateLoanAccountSearchParameters searchParams = new CreateLoanAccountSearchParameters();
        searchParams.setSearchString("Stu12332659912419 Client12332659912419");
        searchParams.setLoanProduct(productParams.getOfferingName());
        DisburseLoanParameters disburseParams = new DisburseLoanParameters();
        disburseParams.setPaymentType(DisburseLoanParameters.CASH);
        disburseParams.setDisbursalDateDD("24");
        disburseParams.setDisbursalDateMM("02");
        disburseParams.setDisbursalDateYYYY("2011");
        loanProductTestHelper.defineNewLoanProduct(productParams);
        LoanAccountPage loanAccountPage = loanTestHelper.createActivateAndDisburseDefaultLoanAccount(searchParams, disburseParams);
        String loanID1 = loanAccountPage.getAccountId();
        QuestionResponseParameters questionResponseParameters = new QuestionResponseParameters();
        questionResponseParameters.addTextAnswer("questionGroups[0].sectionDetails[0].questions[0].value", "04/02/2011");
        questionResponseParameters.addTextAnswer("questionGroups[0].sectionDetails[0].questions[1].value", "free text");
        String[] questionsExist = { "Date", "FreeText" };
        Map<String, String> questionsAndAnswers = new HashMap<String, String>();
        questionsAndAnswers.put("Date", "04/02/2011");
        questionsAndAnswers.put("FreeText", "free text");
        EditAccountStatusParameters editAccountStatusParameters = new EditAccountStatusParameters();
        editAccountStatusParameters.setAccountStatus(AccountStatus.LOAN_CLOSED_WRITTENOFF);
        editAccountStatusParameters.setNote("note note");
        QuestionResponsePage questionResponsePage = questionGroupTestHelper.navigateToQuestionResponsePageDuringLoanStatusChange(loanID1, editAccountStatusParameters);
        questionResponsePage.verifyQuestionsExists(questionsExist);
        questionResponsePage.populateAnswers(questionResponseParameters);
        questionResponsePage.continueAndNavigateToEditAccountStatusConfirmationPage().submitAndNavigateToLoanAccountPage();
        verifyQuestionResponsesExistInDatabase(loanID1, "Close Loan", questionsAndAnswers);
    } finally {
        questionGroupTestHelper.markQuestionGroupAsInactive("QGForCloseLoan");
    }
}
Also used : DisburseLoanParameters(org.mifos.test.acceptance.framework.loan.DisburseLoanParameters) CreateLoanAccountSearchParameters(org.mifos.test.acceptance.framework.loan.CreateLoanAccountSearchParameters) HashMap(java.util.HashMap) QuestionResponsePage(org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage) DefineNewLoanProductPage(org.mifos.test.acceptance.framework.loanproduct.DefineNewLoanProductPage) LoanAccountPage(org.mifos.test.acceptance.framework.loan.LoanAccountPage) QuestionResponseParameters(org.mifos.test.acceptance.framework.loan.QuestionResponseParameters) EditAccountStatusParameters(org.mifos.test.acceptance.framework.account.EditAccountStatusParameters) Test(org.testng.annotations.Test)

Example 17 with QuestionResponsePage

use of org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage in project head by mifos.

the class QuestionGroupLoanAccountTest method verifyCapturingResponsesDuringLoanDisburse.

/**
     * Capturing responses during the Loan disburse
     * http://mifosforge.jira.com/browse/MIFOSTEST-668
     *
     * @throws Exception
     */
@Test(enabled = true)
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void verifyCapturingResponsesDuringLoanDisburse() throws Exception {
    questionGroupTestHelper.markQuestionGroupAsActive("QGForDisburseLoan1");
    questionGroupTestHelper.markQuestionGroupAsActive("QGForDisburseLoan2");
    try {
        CreateLoanAccountSearchParameters createLoanAccountSearchParameters = new CreateLoanAccountSearchParameters();
        createLoanAccountSearchParameters.setLoanProduct("WeeklyClientFlatLoanWithNoFee");
        createLoanAccountSearchParameters.setSearchString("ClientWithLoan 20110221");
        DisburseLoanParameters disburseLoanParameters = new DisburseLoanParameters();
        disburseLoanParameters.setPaymentType(DisburseLoanParameters.CASH);
        disburseLoanParameters.setDisbursalDateDD("24");
        disburseLoanParameters.setDisbursalDateMM("02");
        disburseLoanParameters.setDisbursalDateYYYY("2011");
        QuestionResponseParameters questionResponseParameters = new QuestionResponseParameters();
        questionResponseParameters.addTextAnswer("questionGroups[0].sectionDetails[0].questions[0].value", "04/02/2011");
        questionResponseParameters.addTextAnswer("questionGroups[0].sectionDetails[0].questions[1].value", "free text");
        questionResponseParameters.addTextAnswer("questionGroups[0].sectionDetails[1].questions[0].value", "free text1");
        questionResponseParameters.addTextAnswer("questionGroups[1].sectionDetails[0].questions[0].value", "07/02/2011");
        questionResponseParameters.addTextAnswer("questionGroups[1].sectionDetails[0].questions[1].value", "20");
        questionResponseParameters.addSingleSelectAnswer("questionGroups[1].sectionDetails[1].questions[0].valuesAsArray", "three");
        questionResponseParameters.addTextAnswer("questionGroups[1].sectionDetails[1].questions[1].value", "free text2");
        LoanAccountPage loanAccountPage = loanTestHelper.createAndActivateDefaultLoanAccount(createLoanAccountSearchParameters);
        String loan1ID = loanAccountPage.getAccountId();
        loanAccountPage = loanTestHelper.createAndActivateDefaultLoanAccount(createLoanAccountSearchParameters);
        String loan2ID = loanAccountPage.getAccountId();
        QuestionResponsePage questionResponsePage = questionGroupTestHelper.navigateToQuestionResponsePageDuringLoanDisbursal(loan1ID, disburseLoanParameters);
        questionResponsePage.populateAnswers(questionResponseParameters);
        questionResponsePage = questionResponsePage.continueAndNavigateToDisburseLoanConfirmationPage().navigateToEditAdditionalInformation();
        questionResponseParameters.addSingleSelectAnswer("questionGroups[0].sectionDetails[1].questions[1].value", "blue");
        questionResponsePage.populateAnswers(questionResponseParameters);
        questionResponsePage.continueAndNavigateToDisburseLoanConfirmationPage().submitAndNavigateToLoanAccountPage();
        CreateQuestionParameters createQuestionParameters = new CreateQuestionParameters();
        createQuestionParameters.setType(createQuestionParameters.TYPE_FREE_TEXT);
        createQuestionParameters.setText("createdByverifyCapturingResponsesDuringLoanDisburse");
        List<CreateQuestionParameters> newQuestionList = new ArrayList<CreateQuestionParameters>();
        newQuestionList.add(createQuestionParameters);
        String[] questionsExist = { "Date", "FreeText", "SingleSelect", "createdByverifyCapturingResponsesDuringLoanDisburse" };
        String[] questionsInactive = { "ToBeDisabled" };
        Map<String, String> questionsAndAnswers = new HashMap<String, String>();
        questionsAndAnswers.put("MultiSelect", "three");
        questionsAndAnswers.put("Number", "20");
        questionsAndAnswers.put("Date", "04/02/2011");
        questionGroupTestHelper.markQuestionAsInactive("ToBeDisabled");
        questionGroupTestHelper.markQuestionGroupAsInactive("QGForDisburseLoan2");
        questionGroupTestHelper.addNewQuestionsToQuestionGroup("QGForDisburseLoan1", newQuestionList);
        questionResponsePage = questionGroupTestHelper.navigateToQuestionResponsePageDuringLoanDisbursal(loan2ID, disburseLoanParameters);
        questionResponsePage.verifyQuestionsExists(questionsExist);
        questionResponsePage.verifyQuestionsDoesnotappear(questionsInactive);
        verifyQuestionResponsesExistInDatabase(loan1ID, "Disburse Loan", questionsAndAnswers);
    } finally {
        questionGroupTestHelper.markQuestionAsActive("ToBeDisabled");
        questionGroupTestHelper.markQuestionGroupAsInactive("QGForDisburseLoan1");
        questionGroupTestHelper.markQuestionGroupAsInactive("QGForDisburseLoan2");
    }
}
Also used : DisburseLoanParameters(org.mifos.test.acceptance.framework.loan.DisburseLoanParameters) CreateLoanAccountSearchParameters(org.mifos.test.acceptance.framework.loan.CreateLoanAccountSearchParameters) CreateQuestionParameters(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionParameters) HashMap(java.util.HashMap) QuestionResponsePage(org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage) ArrayList(java.util.ArrayList) LoanAccountPage(org.mifos.test.acceptance.framework.loan.LoanAccountPage) QuestionResponseParameters(org.mifos.test.acceptance.framework.loan.QuestionResponseParameters) Test(org.testng.annotations.Test)

Example 18 with QuestionResponsePage

use of org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage in project head by mifos.

the class ClientTestHelper method createClientWithQuestionGroups.

public ClientViewDetailsPage createClientWithQuestionGroups(String loanOfficer, String officeName, Map<String, String> choiceTags, String answer) {
    CreateClientEnterPersonalDataPage clientPersonalDataPage = navigateToPersonalDataPage(officeName);
    CreateClientEnterPersonalDataPage.SubmitFormParameters formParameters = FormParametersHelper.getClientEnterPersonalDataPageFormParameters();
    clientPersonalDataPage = clientPersonalDataPage.create(formParameters);
    QuestionResponsePage questionResponsePage = clientPersonalDataPage.submitAndGotoCaptureQuestionResponsePage();
    questionResponsePage.populateTextAnswer("name=questionGroups[0].sectionDetails[0].questions[0].value", answer);
    questionResponsePage.populateSmartSelect("txtListSearch", choiceTags);
    questionResponsePage.navigateToNextPage();
    navigateToConfirmationPage(loanOfficer);
    return navigateToClientViewDetails(formParameters);
}
Also used : CreateClientEnterPersonalDataPage(org.mifos.test.acceptance.framework.client.CreateClientEnterPersonalDataPage) QuestionResponsePage(org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage)

Example 19 with QuestionResponsePage

use of org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage in project head by mifos.

the class ClientTestHelper method createClientWithQuestionGroups.

public ClientViewDetailsPage createClientWithQuestionGroups(CreateClientEnterPersonalDataPage.SubmitFormParameters parameters, String group, QuestionResponseParameters responseParams) {
    QuestionResponsePage questionResponsePage = navigateToQuestionResponsePage(parameters, group);
    questionResponsePage.populateAnswers(responseParams);
    CreateClientEnterMfiDataPage createClientEnterMfiDataPage = questionResponsePage.navigateToNextPageClientCreation();
    CreateClientPreviewDataPage clientPreviewDataPage = createClientEnterMfiDataPage.navigateToPreview();
    clientPreviewDataPage.submit();
    return navigateToClientViewDetails(parameters);
}
Also used : CreateClientPreviewDataPage(org.mifos.test.acceptance.framework.client.CreateClientPreviewDataPage) QuestionResponsePage(org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage) CreateClientEnterMfiDataPage(org.mifos.test.acceptance.framework.client.CreateClientEnterMfiDataPage)

Example 20 with QuestionResponsePage

use of org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage in project head by mifos.

the class QuestionGroupTest method attachingQuestionGroupToMultipleFlowsTest.

/**
     * Attaching a Question Group to Multiple flows
     * http://mifosforge.jira.com/browse/MIFOSTEST-701
     *
     * @throws Exception
     */
@Test(enabled = true)
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void attachingQuestionGroupToMultipleFlowsTest() throws Exception {
    String newClient = "Joe701 Doe701";
    questionGroupTestHelper.markQuestionGroupAsInactive("CreateOffice");
    createClient("Joe701", "Doe701");
    //When
    testValidationAddQuestionGroup();
    Map<String, List<String>> sectionQuestions = new HashMap<String, List<String>>();
    List<String> questions = new ArrayList<String>();
    questions.add("Date");
    questions.add("Number");
    questions.add("Text");
    sectionQuestions.put("Sec Test", questions);
    CreateQuestionGroupParameters createQuestionGroupParameters = new CreateQuestionGroupParameters();
    createQuestionGroupParameters.setAnswerEditable(true);
    String testQuestionGroup = "TestQuestionGroup";
    createQuestionGroupParameters.setTitle(testQuestionGroup);
    createQuestionGroupParameters.setAppliesTo("View Client");
    createQuestionGroupParameters.setAppliesTo("Close Client");
    createQuestionGroupParameters.setExistingQuestions(sectionQuestions);
    try {
        questionGroupTestHelper.createQuestionGroup(createQuestionGroupParameters);
        Map<String, String> answers = new HashMap<String, String>();
        answers.put("Text", "Test - Text");
        answers.put("Number", "2");
        answers.put("Date", "11/11/2009");
        ClientViewDetailsPage clientViewDetailsPage = questionGroupTestHelper.attachQuestionGroup(newClient, testQuestionGroup, asList("Sec Test"), answers);
        CustomerChangeStatusPage customerChangeStatusPage = clientViewDetailsPage.navigateToCustomerChangeStatusPage();
        EditCustomerStatusParameters customerStatusParameters = new EditCustomerStatusParameters();
        customerStatusParameters.setNote("TEST");
        customerStatusParameters.setClientStatus(ClientStatus.CLOSED);
        customerStatusParameters.setClientCloseReason(ClientCloseReason.TRANSFERRED);
        QuestionResponsePage questionResponsePage = customerChangeStatusPage.changeStatusAndNavigateToQuestionResponsePage(customerStatusParameters);
        //Then
        questionResponsePage.verifyQuestionsExists(questions.toArray(new String[questions.size()]));
        //When
        clientViewDetailsPage = questionResponsePage.cancel();
        ViewQuestionResponseDetailPage viewQuestionResponseDetailPage = clientViewDetailsPage.navigateToViewAdditionalInformationPage();
        //Then
        viewQuestionResponseDetailPage.verifyQuestionsDoesnotappear(questions.toArray(new String[questions.size()]));
        clientViewDetailsPage = viewQuestionResponseDetailPage.navigateToClientViewDetailsPage();
        answers = new HashMap<String, String>();
        answers.put("Text", "Test - Text - Edit");
        answers.put("Number", "22");
        questionGroupInstancesOfClient = clientViewDetailsPage.getQuestionGroupInstances();
        questionGroupTestHelper.editResponses(clientViewDetailsPage, latestInstanceId(questionGroupInstancesOfClient), answers);
        // extension MIFOS-5821
        CreateLoanAccountSearchParameters searchParameters = new CreateLoanAccountSearchParameters();
        searchParameters.setSearchString("Client - Mary Monthly");
        searchParameters.setLoanProduct("MonthlyClientFlatLoanThirdFridayOfMonth");
        loanTestHelper.createDefaultLoanAccount(searchParameters);
    } finally {
        questionGroupTestHelper.markQuestionGroupAsInactive(testQuestionGroup);
        questionGroupTestHelper.markQuestionGroupAsInactive("CreateOffice");
    }
}
Also used : CreateLoanAccountSearchParameters(org.mifos.test.acceptance.framework.loan.CreateLoanAccountSearchParameters) ViewQuestionResponseDetailPage(org.mifos.test.acceptance.framework.questionnaire.ViewQuestionResponseDetailPage) CreateQuestionGroupParameters(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters) HashMap(java.util.HashMap) QuestionResponsePage(org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage) ArrayList(java.util.ArrayList) ClientViewDetailsPage(org.mifos.test.acceptance.framework.client.ClientViewDetailsPage) EditCustomerStatusParameters(org.mifos.test.acceptance.framework.group.EditCustomerStatusParameters) List(java.util.List) ArrayList(java.util.ArrayList) CustomerChangeStatusPage(org.mifos.test.acceptance.framework.customer.CustomerChangeStatusPage) Test(org.testng.annotations.Test)

Aggregations

QuestionResponsePage (org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage)21 QuestionResponseParameters (org.mifos.test.acceptance.framework.loan.QuestionResponseParameters)10 ArrayList (java.util.ArrayList)9 Test (org.testng.annotations.Test)9 HashMap (java.util.HashMap)7 CreateQuestionParameters (org.mifos.test.acceptance.framework.questionnaire.CreateQuestionParameters)6 ViewQuestionResponseDetailPage (org.mifos.test.acceptance.framework.questionnaire.ViewQuestionResponseDetailPage)6 CreateLoanAccountSearchParameters (org.mifos.test.acceptance.framework.loan.CreateLoanAccountSearchParameters)5 CreateQuestionGroupParameters (org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters)5 LoanAccountPage (org.mifos.test.acceptance.framework.loan.LoanAccountPage)4 ClientViewDetailsPage (org.mifos.test.acceptance.framework.client.ClientViewDetailsPage)3 CreateClientEnterPersonalDataPage (org.mifos.test.acceptance.framework.client.CreateClientEnterPersonalDataPage)3 QuestionnairePage (org.mifos.test.acceptance.framework.questionnaire.QuestionnairePage)3 QuestionGroupTestHelper (org.mifos.test.acceptance.framework.testhelpers.QuestionGroupTestHelper)3 List (java.util.List)2 EditAccountStatusParameters (org.mifos.test.acceptance.framework.account.EditAccountStatusParameters)2 AdminPage (org.mifos.test.acceptance.framework.admin.AdminPage)2 CustomerChangeStatusPage (org.mifos.test.acceptance.framework.customer.CustomerChangeStatusPage)2 CustomerChangeStatusPreviewPage (org.mifos.test.acceptance.framework.customer.CustomerChangeStatusPreviewPage)2 CreateGroupSubmitParameters (org.mifos.test.acceptance.framework.group.CreateGroupEntryPage.CreateGroupSubmitParameters)2