Search in sources :

Example 1 with EditLoanProductPage

use of org.mifos.test.acceptance.framework.loanproduct.EditLoanProductPage in project head by mifos.

the class EditLoanProductTest method editExistingLoanProduct.

@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public // one of the dependent methods throws Exception
void editExistingLoanProduct() throws Exception {
    EditLoanProductPage editLoanProductPage = createNewLoanProductAndNavigateToEditLoanPage();
    editLoanProductPage.verifyPage();
    SubmitFormParameters formParameters = new SubmitFormParameters();
    formParameters.setDescription("Modified Description");
    formParameters.setMaxInterestRate("44");
    formParameters.setMinInterestRate("3");
    formParameters.setDefaultInterestRate("18");
    EditLoanProductPreviewPage editLoanProductPreviewPage = editLoanProductPage.submitDescriptionAndInterestChanges(formParameters);
    LoanProductDetailsPage loanProductDetailsPage = editLoanProductPreviewPage.submit();
    loanProductDetailsPage.verifyPage();
    loanProductDetailsPage.editLoanProduct();
    editLoanProductPage.verifyPage();
    editLoanProductPage.verifyModifiedDescriptionAndInterest(formParameters);
}
Also used : EditLoanProductPage(org.mifos.test.acceptance.framework.loanproduct.EditLoanProductPage) LoanProductDetailsPage(org.mifos.test.acceptance.framework.loanproduct.LoanProductDetailsPage) EditLoanProductPreviewPage(org.mifos.test.acceptance.framework.loanproduct.EditLoanProductPreviewPage) SubmitFormParameters(org.mifos.test.acceptance.framework.loanproduct.DefineNewLoanProductPage.SubmitFormParameters)

Example 2 with EditLoanProductPage

use of org.mifos.test.acceptance.framework.loanproduct.EditLoanProductPage in project head by mifos.

the class LoanProductTestHelper method editLoanProductIncludeInLoanCounter.

public void editLoanProductIncludeInLoanCounter(String loanProduct, boolean includeInLoanCounter) {
    EditLoanProductPage editLoanProductPage = navigationHelper.navigateToAdminPage().navigateToViewLoanProducts().viewLoanProductDetails(loanProduct).editLoanProduct();
    DefineNewLoanProductPage.SubmitFormParameters formParameters = new DefineNewLoanProductPage.SubmitFormParameters();
    formParameters.setIncludeInLoanCounter(includeInLoanCounter);
    editLoanProductPage.submitIncludeInLoanCounter(formParameters).submit();
}
Also used : EditLoanProductPage(org.mifos.test.acceptance.framework.loanproduct.EditLoanProductPage) DefineNewLoanProductPage(org.mifos.test.acceptance.framework.loanproduct.DefineNewLoanProductPage)

Example 3 with EditLoanProductPage

use of org.mifos.test.acceptance.framework.loanproduct.EditLoanProductPage in project head by mifos.

the class FeeTest method verifyAttachingFeeToLoanProduct.

//https://mifosforge.jira.com/browse/MIFOSTEST-1183
public void verifyAttachingFeeToLoanProduct() throws Exception {
    EditFeePage.SubmitFormParameters feesParameters = new EditFeePage.SubmitFormParameters();
    // Given
    try {
        feeTestHelper.createNoRateFee("OneTimeNoRateFee", FeesCreatePage.SubmitFormParameters.LOAN, "Upfront", 500);
        feeTestHelper.createFixedFee("OneTimeWithPercentageFee", FeesCreatePage.SubmitFormParameters.LOAN, "Upfront", 500, FeesCreatePage.SubmitFormParameters.LOAN_AMOUNT);
        feeTestHelper.createPeriodicFee("PeriodicTimeFee", FeesCreatePage.SubmitFormParameters.LOAN, FeesCreatePage.SubmitFormParameters.WEEKLY_FEE_RECURRENCE, 2, 500);
        feeTestHelper.createPeriodicRateFee("PeriodicTimeWithPercentageFee", FeesCreatePage.SubmitFormParameters.LOAN, FeesCreatePage.SubmitFormParameters.PERIODIC_FEE_FREQUENCY, 1, 10, FeesCreatePage.SubmitFormParameters.LOAN_AMOUNT);
        feesParameters.setStatus(EditFeePage.SubmitFormParameters.ACTIVE);
        feeTestHelper.editAndSubmitFeeWithParameters("OneTimeNoRateFee", feesParameters);
        feeTestHelper.editAndSubmitFeeWithParameters("OneTimeWithPercentageFee", feesParameters);
        feeTestHelper.editAndSubmitFeeWithParameters("PeriodicTimeFee", feesParameters);
        feeTestHelper.editAndSubmitFeeWithParameters("PeriodicTimeWithPercentageFee", feesParameters);
        DefineNewLoanProductPage.SubmitFormParameters productParams = FormParametersHelper.getWeeklyLoanProductParameters();
        productParams.setOfferingName("newLoanProductWith4Fees");
        productParams.setOfferingShortName("NLP");
        productParams.setDefaultInterestRate("15.3");
        productParams.setMaxInterestRate("50");
        productParams.setInterestTypes(DefineNewLoanProductPage.SubmitFormParameters.DECLINING_BALANCE);
        productParams.setDefaultLoanAmount("13333");
        productParams.setDefInstallments("13");
        productParams.setApplicableFor(DefineNewLoanProductPage.SubmitFormParameters.GROUPS);
        productParams.addFee("OneTimeNoRateFee");
        productParams.addFee("OneTimeWithPercentageFee");
        productParams.addFee("PeriodicTimeFee");
        productParams.addFee("PeriodicTimeWithPercentageFee");
        loanProductTestHelper.defineNewLoanProduct(productParams);
        //When
        String[] editableElements = { "amount", "feeStatus" };
        String[] nonEditableElements = { "feescreate.input.feeName", "feescreate.label.categoryType", "feescreate.button.feeFrequencyType", "feescreate.label.customerCharge", "feescreate.label.glCode" };
        navigationHelper.navigateToAdminPage().navigateToViewFeesPage().navigateToViewFeeDetailsPage("OneTimeNoRateFee").navigateToEditFeePage().verifyElementsArePresentAndEditable(editableElements).verifyAllElementsAreNotPresent(nonEditableElements);
        feesParameters.setAmount("19.9");
        feesParameters.setStatus(EditFeePage.SubmitFormParameters.INACTIVE);
        feeTestHelper.editAndSubmitFeeWithParameters("OneTimeNoRateFee", feesParameters);
        feeTestHelper.editAndSubmitFeeWithParameters("OneTimeWithPercentageFee", feesParameters);
        feeTestHelper.editAndSubmitFeeWithParameters("PeriodicTimeFee", feesParameters);
        feeTestHelper.editAndSubmitFeeWithParameters("PeriodicTimeWithPercentageFee", feesParameters);
        //Then
        EditLoanProductPage editLoanProductPage = loanProductTestHelper.navigateToViewLoanProductDetailsPage("newLoanProductWith4Fees").editLoanProduct();
        String[] fees = { "OneTimeNoRateFee", "OneTimeWithPercentageFee", "PeriodicTimeFee", "PeriodicTimeWithPercentageFee" };
        editLoanProductPage.verifyAllElementsAreNotPresent(fees);
        productParams.getFees().clear();
        productParams.setIncludeInLoanCounter(true);
        productParams.setFixedRepaymentSchedule(true);
        productParams.setDescription("Edited Loan product");
        editLoanProductPage.submitAndNavigateToEditLoanProductPreviewPage(productParams).submit();
        //When
        feesParameters.setStatus(EditFeePage.SubmitFormParameters.ACTIVE);
        feeTestHelper.editAndSubmitFeeWithParameters("OneTimeNoRateFee", feesParameters);
        feeTestHelper.editAndSubmitFeeWithParameters("PeriodicTimeWithPercentageFee", feesParameters);
        //Then
        editLoanProductPage = loanProductTestHelper.navigateToViewLoanProductDetailsPage("newLoanProductWith4Fees").editLoanProduct();
        editLoanProductPage.verifyAllElementsArePresent(new String[] { "OneTimeNoRateFee", "PeriodicTimeWithPercentageFee" });
        editLoanProductPage.verifyAllElementsAreNotPresent(new String[] { "OneTimeWithPercentageFee", "PeriodicTimeFee" });
    } finally {
        feesParameters.setStatus(EditFeePage.SubmitFormParameters.INACTIVE);
        feeTestHelper.editAndSubmitFeeWithParameters("OneTimeNoRateFee", feesParameters);
        feeTestHelper.editAndSubmitFeeWithParameters("PeriodicTimeWithPercentageFee", feesParameters);
        feeTestHelper.editAndSubmitFeeWithParameters("OneTimeNoRateFee", feesParameters);
        feeTestHelper.editAndSubmitFeeWithParameters("PeriodicTimeWithPercentageFee", feesParameters);
    }
}
Also used : EditLoanProductPage(org.mifos.test.acceptance.framework.loanproduct.EditLoanProductPage) DefineNewLoanProductPage(org.mifos.test.acceptance.framework.loanproduct.DefineNewLoanProductPage) EditFeePage(org.mifos.test.acceptance.framework.admin.EditFeePage)

Example 4 with EditLoanProductPage

use of org.mifos.test.acceptance.framework.loanproduct.EditLoanProductPage in project head by mifos.

the class LoanTestHelper method enableInterestWaiver.

public void enableInterestWaiver(String loanProduct, boolean interestWaiver) {
    AdminPage adminPage = navigationHelper.navigateToAdminPage();
    ViewLoanProductsPage viewLoanProducts = adminPage.navigateToViewLoanProducts();
    LoanProductDetailsPage loanProductDetailsPage = viewLoanProducts.viewLoanProductDetails(loanProduct);
    EditLoanProductPage editLoanProductPage = loanProductDetailsPage.editLoanProduct();
    DefineNewLoanProductPage.SubmitFormParameters formParameters = new DefineNewLoanProductPage.SubmitFormParameters();
    formParameters.setInterestWaiver(interestWaiver);
    EditLoanProductPreviewPage editLoanProductPreviewPage = editLoanProductPage.submitInterestWaiverChanges(formParameters);
    editLoanProductPreviewPage.submit();
}
Also used : EditLoanProductPage(org.mifos.test.acceptance.framework.loanproduct.EditLoanProductPage) ViewLoanProductsPage(org.mifos.test.acceptance.framework.loanproduct.ViewLoanProductsPage) AdminPage(org.mifos.test.acceptance.framework.admin.AdminPage) LoanProductDetailsPage(org.mifos.test.acceptance.framework.loanproduct.LoanProductDetailsPage) EditLoanProductPreviewPage(org.mifos.test.acceptance.framework.loanproduct.EditLoanProductPreviewPage) DefineNewLoanProductPage(org.mifos.test.acceptance.framework.loanproduct.DefineNewLoanProductPage)

Example 5 with EditLoanProductPage

use of org.mifos.test.acceptance.framework.loanproduct.EditLoanProductPage 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());
}
Also used : DisburseLoanParameters(org.mifos.test.acceptance.framework.loan.DisburseLoanParameters) CreateLoanAccountSearchParameters(org.mifos.test.acceptance.framework.loan.CreateLoanAccountSearchParameters) AdminPage(org.mifos.test.acceptance.framework.admin.AdminPage) EditLoanProductPreviewPage(org.mifos.test.acceptance.framework.loanproduct.EditLoanProductPreviewPage) DateTime(org.joda.time.DateTime) DefineNewLoanProductPreviewPage(org.mifos.test.acceptance.framework.loanproduct.DefineNewLoanProductPreviewPage) EditLoanProductPage(org.mifos.test.acceptance.framework.loanproduct.EditLoanProductPage) SubmitFormParameters(org.mifos.test.acceptance.framework.loanproduct.DefineNewLoanProductPage.SubmitFormParameters) NavigationHelper(org.mifos.test.acceptance.framework.testhelpers.NavigationHelper) LoanProductDetailsPage(org.mifos.test.acceptance.framework.loanproduct.LoanProductDetailsPage) DefineNewLoanProductPage(org.mifos.test.acceptance.framework.loanproduct.DefineNewLoanProductPage) RepayLoanPage(org.mifos.test.acceptance.framework.loan.RepayLoanPage) LoanAccountPage(org.mifos.test.acceptance.framework.loan.LoanAccountPage) DateTimeUpdaterRemoteTestingService(org.mifos.test.acceptance.remote.DateTimeUpdaterRemoteTestingService) RepayLoanParameters(org.mifos.test.acceptance.framework.loan.RepayLoanParameters) LoanTestHelper(org.mifos.test.acceptance.framework.testhelpers.LoanTestHelper) Test(org.testng.annotations.Test)

Aggregations

EditLoanProductPage (org.mifos.test.acceptance.framework.loanproduct.EditLoanProductPage)8 DefineNewLoanProductPage (org.mifos.test.acceptance.framework.loanproduct.DefineNewLoanProductPage)6 EditLoanProductPreviewPage (org.mifos.test.acceptance.framework.loanproduct.EditLoanProductPreviewPage)6 LoanProductDetailsPage (org.mifos.test.acceptance.framework.loanproduct.LoanProductDetailsPage)6 AdminPage (org.mifos.test.acceptance.framework.admin.AdminPage)4 SubmitFormParameters (org.mifos.test.acceptance.framework.loanproduct.DefineNewLoanProductPage.SubmitFormParameters)3 ViewLoanProductsPage (org.mifos.test.acceptance.framework.loanproduct.ViewLoanProductsPage)3 DateTime (org.joda.time.DateTime)2 DateTimeUpdaterRemoteTestingService (org.mifos.test.acceptance.remote.DateTimeUpdaterRemoteTestingService)2 EditFeePage (org.mifos.test.acceptance.framework.admin.EditFeePage)1 CreateLoanAccountSearchParameters (org.mifos.test.acceptance.framework.loan.CreateLoanAccountSearchParameters)1 DisburseLoanParameters (org.mifos.test.acceptance.framework.loan.DisburseLoanParameters)1 LoanAccountPage (org.mifos.test.acceptance.framework.loan.LoanAccountPage)1 RepayLoanPage (org.mifos.test.acceptance.framework.loan.RepayLoanPage)1 RepayLoanParameters (org.mifos.test.acceptance.framework.loan.RepayLoanParameters)1 DefineNewLoanProductPreviewPage (org.mifos.test.acceptance.framework.loanproduct.DefineNewLoanProductPreviewPage)1 DefineNewSavingsProductConfirmationPage (org.mifos.test.acceptance.framework.savingsproduct.DefineNewSavingsProductConfirmationPage)1 DefineNewSavingsProductPage (org.mifos.test.acceptance.framework.savingsproduct.DefineNewSavingsProductPage)1 EditSavingsProductPage (org.mifos.test.acceptance.framework.savingsproduct.EditSavingsProductPage)1 EditSavingsProductPreviewPage (org.mifos.test.acceptance.framework.savingsproduct.EditSavingsProductPreviewPage)1