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);
}
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;
}
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");
}
}
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");
}
}
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");
}
}
Aggregations