use of org.mifos.test.acceptance.framework.loan.LoanAccountPage 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.LoanAccountPage 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.LoanAccountPage 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");
}
}
use of org.mifos.test.acceptance.framework.loan.LoanAccountPage 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");
}
}
use of org.mifos.test.acceptance.framework.loan.LoanAccountPage in project head by mifos.
the class DefineNewLoanProductTest method verifyWaiveInterestForLoanAccount.
/*
* passing locally but not on hudson.
*/
//http://mifosforge.jira.com/browse/MIFOSTEST-710
@Test(enabled = true)
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void verifyWaiveInterestForLoanAccount() throws Exception {
//Given
DateTimeUpdaterRemoteTestingService dateTimeUpdaterRemoteTestingService = new DateTimeUpdaterRemoteTestingService(selenium);
DateTime systemDateTime = new DateTime(2011, 3, 7, 12, 0, 0, 0);
dateTimeUpdaterRemoteTestingService.setDateTime(systemDateTime);
//When
DefineNewLoanProductPage.SubmitFormParameters formParameters = FormParametersHelper.getWeeklyLoanProductParameters();
formParameters.setInterestWaiver(true);
NavigationHelper navigationHelper = new NavigationHelper(selenium);
AdminPage adminPage = navigationHelper.navigateToAdminPage();
DefineNewLoanProductPage newLoanProductPage = adminPage.navigateToDefineLoanProduct();
newLoanProductPage.fillLoanParameters(formParameters);
DefineNewLoanProductPreviewPage previewPage = newLoanProductPage.submitAndGotoNewLoanProductPreviewPage();
//Then
Assert.assertTrue(selenium.isTextPresent("Can waive interest on repay loan: Yes"));
Assert.assertTrue(selenium.isTextPresent("Interest: 31102"));
Assert.assertTrue(selenium.isTextPresent("Principal: 1506"));
//When
LoanProductDetailsPage loanProductDetailsPage = previewPage.submit().navigateToViewLoanDetailsPage();
//Then
Assert.assertTrue(selenium.isTextPresent("Can waive interest on repay loan: Yes"));
//When
EditLoanProductPage editLoanProductPage = loanProductDetailsPage.editLoanProduct();
//Then
Assert.assertTrue(selenium.isChecked("EditLoanProduct.input.includeInterestWaiver"));
//When
EditLoanProductPreviewPage editLoanProductPreviewPage = editLoanProductPage.editSubmit();
//Then
Assert.assertTrue(selenium.isTextPresent("Can waive interest on repay loan: Yes"));
//When
loanProductDetailsPage = editLoanProductPreviewPage.submit();
//Then
Assert.assertTrue(selenium.isTextPresent("Can waive interest on repay loan: Yes"));
//When
CreateLoanAccountSearchParameters searchParameters = new CreateLoanAccountSearchParameters();
searchParameters.setSearchString("WeeklyClient Monday");
searchParameters.setLoanProduct(formParameters.getOfferingName());
LoanTestHelper loanTestHelper = new LoanTestHelper(selenium);
LoanAccountPage loanAccountPage = loanTestHelper.createAndActivateDefaultLoanAccount(searchParameters);
DisburseLoanParameters disburseParameters = new DisburseLoanParameters();
disburseParameters.setDisbursalDateDD(Integer.toString(systemDateTime.getDayOfMonth()));
disburseParameters.setDisbursalDateMM(Integer.toString(systemDateTime.getMonthOfYear()));
disburseParameters.setDisbursalDateYYYY(Integer.toString(systemDateTime.getYear()));
disburseParameters.setPaymentType(PaymentParameters.CASH);
loanAccountPage.navigateToDisburseLoan().submitAndNavigateToDisburseLoanConfirmationPage(disburseParameters).submitAndNavigateToLoanAccountPage();
RepayLoanPage repayLoanPage = loanAccountPage.navigateToRepayLoan();
//Then
Assert.assertTrue(selenium.isChecked("waiverInterestChckBox"));
Assert.assertEquals("Note: Interest due will be waived off.", selenium.getText("waiverInterestWarning"));
Assert.assertFalse(repayLoanPage.isTotalRepaymentAmountVisible());
Assert.assertTrue(repayLoanPage.isWaivedRepaymentAmoutVisible());
Assert.assertEquals(repayLoanPage.waivedRepaymentAmount(), "2,500");
//When
repayLoanPage.interestWaiver(false);
//Then
Assert.assertTrue(repayLoanPage.isTotalRepaymentAmountVisible());
Assert.assertFalse(repayLoanPage.isWaivedRepaymentAmoutVisible());
Assert.assertFalse(selenium.isTextPresent("Note: Interest due will be waived off."));
Assert.assertEquals(repayLoanPage.totalRepaymentAmount(), "2,509.1");
//When
RepayLoanParameters params = new RepayLoanParameters();
params.setModeOfRepayment("Cash");
loanAccountPage = repayLoanPage.submitAndNavigateToRepayLoanConfirmationPage(params).submitAndNavigateToLoanAccountDetailsPage();
//Then
loanAccountPage.verifyStatus("Closed- Obligation met");
String[][] accountSummaryTable = { { "", "Original Loan", "Amount paid", "Loan balance" }, { "Principal", "2,500", "2,500", "0" }, { "Interest", "9.1", "9.1", "0" }, { "Fees", "0", "0", "0" }, { "Penalty", "0", "0", "0" }, { "Total", "2,509.1", "2,509.1", "0" } };
loanAccountPage.verifyAccountSummary(accountSummaryTable);
loanAccountPage.navigateToAccountActivityPage();
Assert.assertEquals("Loan Repayment", selenium.getTable("accountActivityTable.2.1").trim());
Assert.assertEquals("2,500", selenium.getTable("accountActivityTable.2.2").trim());
Assert.assertEquals("0", selenium.getTable("accountActivityTable.2.10").trim());
}
Aggregations