use of org.mifos.test.acceptance.framework.admin.ImportLoansSaveSummaryPage in project head by mifos.
the class LoanImportTest method verifyImportLoanAccountsToClient.
/**
* MIFOS-5662: Add the possibility to import new Loans data.
* Test loads basic xls spreadsheet and test for rows parsed with errors. Then submits successfully parsed rows.
* Accounts are imported to client.
*/
private void verifyImportLoanAccountsToClient(int loanRecurrenceTypeId, boolean enableLSIM, int[] skipErrorLineIndices) throws Exception {
initRemote.dataLoadAndCacheRefresh(dbUnitUtilities, "acceptance_dbunit.xml", dataSource, selenium);
//changing date so dates in xls spreadsheet will be appropriate
targetTime = new DateTime(2012, 6, 22, 12, 0, 0, 0);
DateTimeUpdaterRemoteTestingService dtUpdate = new DateTimeUpdaterRemoteTestingService(selenium);
dtUpdate.setDateTime(targetTime);
applicationDatabaseOperation.updateLSIM((enableLSIM) ? 1 : 0);
ManageRolePage manageRolePage = navigationHelper.navigateToAdminPage().navigateToViewRolesPage().navigateToManageRolePage("Admin");
try {
manageRolePage.enablePermission("8_7");
} catch (AssertionError ex) {
Logger.getAnonymousLogger().info("Permission is marked.");
}
manageRolePage.submitAndGotoViewRolesPage();
if (!valuesDefined) {
valuesDefined = defineValuesForProducts();
}
String succesNumber = "1";
String errorNumber = Integer.toString(27 - skipErrorLineIndices.length);
String testID = "TID1";
arrayOfErrors = buildArrayOfErrorsForImportLoanTest(testID, skipErrorLineIndices);
SubmitFormParameters parameters = loanProductTestHelper.defineLoanProductParameters(10, 100, 1, 1, loanRecurrenceTypeId);
parameters.setOfferingName(productForClient);
parameters.setMinLoanAmount("5");
parameters.setMaxLoanAmount("1000");
parameters.setMinInterestRate("1");
parameters.setMaxInterestRate("50");
parameters.setMinInstallemnts("2");
parameters.setMaxInstallments("50");
parameters.setGracePeriodType(SubmitFormParameters.GRACE_ON_ALL_REPAYMENTS);
parameters.setGracePeriodDuration("10");
try {
loanProductTestHelper.defineNewLoanProduct(parameters);
} catch (AssertionError ae) {
Logger.getAnonymousLogger().info("Product exists");
}
String importFile = this.getClass().getResource("/ImportLoanAccountsTest.xls").toString();
ImportLoansReviewPage reviewPage = adminTestHelper.loadImportLoansFileAndSubmitForReview(importFile);
reviewPage.validateErrors(arrayOfErrors);
reviewPage.validateSuccesText(succesNumber);
ImportLoansSaveSummaryPage summaryPage = reviewPage.saveSuccessfullRows();
summaryPage.verifySuccesString(succesNumber);
summaryPage.verifyErrorStroing(errorNumber);
valuesDefined = false;
}
Aggregations