Search in sources :

Example 16 with QuestionResponseParameters

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

the class PPITest method verifyPPIQuestionGroup.

//http://mifosforge.jira.com/browse/MIFOSTEST-147
public void verifyPPIQuestionGroup() throws Exception {
    //Given
    initRemote.dataLoadAndCacheRefresh(dbUnitUtilities, "acceptance_small_008_dbunit.xml", dataSource, selenium);
    String configPath = new ConfigurationLocator().getConfigurationDirectory();
    String fileName = "PPISurveyBANGLADESH2009.xml";
    String sourcePath = PPITest.class.getResource("/mpesa/" + fileName).getFile();
    String qgDestPath = configPath + "/uploads/questionGroups/";
    String destPath = qgDestPath + fileName;
    new File(qgDestPath).mkdirs();
    File sourceFile = new File(sourcePath);
    File destFile = new File(destPath);
    List<String> QGlist = new ArrayList<String>();
    QGlist.add("PPI Bangladesh 2009");
    CreateClientEnterPersonalDataPage.SubmitFormParameters formParameters = FormParametersHelper.getClientEnterPersonalDataPageFormParameters();
    QuestionResponseParameters responseParams = getQuestionResponseParametersForPPIIndia2008();
    AttachQuestionGroupParameters attachParams = new AttachQuestionGroupParameters();
    attachParams.setQuestionGroupName("PPI Bangladesh 2009");
    attachParams.addTextResponse("Date Survey Was Taken", "24/01/2011");
    attachParams.addCheckResponse("How many household members are 11-years-old or younger?", "Four or more");
    attachParams.addCheckResponse("Does any household member work for a daily wage?", "Yes");
    attachParams.addCheckResponse("What type of latrine does the household use?", "Open field");
    attachParams.addCheckResponse("How many rooms does the household occupy (excluding rooms used for business)?", "Four");
    attachParams.addCheckResponse("What is the main construction material of the walls?", "Brick/cement");
    attachParams.addCheckResponse("What is the main construction material of the roof?", "Cement");
    attachParams.addCheckResponse("What is the total cultivable agricultural land owned by the household?", "More than 1 acre");
    attachParams.addCheckResponse("Does the household own a television?", "Yes");
    attachParams.addCheckResponse("Does the household own a two-in-one cassette player?", "No");
    attachParams.addCheckResponse("Does the household own a wristwatch?", "Yes");
    String[] eventList = { "View Client", "Create Client", "Close Client" };
    //When
    if (!destFile.exists()) {
        copyFile(sourceFile, destFile);
    }
    questionGroupTestHelper.activatePPI("BANGLADESH2009");
    questionGroupTestHelper.changeAppliesTo("PPI Bangladesh 2009", eventList);
    questionGroupTestHelper.navigateToViewQuestionGroups(QGlist);
    String clientName = clientTestHelper.createClientWithQuestionGroups(formParameters, "MyGroup1232993846342", responseParams).getHeading();
    attachParams.setTarget(clientName);
    clientTestHelper.activateClient(clientName);
    questionGroupTestHelper.attachQuestionGroupToClient(attachParams);
    clientTestHelper.closeClientWithQG(clientName, responseParams);
}
Also used : CreateClientEnterPersonalDataPage(org.mifos.test.acceptance.framework.client.CreateClientEnterPersonalDataPage) ArrayList(java.util.ArrayList) AttachQuestionGroupParameters(org.mifos.test.acceptance.framework.questionnaire.AttachQuestionGroupParameters) ConfigurationLocator(org.mifos.framework.util.ConfigurationLocator) File(java.io.File) QuestionResponseParameters(org.mifos.test.acceptance.framework.loan.QuestionResponseParameters)

Example 17 with QuestionResponseParameters

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

the class PPITest method getQuestionResponseParametersForPPIIndia2008.

private QuestionResponseParameters getQuestionResponseParametersForPPIIndia2008() {
    QuestionResponseParameters responseParams = new QuestionResponseParameters();
    responseParams.addTextAnswer("questionGroups[0].sectionDetails[0].questions[0].value", "24/01/2011");
    responseParams.addSingleSelectAnswer("questionGroups[0].sectionDetails[0].questions[1].value", "Four or more");
    responseParams.addSingleSelectAnswer("questionGroups[0].sectionDetails[0].questions[2].value", "Yes");
    responseParams.addSingleSelectAnswer("questionGroups[0].sectionDetails[0].questions[3].value", "Open field");
    responseParams.addSingleSelectAnswer("questionGroups[0].sectionDetails[0].questions[4].value", "Four");
    responseParams.addSingleSelectAnswer("questionGroups[0].sectionDetails[0].questions[5].value", "Brick/cement");
    responseParams.addSingleSelectAnswer("questionGroups[0].sectionDetails[0].questions[6].value", "Cement");
    responseParams.addSingleSelectAnswer("questionGroups[0].sectionDetails[0].questions[7].value", "More than 1 acre");
    responseParams.addSingleSelectAnswer("questionGroups[0].sectionDetails[0].questions[8].value", "Yes");
    responseParams.addSingleSelectAnswer("questionGroups[0].sectionDetails[0].questions[9].value", "No");
    responseParams.addSingleSelectAnswer("questionGroups[0].sectionDetails[0].questions[10].value", "Yes");
    return responseParams;
}
Also used : QuestionResponseParameters(org.mifos.test.acceptance.framework.loan.QuestionResponseParameters)

Example 18 with QuestionResponseParameters

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

the class QuestionGroupLoanAccountTest method verifyResponsesDuringCreationOfLoanAccount.

/**
     * Capturing responses during the creation of Loan account
     * http://mifosforge.jira.com/browse/MIFOSTEST-683
     *
     * @throws Exception
     */
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void verifyResponsesDuringCreationOfLoanAccount() throws Exception {
    CreateLoanAccountSearchParameters createLoanAccountSearchParameters = new CreateLoanAccountSearchParameters();
    createLoanAccountSearchParameters.setLoanProduct("WeeklyClientFlatLoanWithNoFee");
    createLoanAccountSearchParameters.setSearchString("ClientWithLoan 20110221");
    CreateLoanAccountSubmitParameters formParameters = new CreateLoanAccountSubmitParameters();
    formParameters.setAdditionalFee1("oneTimeFee");
    formParameters.setAdditionalFee2("loanWeeklyFee");
    verifyQGNotDisplayed(createLoanAccountSearchParameters);
    questionGroupTestHelper.markQuestionGroupAsActive("QGForCreateLoan1");
    questionGroupTestHelper.markQuestionGroupAsActive("QGForCreateLoan2");
    try {
        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].values", "three");
        questionResponseParameters.addTextAnswer("questionGroups[1].sectionDetails[1].questions[1].value", "free text2");
        CreateQuestionParameters createQuestionParameters = new CreateQuestionParameters();
        createQuestionParameters.setType(createQuestionParameters.TYPE_FREE_TEXT);
        createQuestionParameters.setText("questionByVerifyResponsesDuringCreationOfLoanAccount");
        List<CreateQuestionParameters> newQuestionList = new ArrayList<CreateQuestionParameters>();
        newQuestionList.add(createQuestionParameters);
        String[] questionsExist = { "Date", "FreeText", "SingleSelect", "questionByVerifyResponsesDuringCreationOfLoanAccount" };
        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");
        QuestionResponsePage questionResponsePage = questionGroupTestHelper.navigateToQuestionResponsePageDuringLoanCreation(createLoanAccountSearchParameters, formParameters);
        questionResponsePage.populateAnswers(questionResponseParameters);
        CreateLoanAccountPreviewPage createLoanAccountPreviewPage = questionResponsePage.continueAndNavigateToCreateLoanAccountReviewInstallmentPage().clickPreviewAndGoToReviewLoanAccountPage();
        verifyCreateLoanAccountPreviewPage();
        questionResponsePage = createLoanAccountPreviewPage.navigateToQuestionResponsePage();
        questionResponseParameters.addSingleSelectAnswer("questionGroups[0].sectionDetails[1].questions[1].value", "blue");
        questionResponsePage.populateAnswers(questionResponseParameters);
        LoanAccountPage loanAccountPage = questionResponsePage.continueAndNavigateToCreateLoanAccountReviewInstallmentPage().clickPreviewAndGoToReviewLoanAccountPage().submit().navigateToLoanAccountDetailsPage();
        String loanID = loanAccountPage.getAccountId();
        verifyFees();
        ViewQuestionResponseDetailPage viewQuestionResponseDetailPage = questionGroupTestHelper.navigateToLoanViewQuestionResponseDetailPage(loanID);
        viewQuestionResponseDetailPage.verifyQuestionPresent("Date", "04/02/2011");
        viewQuestionResponseDetailPage.verifyQuestionPresent("ToBeDisabled", "free text");
        viewQuestionResponseDetailPage.verifyQuestionPresent("FreeText", "free text1");
        viewQuestionResponseDetailPage.verifyQuestionPresent("SingleSelect", "blue");
        viewQuestionResponseDetailPage.verifyQuestionPresent("DateQuestion", "07/02/2011");
        viewQuestionResponseDetailPage.verifyQuestionPresent("Number", "20");
        viewQuestionResponseDetailPage.verifyQuestionPresent("MultiSelect", "three");
        viewQuestionResponseDetailPage.verifyQuestionPresent("Text", "free text2");
        questionGroupTestHelper.markQuestionAsInactive("ToBeDisabled");
        questionGroupTestHelper.markQuestionGroupAsInactive("QGForCreateLoan2");
        questionGroupTestHelper.addNewQuestionsToQuestionGroup("QGForCreateLoan1", newQuestionList);
        questionResponsePage = questionGroupTestHelper.navigateToQuestionResponsePageDuringLoanCreation(createLoanAccountSearchParameters, null);
        questionResponsePage.verifyQuestionsExists(questionsExist);
        questionResponsePage.verifyQuestionsDoesnotappear(questionsInactive);
        viewQuestionResponseDetailPage = questionGroupTestHelper.navigateToLoanViewQuestionResponseDetailPage(loanID);
        viewQuestionResponseDetailPage.verifyQuestionPresent("MultiSelect", "three");
        viewQuestionResponseDetailPage.verifyQuestionPresent("Number", "20");
        viewQuestionResponseDetailPage.verifyQuestionPresent("Date", "04/02/2011");
        verifyQuestionResponsesExistInDatabase(loanID, "Create Loan", questionsAndAnswers);
    } finally {
        questionGroupTestHelper.markQuestionAsActive("ToBeDisabled");
        questionGroupTestHelper.markQuestionGroupAsInactive("QGForCreateLoan1");
        questionGroupTestHelper.markQuestionGroupAsInactive("QGForCreateLoan2");
    }
}
Also used : CreateLoanAccountSearchParameters(org.mifos.test.acceptance.framework.loan.CreateLoanAccountSearchParameters) ViewQuestionResponseDetailPage(org.mifos.test.acceptance.framework.questionnaire.ViewQuestionResponseDetailPage) HashMap(java.util.HashMap) QuestionResponsePage(org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage) ArrayList(java.util.ArrayList) QuestionResponseParameters(org.mifos.test.acceptance.framework.loan.QuestionResponseParameters) CreateQuestionParameters(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionParameters) CreateLoanAccountPreviewPage(org.mifos.test.acceptance.framework.loan.CreateLoanAccountPreviewPage) CreateLoanAccountSubmitParameters(org.mifos.test.acceptance.framework.loan.CreateLoanAccountSubmitParameters) LoanAccountPage(org.mifos.test.acceptance.framework.loan.LoanAccountPage)

Example 19 with QuestionResponseParameters

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

the class QuestionGroupLoanAccountTest method verifyResponsesDuringLoanAccountApproval.

/**
     * Capturing responses while approving Loan account
     * http://mifosforge.jira.com/browse/MIFOSTEST-684
     *
     * @throws Exception
     */
@Test(enabled = true)
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void verifyResponsesDuringLoanAccountApproval() throws Exception {
    questionGroupTestHelper.markQuestionGroupAsActive("QGForApproveLoan1");
    questionGroupTestHelper.markQuestionGroupAsActive("QGForApproveLoan2");
    try {
        CreateLoanAccountSearchParameters createLoanAccountSearchParameters = new CreateLoanAccountSearchParameters();
        createLoanAccountSearchParameters.setLoanProduct("WeeklyClientFlatLoanWithNoFee");
        createLoanAccountSearchParameters.setSearchString("ClientWithLoan 20110221");
        EditAccountStatusParameters editAccountStatusParameters = new EditAccountStatusParameters();
        editAccountStatusParameters.setAccountStatus(AccountStatus.LOAN_APPROVED);
        editAccountStatusParameters.setNote("note note");
        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");
        CreateQuestionParameters createQuestionParameters = new CreateQuestionParameters();
        createQuestionParameters.setType(createQuestionParameters.TYPE_FREE_TEXT);
        createQuestionParameters.setText("questionByVerifyResponsesDuringLoanAccountApproval");
        List<CreateQuestionParameters> newQuestionList = new ArrayList<CreateQuestionParameters>();
        newQuestionList.add(createQuestionParameters);
        String[] questionsExist = { "Date", "FreeText", "SingleSelect", "questionByVerifyResponsesDuringLoanAccountApproval" };
        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");
        LoanAccountPage loanAccountPage = loanTestHelper.createDefaultLoanAccount(createLoanAccountSearchParameters);
        String loanID1 = loanAccountPage.getAccountId();
        loanAccountPage = loanTestHelper.createDefaultLoanAccount(createLoanAccountSearchParameters);
        String loanID2 = loanAccountPage.getAccountId();
        QuestionResponsePage questionResponsePage = questionGroupTestHelper.navigateToQuestionResponsePageDuringLoanStatusChange(loanID1, editAccountStatusParameters);
        questionResponsePage.populateAnswers(questionResponseParameters);
        questionResponsePage = questionResponsePage.continueAndNavigateToEditAccountStatusConfirmationPage().navigateToEditStatus().submitAndNavigateToQuestionResponsePage(editAccountStatusParameters);
        questionResponseParameters.addTextAnswer("questionGroups[0].sectionDetails[1].questions[1].value", "blue");
        questionResponsePage.populateAnswers(questionResponseParameters);
        questionResponsePage.continueAndNavigateToEditAccountStatusConfirmationPage().submitAndNavigateToLoanAccountPage();
        questionGroupTestHelper.markQuestionAsInactive("ToBeDisabled");
        questionGroupTestHelper.markQuestionGroupAsInactive("QGForApproveLoan2");
        questionGroupTestHelper.addNewQuestionsToQuestionGroup("QGForApproveLoan1", newQuestionList);
        questionResponsePage = questionGroupTestHelper.navigateToQuestionResponsePageDuringLoanStatusChange(loanID2, editAccountStatusParameters);
        questionResponsePage.verifyQuestionsExists(questionsExist);
        questionResponsePage.verifyQuestionsDoesnotappear(questionsInactive);
        verifyQuestionResponsesExistInDatabase(loanID1, "Approve Loan", questionsAndAnswers);
    } finally {
        questionGroupTestHelper.markQuestionAsActive("ToBeDisabled");
        questionGroupTestHelper.markQuestionGroupAsInactive("QGForApproveLoan1");
        questionGroupTestHelper.markQuestionGroupAsInactive("QGForApproveLoan2");
    }
}
Also used : 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) EditAccountStatusParameters(org.mifos.test.acceptance.framework.account.EditAccountStatusParameters) Test(org.testng.annotations.Test)

Example 20 with QuestionResponseParameters

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

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