Search in sources :

Example 1 with ViewPenaltyPage

use of org.mifos.test.acceptance.framework.admin.ViewPenaltyPage 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

EditPenaltyPreviewPage (org.mifos.test.acceptance.framework.admin.EditPenaltyPreviewPage)1 NewPenaltyPreviewPage (org.mifos.test.acceptance.framework.admin.NewPenaltyPreviewPage)1 PenaltyFormPage (org.mifos.test.acceptance.framework.admin.PenaltyFormPage)1 PenaltyFormParameters (org.mifos.test.acceptance.framework.admin.PenaltyFormParameters)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