use of org.mifos.test.acceptance.remote.DateTimeUpdaterRemoteTestingService 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());
}
use of org.mifos.test.acceptance.remote.DateTimeUpdaterRemoteTestingService in project head by mifos.
the class EditLoanProductTest method editExistingLoanAndSavingsProduct.
//http://mifosforge.jira.com/browse/MIFOSTEST-312
// one of the dependent methods throws Exception
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void editExistingLoanAndSavingsProduct() throws Exception {
DateTimeUpdaterRemoteTestingService dateTimeUpdaterRemoteTestingService = new DateTimeUpdaterRemoteTestingService(selenium);
DateTime targetTime = new DateTime(2011, 2, 2, 13, 0, 0, 0);
dateTimeUpdaterRemoteTestingService.setDateTime(targetTime);
EditLoanProductPage editLoanProductPage = createNewLoanProductAndNavigateToEditLoanPage();
editLoanProductPage.verifyPage();
SubmitFormParameters formParameters = new SubmitFormParameters();
formParameters = cleanFormParameters(formParameters);
EditLoanProductPreviewPage editLoanProductPreviewPage = editLoanProductPage.submitRequiredDescriptionAndInterestChanges(formParameters);
String error = selenium.getText("EditLoanProduct.error.message");
verifyError(error, "Please specify the Product instance name.", "Please specify the Short name.", "Please select the Product category.", "Please specify the Applicable for.", "Please select the Interest rate type.", "Please select the Status.", "Please specify the Min Interest rate.", "Please specify the Max Interest rate.", "Please select the Status.", "Please specify the Min Interest rate.", "Please specify the Default Interest rate.");
//TODO js - missing error msg
//Assert.assertEquals(error.contains("Please specify the Start date."), true);
formParameters = setFormParameters(formParameters);
editLoanProductPreviewPage = editLoanProductPage.submitRequiredDescriptionAndInterestChanges(formParameters);
error = selenium.getText("EditLoanProduct.error.message");
//TODO js - missing error msg
//Assert.assertEquals(error.contains("The Start date cannot be changed because either the product is active or the date specified is invalid."), true);
Assert.assertEquals(error.contains("Please specify a valid Max Interest rate. Max Interest rate should be greater than or equal to Min Interest rate."), true);
Assert.assertEquals(error.contains("Please specify valid Default Interest rate. Default Interest rate should be between the Min and Max Interest rate, inclusive of the two."), true);
formParameters = setCorrectFormParameters(formParameters);
editLoanProductPreviewPage = editLoanProductPage.submitRequiredDescriptionAndInterestChanges(formParameters);
LoanProductDetailsPage loanProductDetailsPage = editLoanProductPreviewPage.submit();
loanProductDetailsPage.verifyPage();
loanProductDetailsPage.editLoanProduct();
editLoanProductPage.verifyPage();
editLoanProductPage.verifyModifiedLoanProduct(formParameters);
///////////////////////SAVINGS////////////////////
SavingsProductHelper savingsProductHelper = new SavingsProductHelper(selenium);
SavingsProductParameters params = savingsProductHelper.getGenericSavingsProductParameters(new DateTime(2011, 2, 2, 12, 0, 0, 0), SavingsProductParameters.VOLUNTARY, SavingsProductParameters.CENTERS);
DefineNewSavingsProductConfirmationPage confirmationPage = savingsProductHelper.createSavingsProduct(params);
EditSavingsProductPage editSavingsProductPage = confirmationPage.navigateToSavingsProductDetails().editSavingsProduct();
DefineNewSavingsProductPage.SubmitSavingsFormParameters formSavingsParameters = new DefineNewSavingsProductPage.SubmitSavingsFormParameters();
formSavingsParameters = cleanFormSavingsParameters(formSavingsParameters);
EditSavingsProductPreviewPage editSavingsProductPreviewPage = editSavingsProductPage.submitRequiredDescriptionAndInterestChanges(formSavingsParameters);
error = selenium.getText("error.messages");
verifyError(error, "Please specify the Product instance name.", "Please specify the Short name.", "Please select the Product category.", "Please specify the Start date. Day must be in range (1-31).", "Please specify the Start date. Month must be in range (1-12).", "The Start date can be anything between current date and 1 year from the current date.", "Please select the Applicable for.", "Please select the Type of deposits.", "Please specify the Interest rate. Interest must be in range (0-100).", "Please select the Balance used for Interest calculation.", "Please specify the Time period for Interest calculation.", "Please specify the Frequency of Interest posting to accounts.");
formSavingsParameters = setFormSavingsParameters(formSavingsParameters);
editSavingsProductPreviewPage = editSavingsProductPage.submitRequiredDescriptionAndInterestChanges(formSavingsParameters);
SavingsProductDetailsPage savingsProductDetailsPage = editSavingsProductPreviewPage.submit();
savingsProductDetailsPage.editSavingsProduct();
editSavingsProductPage.verifyModifiedSavingsProduct(formSavingsParameters);
}
use of org.mifos.test.acceptance.remote.DateTimeUpdaterRemoteTestingService in project head by mifos.
the class ProperLoanProductCalculationsTest method setUp.
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
@BeforeMethod
@Override
public void setUp() throws Exception {
super.setUp();
DateTimeUpdaterRemoteTestingService dateTimeUpdaterRemoteTestingService = new DateTimeUpdaterRemoteTestingService(selenium);
DateTime targetTime = new DateTime(2009, 7, 1, 12, 0, 0, 0);
dateTimeUpdaterRemoteTestingService.setDateTime(targetTime);
loanProductTestHelper = new LoanProductTestHelper(selenium);
loanTestHelper = new LoanTestHelper(selenium);
customPropertiesHelper = new CustomPropertiesHelper(selenium);
}
use of org.mifos.test.acceptance.remote.DateTimeUpdaterRemoteTestingService in project head by mifos.
the class LoanProcessWithDifferentCurrencyTest method createLoanProductThenAccount.
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
@Test
public // http://mifosforge.jira.com/browse/MIFOSTEST-657
void createLoanProductThenAccount() throws Exception {
//Given
propertiesHelper.setAdditionalCurrenciesCode("EUR,USD");
DateTimeUpdaterRemoteTestingService dateTimeUpdaterRemoteTestingService = new DateTimeUpdaterRemoteTestingService(selenium);
DateTime targetTime = new DateTime(2011, 2, 17, 13, 0, 0, 0);
dateTimeUpdaterRemoteTestingService.setDateTime(targetTime);
initRemote.dataLoadAndCacheRefresh(dbUnitUtilities, "LoanProcessWithDifferentCurrencyTest_001_dbunit.xml", dataSource, selenium);
//When
propertiesHelper.setDigitsAfterDecimal(2);
AdminPage adminPage = navigationHelper.navigateToAdminPage();
ViewOrganizationSettingsPage viewOrganizationSettingsPage = adminPage.navigateToViewOrganizationSettingsPage();
viewOrganizationSettingsPage.verifyCurrencies(new String[] { "Currency: USD" });
viewOrganizationSettingsPage.verifyCurrencies(new String[] { "Currency: EUR" });
viewOrganizationSettingsPage.verifyCurrencies(new String[] { "Number of digits after decimal: 2" });
viewOrganizationSettingsPage.verifyCurrencies(new String[] { "Final Round Off Multiple: 1" });
viewOrganizationSettingsPage.verifyCurrencies(new String[] { "Initial Round Off Multiple: 1" });
//Then
FeesCreatePage.SubmitFormParameters formParameters = FormParametersHelper.getOneTimeLoanMultiCurrencyFeesParameters();
adminPage = navigationHelper.navigateToAdminPage();
formParameters.setFeeName("USDfee");
adminPage.defineNewFees(formParameters);
formParameters = FormParametersHelper.getOneTimeLoanMultiCurrencyFeesParameters();
adminPage = navigationHelper.navigateToAdminPage();
formParameters.setFeeName("USDfeeAdditional");
formParameters.setAmount(20.0);
adminPage.defineNewFees(formParameters);
createWeeklyLoanProduct();
String loanAccountId = createLoanAccountOfDifferentCurrency("Client-1-USD");
pendingApprovalToApplicationApproved(loanAccountId);
disburseLoan(loanAccountId);
applyPayment(loanAccountId);
navigationHelper.navigateToLoanAccountPage(loanAccountId);
//veryfy "USDfee"(10) and "USDfeeAdditional"(20)
Assert.assertEquals(selenium.getTable("loanSummaryTable.3.1"), "30");
//restore parameters
propertiesHelper.setDigitsAfterDecimal(1);
}
use of org.mifos.test.acceptance.remote.DateTimeUpdaterRemoteTestingService in project head by mifos.
the class ApplyChargeGroupLoanTest method applyMiscPenalty.
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void applyMiscPenalty() throws Exception {
DateTimeUpdaterRemoteTestingService dateTimeUpdaterRemoteTestingService = new DateTimeUpdaterRemoteTestingService(selenium);
DateTime targetTime = new DateTime(2013, 02, 8, 13, 0, 0, 0);
dateTimeUpdaterRemoteTestingService.setDateTime(targetTime);
CreateLoanAccountSearchParameters searchParameters = new CreateLoanAccountSearchParameters();
searchParameters.setSearchString("Default Group");
searchParameters.setLoanProduct("WeeklyGroupFlatLoanWithOnetimeFee");
List<GLIMClient> glimClients = new ArrayList<GLIMClient>();
glimClients.add(new GLIMClient(0, "Stu1233266299995 Client1233266299995 Client Id: 0002-000000012", "1500", null));
glimClients.add(new GLIMClient(2, "Stu1233266319760 Client1233266319760 Client Id: 0002-000000014", "1500", null));
LoanAccountPage loanAccountPage = loanTestHelper.createGroupLoanAccount(searchParameters, glimClients);
String loanId = loanAccountPage.getAccountId();
String penaltyAmount = "100";
List<String> individualPenaltyAmounts = new ArrayList<String>();
individualPenaltyAmounts.add("20");
individualPenaltyAmounts.add("80");
ChargeParameters params = new ChargeParameters();
params.setType(ChargeParameters.MISC_PENALTY);
params.setAmount(penaltyAmount);
params.setGroupLoanIndividualAmounts(individualPenaltyAmounts);
loanAccountPage = loanTestHelper.applyChargeToGroupLoan(loanId, params);
verifyPenaltySummaryAndActivity(loanAccountPage, penaltyAmount, "Misc penalty applied", 2);
verifyRepaymentSchedulePage(loanAccountPage, penaltyAmount);
for (int i = 0; i < glimClients.size(); i++) {
LoanAccountPage individualLoanAccountPage = loanAccountPage.navigateToIndividualLoanAccountPageFromPendingApprovalGroupLoan(i);
verifyPenaltySummaryAndActivity(individualLoanAccountPage, individualPenaltyAmounts.get(i), "Misc penalty applied", 2);
verifyRepaymentSchedulePage(individualLoanAccountPage, individualPenaltyAmounts.get(i));
individualLoanAccountPage.navigateToGroupLoanPageFromIndividualLoanPage();
}
}
Aggregations