use of org.mifos.test.acceptance.framework.admin.ViewPenaltiesPage 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);
}
Aggregations