@SuppressWarnings("PMD.SignatureDeclareThrowsException") // http://mifosforge.jira.com/browse/MIFOSTEST-200 @Test public void changeDigitsAfterDecimal() throws Exception { propertiesHelper.setDigitsAfterDecimal(3); LoanAccountPage loanAccountPage = navigationHelper.navigateToLoanAccountPage("000100000000015"); loanAccountPage.verifyExactLoanAmount("1,000"); propertiesHelper.setDigitsAfterDecimal(2); loanAccountPage = navigationHelper.navigateToLoanAccountPage("000100000000015"); loanAccountPage.verifyExactLoanAmount("1,000"); propertiesHelper.setDigitsAfterDecimal(0); loanAccountPage = navigationHelper.navigateToLoanAccountPage("000100000000015"); loanAccountPage.verifyExactLoanAmount("1,000"); propertiesHelper.setDigitsAfterDecimal(1); loanAccountPage = navigationHelper.navigateToLoanAccountPage("000100000000015"); loanAccountPage.verifyExactLoanAmount("1,000"); }
/** * MPESA - Import has expected errors due to invalid data and overpayment amount and user is not * able to continue http://mifosforge.jira.com/browse/MIFOSTEST-692 * * @throws Exception */ @SuppressWarnings("PMD.SignatureDeclareThrowsException") @Test(enabled = true) public void failImportTransaction() throws Exception { // Given String path = this.getClass().getResource("/mpesa/" + FILE_WITH_OVERPAYMENT_AMOUNT).toString(); String dataset = "mpesa_export_dbunit.xml"; initRemote.dataLoadAndCacheRefresh(dbUnitUtilities, dataset, dataSource, selenium); propertiesHelper.setImportTransactionOrder("AL3,AL5"); SavingsAccountHelper savingsAccountHelper = new SavingsAccountHelper(selenium); savingsAccountHelper.closeSavingsAccount("000100000000019", "Close account"); // When ImportTransactionsPage importTransactionsPage = importTransaction(path); importTransactionsPage.checkErrors( new String[] { "Row <24> error - THY89933" + " - Last account is a loan account but the total paid in amount" + " is greater than the total due amount" }); // Then LoanAccountPage loanAccountPage = navigationHelper.navigateToLoanAccountPage("000100000000013"); loanAccountPage.verifyStatus(LoanAccountPage.ACTIVE); loanAccountPage.verifyExactLoanAmount("2,000"); TransactionHistoryPage transactionHistoryPage = loanAccountPage.navigateToTransactionHistoryPage(); transactionHistoryPage.verifyTransactionHistory(183, 1, 6); }
/** * MPESA - Import has errors and user chooses to import a different file with some valid and * invalid data. http://mifosforge.jira.com/browse/MIFOSTEST-695 * * @throws Exception */ @SuppressWarnings("PMD.SignatureDeclareThrowsException") @Test(enabled = true) public void importTheSameFiles() throws Exception { // Given DateTimeUpdaterRemoteTestingService dateTimeUpdaterRemoteTestingService = new DateTimeUpdaterRemoteTestingService(selenium); DateTime targetTime = new DateTime(2011, 01, 28, 12, 0, 0, 0); dateTimeUpdaterRemoteTestingService.setDateTime(targetTime); String path = this.getClass().getResource("/mpesa/" + FILE_WITH_NO_ERRORS).toString(); String dataset = "mpesa_export_dbunit.xml"; initRemote.dataLoadAndCacheRefresh(dbUnitUtilities, dataset, dataSource, selenium); propertiesHelper.setImportTransactionOrder("AL3,AL5"); // When AdminPage adminPage = navigationHelper.navigateToAdminPage(); ImportTransactionsPage importTransactionsPage = adminPage.navigateToImportTransactionsPage(); ImportTransactionsConfirmationPage importTransactionsConfirmationPage = importTransactionsPage.importTransactions(path, EXCEL_IMPORT_TYPE); // Then importTransactionsConfirmationPage.verifyImportSuccess( "You have successfully imported transactions."); LoanAccountPage loanAccountPage = navigationHelper.navigateToLoanAccountPage("000100000000013"); loanAccountPage.verifyStatus(LoanAccountPage.CLOSED); ViewRepaymentSchedulePage viewRepaymentSchedulePage = loanAccountPage.navigateToRepaymentSchedulePage(); viewRepaymentSchedulePage.verifyFirstInstallmentDate(5, 3, "28-Jan-2011"); loanAccountPage = viewRepaymentSchedulePage.navigateToLoanAccountPage(); loanAccountPage.verifyPerformanceHistory("11", "11"); TransactionHistoryPage transactionHistoryPage = loanAccountPage.navigateToTransactionHistoryPage(); transactionHistoryPage.verifyTransactionHistory(2013, 2, 48); transactionHistoryPage.verifyPostedBy("mifos", 48); SavingsAccountDetailPage savingsAccountDetailPage = navigationHelper.navigateToSavingsAccountDetailPage("000100000000015"); savingsAccountDetailPage.verifySavingsAmount("3170.0"); savingsAccountDetailPage.verifyDate("28/01/2011"); // When adminPage = navigationHelper.navigateToAdminPage(); importTransactionsPage = adminPage.navigateToImportTransactionsPage(); importTransactionsPage = importTransactionsPage.failImportTransaction(path, EXCEL_IMPORT_TYPE); // Then importTransactionsPage.checkErrors( new String[] {"Same file has been already imported. Please import a different file."}); }
/* * FIXME - keithw - test passes when run individually but not as part of ci build. it appears that question groups data is not * cleaned up right as instead of stepping to review installments, the questionnaire page is presented. */ @SuppressWarnings("PMD.SignatureDeclareThrowsException") // http://mifosforge.jira.com/browse/MIFOSTEST-215 @Test(enabled = true) public void verifyPropertyPendingApprovalStateEnabledForSavingsAndLoanAccounts() throws Exception { // Given propertiesHelper.setSavingsPendingApprovalStateEnabled("true"); propertiesHelper.setLoanPendingApprovalStateEnabled("true"); propertiesHelper.setGroupPendingApprovalStateEnabled("true"); // When CreateSavingsAccountSearchParameters searchParameters = new CreateSavingsAccountSearchParameters(); searchParameters.setSearchString("UpdateCustomProperties TestClient"); searchParameters.setSavingsProduct("MonthlyClientSavingsAccount"); CreateSavingsAccountSubmitParameters submitAccountParameters = new CreateSavingsAccountSubmitParameters(); submitAccountParameters.setAmount("248.0"); SavingsAccountDetailPage savingsAccountPage = savingsAccountHelper.createSavingsAccount(searchParameters, submitAccountParameters); savingsAccountPage.verifyPage(); // Then savingsAccountPage.verifySavingsAmount(submitAccountParameters.getAmount()); savingsAccountPage.verifySavingsProduct(searchParameters.getSavingsProduct()); savingsAccountPage.verifyStatus("Application Pending Approval"); // when CreateLoanAccountSearchParameters searchParameters2 = new CreateLoanAccountSearchParameters(); searchParameters2.setSearchString("UpdateCustomProperties TestClient"); searchParameters2.setLoanProduct("ClientEmergencyLoan"); CreateLoanAccountSubmitParameters submitAccountParameters2 = new CreateLoanAccountSubmitParameters(); submitAccountParameters2.setAmount("2765.0"); submitAccountParameters2.setGracePeriodTypeNone(true); LoanTestHelper loanTestHelper = new LoanTestHelper(selenium); LoanAccountPage loanAccountPage = loanTestHelper.createLoanAccount(searchParameters2, submitAccountParameters2); loanAccountPage.verifyStatus("Application Pending Approval"); }
/** * MPESA - Import transactions from file with no errors * http://mifosforge.jira.com/browse/MIFOSTEST-688 * * @throws Exception */ @SuppressWarnings({"PMD.SignatureDeclareThrowsException", "PMD.SystemPrintln"}) @Test(enabled = true) public void importTransactionsFromFileWithNoErrors() throws Exception { DateTimeUpdaterRemoteTestingService dateTimeUpdaterRemoteTestingService = new DateTimeUpdaterRemoteTestingService(selenium); DateTime targetTime = new DateTime(2011, 01, 28, 12, 0, 0, 0); dateTimeUpdaterRemoteTestingService.setDateTime(targetTime); AdminPage adminPage = navigationHelper.navigateToAdminPage(); ViewRolesPage viewRolesPage = adminPage.navigateToViewRolesPage(); ManageRolePage manageRolePage = viewRolesPage.navigateToManageRolePage("Admin"); manageRolePage.disablePermission("8_3"); viewRolesPage = manageRolePage.submitAndGotoViewRolesPage(); adminPage = viewRolesPage.navigateToAdminPage(); adminPage = adminPage.failNavigationToImportTransactionsPage(); adminPage.verifyError( "You do not have permissions to perform " + "this activity. Contact your system administrator " + "to grant you the required permissions and try again."); viewRolesPage = adminPage.navigateToViewRolesPage(); manageRolePage = viewRolesPage.navigateToManageRolePage("Admin"); manageRolePage.enablePermission("8_3"); viewRolesPage = manageRolePage.submitAndGotoViewRolesPage(); propertiesHelper.setImportTransactionOrder("AL3,AL5"); String dataset = "mpesa_export_dbunit.xml"; initRemote.dataLoadAndCacheRefresh(dbUnitUtilities, dataset, dataSource, selenium); String path = this.getClass().getResource("/mpesa/" + FILE_WITH_NO_ERRORS).toString(); ImportTransactionsPage importTransactionsPage = importTransaction(path); checkIfOutputMatchesExpected(path); importTransactionsPage.cancelImportTransaction(); LoanAccountPage loanAccountPage = navigationHelper.navigateToLoanAccountPage("000100000000013"); loanAccountPage.verifyStatus(LoanAccountPage.ACTIVE); loanAccountPage.verifyExactLoanAmount("2,000"); SavingsAccountDetailPage savingsAccountDetailPage = navigationHelper.navigateToSavingsAccountDetailPage("000100000000015"); savingsAccountDetailPage.verifySavingsAmount("0"); adminPage = navigationHelper.navigateToAdminPage(); importTransactionsPage = adminPage.navigateToImportTransactionsPage(); ImportTransactionsConfirmationPage importTransactionsConfirmationPage = importTransactionsPage.importTransactions(path, EXCEL_IMPORT_TYPE); importTransactionsConfirmationPage.verifyImportSuccess( "You have successfully imported transactions."); loanAccountPage = navigationHelper.navigateToLoanAccountPage("000100000000013"); loanAccountPage.verifyStatus(LoanAccountPage.CLOSED); ViewRepaymentSchedulePage viewRepaymentSchedulePage = loanAccountPage.navigateToRepaymentSchedulePage(); viewRepaymentSchedulePage.verifyFirstInstallmentDate(5, 3, "28-Jan-2011"); loanAccountPage = viewRepaymentSchedulePage.navigateToLoanAccountPage(); loanAccountPage.verifyPerformanceHistory("11", "11"); TransactionHistoryPage transactionHistoryPage = loanAccountPage.navigateToTransactionHistoryPage(); transactionHistoryPage.verifyTransactionHistory(2013, 2, 48); transactionHistoryPage.verifyPostedBy("mifos", 48); savingsAccountDetailPage = navigationHelper.navigateToSavingsAccountDetailPage("000100000000015"); savingsAccountDetailPage.verifySavingsAmount("3170.0"); savingsAccountDetailPage.verifyDate("28/01/2011"); }
// http://mifosforge.jira.com/browse/MIFOSTEST-710 @Test(enabled = true) @SuppressWarnings("PMD.SignatureDeclareThrowsException") public void verifyWaiveInterestForLoanAccount() throws Exception { // Given DateTimeUpdaterRemoteTestingService dateTimeUpdaterRemoteTestingService = new DateTimeUpdaterRemoteTestingService(selenium); DateTime systemDateTime = new DateTime(2011, 3, 7, 12, 0, 0, 0); dateTimeUpdaterRemoteTestingService.setDateTime(systemDateTime); // When DefineNewLoanProductPage.SubmitFormParameters formParameters = FormParametersHelper.getWeeklyLoanProductParameters(); formParameters.setInterestWaiver(true); NavigationHelper navigationHelper = new NavigationHelper(selenium); AdminPage adminPage = navigationHelper.navigateToAdminPage(); DefineNewLoanProductPage newLoanProductPage = adminPage.navigateToDefineLoanProduct(); newLoanProductPage.fillLoanParameters(formParameters); DefineNewLoanProductPreviewPage previewPage = newLoanProductPage.submitAndGotoNewLoanProductPreviewPage(); // Then Assert.assertTrue(selenium.isTextPresent("Can waive interest on repay loan: Yes")); Assert.assertTrue(selenium.isTextPresent("Interest: 31102")); Assert.assertTrue(selenium.isTextPresent("Principal: 1506")); // When LoanProductDetailsPage loanProductDetailsPage = previewPage.submit().navigateToViewLoanDetailsPage(); // Then Assert.assertTrue(selenium.isTextPresent("Can waive interest on repay loan: Yes")); // When EditLoanProductPage editLoanProductPage = loanProductDetailsPage.editLoanProduct(); // Then Assert.assertTrue(selenium.isChecked("EditLoanProduct.input.includeInterestWaiver")); // When EditLoanProductPreviewPage editLoanProductPreviewPage = editLoanProductPage.editSubmit(); // Then Assert.assertTrue(selenium.isTextPresent("Can waive interest on repay loan: Yes")); // When loanProductDetailsPage = editLoanProductPreviewPage.submit(); // Then Assert.assertTrue(selenium.isTextPresent("Can waive interest on repay loan: Yes")); // When CreateLoanAccountSearchParameters searchParameters = new CreateLoanAccountSearchParameters(); searchParameters.setSearchString("WeeklyClient Monday"); searchParameters.setLoanProduct(formParameters.getOfferingName()); LoanTestHelper loanTestHelper = new LoanTestHelper(selenium); LoanAccountPage loanAccountPage = loanTestHelper.createAndActivateDefaultLoanAccount(searchParameters); DisburseLoanParameters disburseParameters = new DisburseLoanParameters(); disburseParameters.setDisbursalDateDD(Integer.toString(systemDateTime.getDayOfMonth())); disburseParameters.setDisbursalDateMM(Integer.toString(systemDateTime.getMonthOfYear())); disburseParameters.setDisbursalDateYYYY(Integer.toString(systemDateTime.getYear())); disburseParameters.setPaymentType(PaymentParameters.CASH); loanAccountPage .navigateToDisburseLoan() .submitAndNavigateToDisburseLoanConfirmationPage(disburseParameters) .submitAndNavigateToLoanAccountPage(); RepayLoanPage repayLoanPage = loanAccountPage.navigateToRepayLoan(); // Then Assert.assertTrue(selenium.isChecked("waiverInterestChckBox")); Assert.assertEquals( "Note: Interest due will be waived off.", selenium.getText("waiverInterestWarning")); Assert.assertFalse(repayLoanPage.isTotalRepaymentAmountVisible()); Assert.assertTrue(repayLoanPage.isWaivedRepaymentAmoutVisible()); Assert.assertEquals(repayLoanPage.waivedRepaymentAmount(), "2,500"); // When repayLoanPage.interestWaiver(false); // Then Assert.assertTrue(repayLoanPage.isTotalRepaymentAmountVisible()); Assert.assertFalse(repayLoanPage.isWaivedRepaymentAmoutVisible()); Assert.assertFalse(selenium.isTextPresent("Note: Interest due will be waived off.")); Assert.assertEquals(repayLoanPage.totalRepaymentAmount(), "2,509.1"); // When RepayLoanParameters params = new RepayLoanParameters(); params.setModeOfRepayment("Cash"); loanAccountPage = repayLoanPage .submitAndNavigateToRepayLoanConfirmationPage(params) .submitAndNavigateToLoanAccountDetailsPage(); // Then loanAccountPage.verifyStatus("Closed- Obligation met"); String[][] accountSummaryTable = { {"", "Original Loan", "Amount paid", "Loan balance"}, {"Principal", "2,500", "2,500", "0"}, {"Interest", "9.1", "9.1", "0"}, {"Fees", "0", "0", "0"}, {"Penalty", "0", "0", "0"}, {"Total", "2,509.1", "2,509.1", "0"} }; loanAccountPage.verifyAccountSummary(accountSummaryTable); loanAccountPage.navigateToAccountActivityPage(); Assert.assertEquals("Loan Repayment", selenium.getTable("accountActivityTable.2.1").trim()); Assert.assertEquals("2,500", selenium.getTable("accountActivityTable.2.2").trim()); Assert.assertEquals("0", selenium.getTable("accountActivityTable.2.10").trim()); }