Search in sources :

Example 1 with PenaltyFormParameters

use of org.mifos.test.acceptance.framework.admin.PenaltyFormParameters in project head by mifos.

the class PenaltyHelper method editAmountPenalty.

public void editAmountPenalty(final String oldName, final String newName, final String period, final String duration, final String frequency, final String min, final String max, final String amount) throws Exception {
    final PenaltyFormParameters param = createPenalty(newName, period, duration, frequency, min, max);
    param.setAmount(amount);
    navigationHelper.navigateToAdminPage().navigateToViewPenaltiesPage().navigateToViewPenaltyPage(oldName).navigateToEditPenaltyPage().fillParameters(param).submitPageAndGotoPenaltyPreviewPage(EditPenaltyPreviewPage.class).submit();
}
Also used : PenaltyFormParameters(org.mifos.test.acceptance.framework.admin.PenaltyFormParameters) EditPenaltyPreviewPage(org.mifos.test.acceptance.framework.admin.EditPenaltyPreviewPage)

Example 2 with PenaltyFormParameters

use of org.mifos.test.acceptance.framework.admin.PenaltyFormParameters in project head by mifos.

the class PenaltyHelper method createPenalty.

private PenaltyFormParameters createPenalty(final String name, final String period, final String duration, final String frequency, final String min, final String max) {
    final PenaltyFormParameters param = new PenaltyFormParameters();
    param.setName(name);
    param.setApplies(PenaltyFormParameters.APPLIES_LOANS);
    param.setPeriod(period);
    param.setDuration(duration);
    param.setMin(min);
    param.setMax(max);
    param.setFrequency(frequency);
    param.setGlCode("31102 - Penalty");
    return param;
}
Also used : PenaltyFormParameters(org.mifos.test.acceptance.framework.admin.PenaltyFormParameters)

Example 3 with PenaltyFormParameters

use of org.mifos.test.acceptance.framework.admin.PenaltyFormParameters in project head by mifos.

the class PenaltyHelper method createRatePenalty.

public void createRatePenalty(String name, String period, String duration, String frequency, String rate, String formula, final String min, final String max) throws Exception {
    final PenaltyFormParameters param = createPenalty(name, period, duration, frequency, min, max);
    param.setRate(rate);
    param.setFormula(formula);
    navigationHelper.navigateToAdminPage().navigateToDefineNewPenaltyPage().fillParameters(param).submitPageAndGotoPenaltyPreviewPage(NewPenaltyPreviewPage.class).submit();
}
Also used : NewPenaltyPreviewPage(org.mifos.test.acceptance.framework.admin.NewPenaltyPreviewPage) PenaltyFormParameters(org.mifos.test.acceptance.framework.admin.PenaltyFormParameters)

Example 4 with PenaltyFormParameters

use of org.mifos.test.acceptance.framework.admin.PenaltyFormParameters in project head by mifos.

the class PenaltyHelper method createAmountPenalty.

public void createAmountPenalty(final String name, final String period, final String duration, final String frequency, final String min, final String max, final String amount) throws Exception {
    final PenaltyFormParameters param = createPenalty(name, period, duration, frequency, min, max);
    param.setAmount(amount);
    navigationHelper.navigateToAdminPage().navigateToDefineNewPenaltyPage().fillParameters(param).submitPageAndGotoPenaltyPreviewPage(NewPenaltyPreviewPage.class).submit();
}
Also used : NewPenaltyPreviewPage(org.mifos.test.acceptance.framework.admin.NewPenaltyPreviewPage) PenaltyFormParameters(org.mifos.test.acceptance.framework.admin.PenaltyFormParameters)

Example 5 with PenaltyFormParameters

use of org.mifos.test.acceptance.framework.admin.PenaltyFormParameters in project head by mifos.

the class MainPenaltyTest method verifyCreateAndEditPenalty.

@Test(enabled = true)
public void verifyCreateAndEditPenalty() throws Exception {
    final PenaltyFormParameters param = new PenaltyFormParameters();
    ViewPenaltiesPage penaltiesPage = navigationHelper.navigateToAdminPage().navigateToViewPenaltiesPage();
    int startLoanPenaltyCount = penaltiesPage.getLoanPenaltiesCount();
    int startSavingsPenaltyCount = penaltiesPage.getSavingPenaltiesCount();
    for (int i = 0; i < 2; ++i) {
        category = "";
        penaltiesPage.verifyLoanPenaltiesCount(startLoanPenaltyCount);
        penaltiesPage.verifySavingPenaltiesCount(startSavingsPenaltyCount + i);
        PenaltyFormPage newPenaltyPage = penaltiesPage.navigateToDefineNewPenaltyPage();
        for (int j = 0; j < 2; ++j) {
            verifyErrorsWithEmptyForm(newPenaltyPage, param, CREATE_PAGE);
            verifyErrorsWithoutSelectFrequency(newPenaltyPage, param, CREATE_PAGE);
            verifyErrorsWithIncorrectValue(newPenaltyPage, param, CREATE_PAGE);
            verifyErrorsWithMinGreaterThanMax(newPenaltyPage, param, CREATE_PAGE);
            verifyErrorsForLoanPenaltyWithoutAmount(newPenaltyPage, param, CREATE_PAGE);
            verifyErrorsForLoanPenaltyWithIncorrectRate(newPenaltyPage, param);
            verifyErrorsForLoanPenaltyWithoutFormula(newPenaltyPage, param);
            final NewPenaltyPreviewPage newPreviewPage = (NewPenaltyPreviewPage) fillFormAndGotoPreviewPage(newPenaltyPage, param, i, CREATE_PAGE);
            if (j == 0) {
                newPenaltyPage = newPreviewPage.navigateToEditPenaltyInformationPage();
            } else if (j == 1) {
                penaltiesPage = newPreviewPage.submit().navigateToViewPenaltiesPage();
            }
        }
        ViewPenaltyPage penaltyPage = null;
        if (i == 0) {
            penaltiesPage.verifyLoanPenaltiesCount(startLoanPenaltyCount);
            penaltiesPage.verifySavingPenaltiesCount(startSavingsPenaltyCount + 1);
            penaltyPage = penaltiesPage.navigateToViewPenaltyPage(AMOUNT_PENALTY_NAME);
        } else if (i == 1) {
            penaltiesPage.verifyLoanPenaltiesCount(startLoanPenaltyCount + 1);
            penaltiesPage.verifySavingPenaltiesCount(startSavingsPenaltyCount + 1);
            penaltyPage = penaltiesPage.navigateToViewPenaltyPage(RATE_PENALTY_NAME);
        }
        penaltyPage.verifyData(createData(param, i));
        final PenaltyFormPage editPenaltyPage = penaltyPage.navigateToEditPenaltyPage();
        category = param.getApplies();
        for (int j = 0; j < 2; ++j) {
            verifyErrorsWithEmptyForm(editPenaltyPage, param, EDIT_PAGE);
            verifyErrorsWithoutSelectFrequency(editPenaltyPage, param, EDIT_PAGE);
            verifyErrorsWithIncorrectValue(editPenaltyPage, param, EDIT_PAGE);
            verifyErrorsWithMinGreaterThanMax(editPenaltyPage, param, EDIT_PAGE);
            if (i == 0) {
                verifyErrorsForLoanPenaltyWithoutAmount(newPenaltyPage, param, EDIT_PAGE);
            } else {
                verifyErrorsForLoanPenaltyWithIncorrectRate(editPenaltyPage, param);
                verifyErrorsForLoanPenaltyWithoutFormula(editPenaltyPage, param);
            }
            final EditPenaltyPreviewPage editPreviewPage = (EditPenaltyPreviewPage) fillFormAndGotoPreviewPage(editPenaltyPage, param, i, EDIT_PAGE);
            if (j == 0) {
                newPenaltyPage = editPreviewPage.navigateToEditPenaltyInformationPage();
            } else if (j == 1) {
                penaltyPage = editPreviewPage.submit();
            }
        }
        penaltyPage.verifyData(createData(param, i));
        penaltiesPage = navigationHelper.navigateToAdminPage().navigateToViewPenaltiesPage();
    }
    penaltiesPage = navigationHelper.navigateToAdminPage().navigateToViewPenaltiesPage();
    penaltiesPage.verifyLoanPenaltiesCount(startLoanPenaltyCount + 1);
    penaltiesPage.verifySavingPenaltiesCount(startSavingsPenaltyCount + 1);
    penaltiesPage.verifyInActivePenaltyLabel(2);
    penaltiesPage.verifyInActivePenaltyLabel(4);
}
Also used : PenaltyFormPage(org.mifos.test.acceptance.framework.admin.PenaltyFormPage) NewPenaltyPreviewPage(org.mifos.test.acceptance.framework.admin.NewPenaltyPreviewPage) PenaltyFormParameters(org.mifos.test.acceptance.framework.admin.PenaltyFormParameters) ViewPenaltyPage(org.mifos.test.acceptance.framework.admin.ViewPenaltyPage) ViewPenaltiesPage(org.mifos.test.acceptance.framework.admin.ViewPenaltiesPage) EditPenaltyPreviewPage(org.mifos.test.acceptance.framework.admin.EditPenaltyPreviewPage) Test(org.testng.annotations.Test)

Aggregations

PenaltyFormParameters (org.mifos.test.acceptance.framework.admin.PenaltyFormParameters)5 NewPenaltyPreviewPage (org.mifos.test.acceptance.framework.admin.NewPenaltyPreviewPage)3 EditPenaltyPreviewPage (org.mifos.test.acceptance.framework.admin.EditPenaltyPreviewPage)2 PenaltyFormPage (org.mifos.test.acceptance.framework.admin.PenaltyFormPage)1 ViewPenaltiesPage (org.mifos.test.acceptance.framework.admin.ViewPenaltiesPage)1 ViewPenaltyPage (org.mifos.test.acceptance.framework.admin.ViewPenaltyPage)1 Test (org.testng.annotations.Test)1