use of org.mifos.test.acceptance.framework.admin.EditPenaltyPreviewPage in project head by mifos.
the class MainPenaltyTest method fillFormAndGotoPreviewPage.
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
private MifosPage fillFormAndGotoPreviewPage(final PenaltyFormPage penaltyFormPage, final PenaltyFormParameters parameters, final int i, final boolean isCreatePage) throws Exception {
parameters.setFrequency(PenaltyFormParameters.FREQUENCY_DAILY);
parameters.setGlCode("31102 - Penalty");
parameters.setDuration("1");
parameters.setMax("15");
parameters.setMin("1");
if (i == 0) {
parameters.setName(AMOUNT_PENALTY_NAME);
parameters.setApplies(PenaltyFormParameters.APPLIES_SAVINGS);
parameters.setPeriod(PenaltyFormParameters.PERIOD_DAYS);
parameters.setAmount("2200.5");
parameters.setRate("");
} else if (i == 1) {
parameters.setName(RATE_PENALTY_NAME);
parameters.setApplies(PenaltyFormParameters.APPLIES_LOANS);
parameters.setPeriod(PenaltyFormParameters.PERIOD_INSTALLMENTS);
parameters.setRate("7.5");
parameters.setFormula(PenaltyFormParameters.FORMULA_OUTSTANDING_LOAN);
parameters.setAmount("");
}
MifosPage previewPage = null;
if (isCreatePage) {
previewPage = penaltyFormPage.fillParameters(parameters).submitPageAndGotoPenaltyPreviewPage(NewPenaltyPreviewPage.class);
((NewPenaltyPreviewPage) previewPage).verifyData(parameters);
} else {
parameters.setStatus(PenaltyFormParameters.STATUS_INACTIVE);
previewPage = penaltyFormPage.fillParameters(parameters).submitPageAndGotoPenaltyPreviewPage(EditPenaltyPreviewPage.class);
((EditPenaltyPreviewPage) previewPage).verifyData(parameters);
}
return previewPage;
}
use of org.mifos.test.acceptance.framework.admin.EditPenaltyPreviewPage 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