@SuppressWarnings("PMD.SignatureDeclareThrowsException") // http://mifosforge.jira.com/browse/MIFOSTEST-216 @Test(enabled = true) public void verifyPropertySavingsPendingApprovalStateEnabled() throws Exception { // Given propertiesHelper.setSavingsPendingApprovalStateEnabled("false"); // When CreateSavingsAccountSearchParameters searchParameters = new CreateSavingsAccountSearchParameters(); searchParameters.setSearchString("UpdateCustomProperties TestClient"); searchParameters.setSavingsProduct("MandatorySavingsAccount"); CreateSavingsAccountSubmitParameters submitAccountParameters = new CreateSavingsAccountSubmitParameters(); submitAccountParameters.setAmount("248.0"); SavingsAccountDetailPage savingsAccountPage = savingsAccountHelper.createSavingsAccountWithoutPendingApprovalState( searchParameters, submitAccountParameters); savingsAccountPage.verifyPage(); // Then savingsAccountPage.verifySavingsAmount(submitAccountParameters.getAmount()); savingsAccountPage.verifySavingsProduct(searchParameters.getSavingsProduct()); savingsAccountPage.verifyStatus("Active"); propertiesHelper.setSavingsPendingApprovalStateEnabled("true"); }
@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"); }
@SuppressWarnings("PMD.SignatureDeclareThrowsException") @Test(enabled = true) public void changeMaxInterestRateToFive() throws Exception { propertiesHelper.setMaxInterest(5); SubmitFormParameters submitFormParameters = FormParametersHelper.getWeeklyLoanProductParameters(); submitFormParameters.setMaxInterestRate("12"); // invalid value submitFormParameters.setMinInterestRate("1"); submitFormParameters.setDefaultInterestRate("3"); verifyInvalidInterestInLoanProduct(submitFormParameters, true); propertiesHelper.setMaxInterest(999); }
@SuppressWarnings("PMD.SignatureDeclareThrowsException") // http://mifosforge.jira.com/browse/MIFOSTEST-233 @Test(enabled = true) public void verifyPropertyGroupCanApplyLoansFalse() throws Exception { // Given propertiesHelper.setGroupCanApplyLoans("false"); // When navigationHelper.navigateToGroupViewDetailsPage("Default Group"); // Then Assert.assertFalse(selenium.isElementPresent("viewgroupdetails.link.newLoanAccount")); propertiesHelper.setGroupCanApplyLoans("true"); }
@SuppressWarnings("PMD.SignatureDeclareThrowsException") // http://mifosforge.jira.com/browse/MIFOSTEST-235 @Test(enabled = true) public void verifyPropertyClientRulesClientCanExistOutsideGroupFalse() throws Exception { // Given propertiesHelper.setClientCanExistOutsideGroup("false"); // When navigationHelper.navigateToClientsAndAccountsPage().navigateToCreateNewClientPage(); // Then Assert.assertFalse(selenium.isElementPresent("group_search.link.membershipNotRequired")); propertiesHelper.setClientCanExistOutsideGroup("true"); }
@SuppressWarnings("PMD.SignatureDeclareThrowsException") @Test(enabled = true) public void changeDigitsAfterDecimalForInterestToThree() throws Exception { propertiesHelper.setDigitsAfterDecimalForInterest(3); SubmitFormParameters submitFormParameters = FormParametersHelper.getWeeklyLoanProductParameters(); submitFormParameters.setMaxInterestRate("6.33333"); // invalid value submitFormParameters.setMinInterestRate("1"); submitFormParameters.setDefaultInterestRate("3"); verifyInvalidInterestInLoanProduct(submitFormParameters, false); propertiesHelper.setDigitsAfterDecimalForInterest(5); }
// http://mifosforge.jira.com/browse/MIFOSTEST-86 @Test public void changeLocale() { // Given propertiesHelper.setLocale("FR", "FR"); // When HomePage homePage = navigationHelper.navigateToHomePage(); // Then Assert.assertEquals(homePage.getWelcome(), "Bienvenue, mifos"); // cleanup propertiesHelper.setLocale("EN", "GB"); }
@SuppressWarnings("PMD.SignatureDeclareThrowsException") // http://mifosforge.jira.com/browse/MIFOSTEST-228 @Test(enabled = true) public void verifyPropertyBackDatedTransactionsAllowedFalse() throws Exception { // Given propertiesHelper.setBackDatedTransactionsAllowed("false"); // When navigationHelper .navigateToLoanAccountPage("000100000000020") .navigateToDisburseLoan() .verifyDisbursalDateIsDisabled(); // Then propertiesHelper.setBackDatedTransactionsAllowed("true"); }
// http://mifosforge.jira.com/browse/MIFOSTEST-204 @SuppressWarnings("PMD.SignatureDeclareThrowsException") @Test public void removeThursdayFromWorkingDays() throws Exception { String workingDays = "Monday,Tuesday,Wednesday,Thursday,Friday,Saturday"; propertiesHelper.setWorkingDays(workingDays); // When CreateCenterEnterDataPage createCenterEnterDataPage = navigationHelper.navigateToCreateCenterEnterDataPage("MyOfficeDHMFT"); CreateMeetingPage createMeetingPage = createCenterEnterDataPage.navigateToCreateMeetingPage(); createMeetingPage.verifyWorkingDays(workingDays); CreateClientEnterMfiDataPage createClientEnterMfiDataPage = navigationHelper.navigateToCreateClientEnterMfiDataPage("MyOfficeDHMFT"); createMeetingPage = createClientEnterMfiDataPage.navigateToCreateMeetingPage(); createMeetingPage.verifyWorkingDays(workingDays); workingDays = "Monday,Tuesday,Wednesday,Friday,Saturday"; propertiesHelper.setWorkingDays(workingDays); // Then createCenterEnterDataPage = navigationHelper.navigateToCreateCenterEnterDataPage("MyOfficeDHMFT"); createMeetingPage = createCenterEnterDataPage.navigateToCreateMeetingPage(); createMeetingPage.verifyWorkingDays(workingDays); createClientEnterMfiDataPage = navigationHelper.navigateToCreateClientEnterMfiDataPage("MyOfficeDHMFT"); createMeetingPage = createClientEnterMfiDataPage.navigateToCreateMeetingPage(); createMeetingPage.verifyWorkingDays(workingDays); String groupName = "testGroup"; CreateCenterEnterDataPage.SubmitFormParameters formParameters = new CreateCenterEnterDataPage.SubmitFormParameters(); formParameters = setCenterParameters(); centerTestHelper.createCenter(formParameters, "MyOfficeDHMFT"); CreateGroupSubmitParameters groupParams = new CreateGroupSubmitParameters(); groupParams.setGroupName(groupName); GroupTestHelper groupTestHelper = new GroupTestHelper(selenium); groupTestHelper.createNewGroupPartialApplication("Default Center", groupParams); clientTestHelper.createClientAndVerify("loan officer", "MyOfficeDHMFT"); // restore original configuration propertiesHelper.setWorkingDays("Monday,Tuesday,Wednesday,Thursday,Friday,Saturday"); }
@SuppressWarnings("PMD.SignatureDeclareThrowsException") // http://mifosforge.jira.com/browse/MIFOSTEST-211 @Test(enabled = true) public void verifyPropertyGroupPendingApprovalStateEnabled() throws Exception { // Given propertiesHelper.setGroupPendingApprovalStateEnabled("false"); // When GroupTestHelper groupTestHelper = new GroupTestHelper(selenium); CreateGroupSubmitParameters groupParams = new CreateGroupSubmitParameters(); groupParams.setGroupName("testGroup123123123123"); GroupViewDetailsPage groupViewDetailsPage = groupTestHelper.createNewGroupWithoutPendingForApproval("Default Center", groupParams); // Then groupViewDetailsPage.verifyStatus("Active"); propertiesHelper.setGroupPendingApprovalStateEnabled("true"); }
/** * 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"); }
@SuppressWarnings("PMD.SignatureDeclareThrowsException") // http://mifosforge.jira.com/browse/MIFOSTEST-232 @Test(enabled = true) public void verifyPropertyClientRulesCenterHierarchyExistsFalse() throws Exception { // Given propertiesHelper.setCenterHierarchyExists("false"); // When ClientsAndAccountsHomepage clientsAndAccountsHomePage = navigationHelper.navigateToClientsAndAccountsPage(); // Then clientsAndAccountsHomePage.verifyMenuWithCenterHierarchyOff(); // Given propertiesHelper.setCenterHierarchyExists("true"); // When clientsAndAccountsHomePage = navigationHelper.navigateToClientsAndAccountsPage(); // Then clientsAndAccountsHomePage.verifyMenuWithCenterHierarchyOn(); }
/** * Digits after decimal validate occurs for disbursal and payment import * http://mifosforge.jira.com/browse/MIFOSTEST-278 * * @throws Exception */ @SuppressWarnings("PMD.SignatureDeclareThrowsException") @Test(enabled = true) public void validateImport() throws Exception { // Given String path = this.getClass().getResource("/mpesa/" + DISBURSAL_IMPORT).toString(); String dataset = "mpesa_export_dbunit.xml"; initRemote.dataLoadAndCacheRefresh(dbUnitUtilities, dataset, dataSource, selenium); propertiesHelper.setImportTransactionOrder("AL3,AL5"); propertiesHelper.setDigitsAfterDecimal(0); // When ImportTransactionsPage importTransactionsPage = importTransaction(path); // Then importTransactionsPage.checkErrors( new String[] { "Row <24> error - " + "C94ZH942 - Number of fraction digits in the \"Withdrawn\"" + " column - 3 - is greater than configured for the currency - 0" }); // When path = this.getClass().getResource("/mpesa/" + PAYMENT_IMPORT).toString(); importTransactionsPage = importTransaction(path); // Then importTransactionsPage.checkErrors( new String[] { "Row <24> error - THY89933" + " - Number of fraction digits in the \"Paid In\" column - 3 - " + "is greater than configured for the currency - 0" }); propertiesHelper.setDigitsAfterDecimal(1); }
/* * 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-234 @Test(enabled = true) public void verifyPropertyGroupCanApplyLoansTrue() throws Exception { // Given propertiesHelper.setGroupCanApplyLoans("true"); LoanTestHelper helper = new LoanTestHelper(selenium); CreateLoanAccountSearchParameters searchParameters = new CreateLoanAccountSearchParameters(); searchParameters.setSearchString("UpdateCustomPropertiesTestGroup"); searchParameters.setLoanProduct("GroupEmergencyLoan"); CreateLoanAccountSubmitParameters submitAccountParameters = new CreateLoanAccountSubmitParameters(); submitAccountParameters.setAmount("2000.0"); // When Then helper.createLoanAccount(searchParameters, submitAccountParameters); }
@SuppressWarnings({"PMD.SignatureDeclareThrowsException", "PMD.SystemPrintln"}) @Test(enabled = true) public void importMpesaTransactions() throws Exception { AdminPage adminPage = navigationHelper.navigateToAdminPage(); ViewOrganizationSettingsPage viewOrganizationSettingsPage = adminPage.navigateToViewOrganizationSettingsPage(); viewOrganizationSettingsPage.verifyMiscellaneous( new String[] {"Max MPESA Disbursal Limit: 50000.0"}); propertiesHelper.setImportTransactionOrder("AL3,AL5"); String dataset = "mpesa_export_dbunit.xml"; initRemote.dataLoadAndCacheRefresh(dbUnitUtilities, dataset, dataSource, selenium); for (String importFile : TEST_FILES) { String path = this.getClass().getResource("/mpesa/" + importFile).toString(); importTransaction(path); checkIfOutputMatchesExpected(path); } }
@SuppressWarnings("PMD.SignatureDeclareThrowsException") // http://mifosforge.jira.com/browse/MIFOSTEST-231 @Test(enabled = true) public void verifyPropertyClientRulesCenterHierarchyExistsTrue() throws Exception { // Given propertiesHelper.setCenterHierarchyExists("true"); // When CreateCenterEnterDataPage.SubmitFormParameters formParameters = new CreateCenterEnterDataPage.SubmitFormParameters(); formParameters.setCenterName("testCenterName12123"); formParameters.setLoanOfficer("loan officer"); MeetingParameters meeting = new MeetingParameters(); meeting.setMeetingPlace("Bangalore"); meeting.setWeekDay(MeetingParameters.WeekDay.WEDNESDAY); meeting.setWeekFrequency("1"); formParameters.setMeeting(meeting); CenterViewDetailsPage centerViewDetailsPage = centerTestHelper.createCenter(formParameters, "MyOfficeDHMFT"); // Then centerViewDetailsPage.verifyActiveCenter(formParameters); }
/** * 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"); }