Search in sources :

Example 1 with CreateSavingsAccountSearchParameters

use of org.mifos.test.acceptance.framework.savings.CreateSavingsAccountSearchParameters in project head by mifos.

the class ClientTest method removeClientWithSavingsFromGroupWithSavingsCheckGroupCalculation.

@SuppressWarnings("PMD.SignatureDeclareThrowsException")
// https://mifosforge.jira.com/browse/MIFOS-5844
@Test(enabled = true)
public void removeClientWithSavingsFromGroupWithSavingsCheckGroupCalculation() throws Exception {
    //Given
    SavingsProductParameters savingsProductParameters = savingsProductHelper.getGenericSavingsProductParameters(new DateTime(2009, 7, 13, 12, 0, 0, 0), SavingsProductParameters.MANDATORY, SavingsProductParameters.GROUPS);
    savingsProductParameters.setProductInstanceName("MandatoryGroupSavingProduct");
    savingsProductParameters.setShortName("M-45");
    savingsProductParameters.setAmountAppliesTo(SavingsProductParameters.PER_INDIVIDUAL);
    savingsProductHelper.createSavingsProduct(savingsProductParameters);
    String clientName = clientTestHelper.createClientAndVerify("loan officer", "MyOfficeDHMFT").getHeading();
    clientTestHelper.activateClient(clientName);
    clientTestHelper.addClientToGroup(clientName, "groupWithoutLoan");
    String groupName = navigationHelper.navigateToClientViewDetailsPage(clientName).getGroupMembership();
    CreateSavingsAccountSearchParameters searchParameters = new CreateSavingsAccountSearchParameters();
    CreateSavingsAccountSubmitParameters submitAccountParameters = new CreateSavingsAccountSubmitParameters();
    submitAccountParameters.setAmount("240.0");
    EditAccountStatusParameters editAccountStatusParameters = new EditAccountStatusParameters();
    editAccountStatusParameters.setAccountStatus(AccountStatus.SAVINGS_ACTIVE);
    editAccountStatusParameters.setNote("change status to active");
    // When
    searchParameters.setSearchString(clientName);
    searchParameters.setSavingsProduct("MonthlyClientSavingsAccount");
    String savingsId = savingsAccountHelper.createSavingsAccount(searchParameters, submitAccountParameters).getAccountId();
    searchParameters.setSearchString(groupName);
    searchParameters.setSavingsProduct("MandatoryGroupSavingProduct");
    savingsAccountHelper.changeStatus(savingsId, editAccountStatusParameters);
    savingsId = savingsAccountHelper.createSavingsAccount(searchParameters, submitAccountParameters).getAccountId();
    savingsAccountHelper.changeStatus(savingsId, editAccountStatusParameters);
    clientTestHelper.deleteClientGroupMembership(clientName, "remove group membership");
    Integer numberOfGroupMembers = Integer.parseInt(navigationHelper.navigateToGroupViewDetailsPage(groupName).getNumberOfClientsInGroup());
    // Then
    savingsAccountHelper.verifyTotalAmountDue(savingsId, numberOfGroupMembers, Float.parseFloat(submitAccountParameters.getAmount()));
}
Also used : CreateSavingsAccountSearchParameters(org.mifos.test.acceptance.framework.savings.CreateSavingsAccountSearchParameters) SavingsProductParameters(org.mifos.test.acceptance.framework.savingsproduct.SavingsProductParameters) DateTime(org.joda.time.DateTime) CreateSavingsAccountSubmitParameters(org.mifos.test.acceptance.framework.savings.CreateSavingsAccountSubmitParameters) EditAccountStatusParameters(org.mifos.test.acceptance.framework.account.EditAccountStatusParameters) Test(org.testng.annotations.Test)

Example 2 with CreateSavingsAccountSearchParameters

use of org.mifos.test.acceptance.framework.savings.CreateSavingsAccountSearchParameters in project head by mifos.

the class ClientTest method removeClientWithLoanFromGroup.

@SuppressWarnings("PMD.SignatureDeclareThrowsException")
//https://mifosforge.jira.com/browse/MIFOS-5843
@Test(enabled = true)
public void removeClientWithLoanFromGroup() throws Exception {
    // Given
    String clientName = clientTestHelper.createClientAndVerify("loan officer", "MyOfficeDHMFT").getHeading();
    clientTestHelper.activateClient(clientName);
    // Then
    clientTestHelper.addClientToGroup(clientName, "groupWithoutLoan");
    CreateLoanAccountSearchParameters searchParams = new CreateLoanAccountSearchParameters();
    searchParams.setSearchString(clientName);
    searchParams.setLoanProduct("WeeklyFlatLoanWithOneTimeFees");
    CreateLoanAccountSubmitParameters submitLoanAccountParameters = new CreateLoanAccountSubmitParameters();
    submitLoanAccountParameters.setDd("22");
    submitLoanAccountParameters.setMm("01");
    submitLoanAccountParameters.setYy("2010");
    String loanAccounntID = loanTestHelper.createLoanAccount(searchParams, submitLoanAccountParameters).getAccountId();
    loanTestHelper.activateLoanAccount(loanAccounntID);
    String groupName = navigationHelper.navigateToClientViewDetailsPage(clientName).getGroupMembership();
    SavingsProductParameters params = savingsProductHelper.getGenericSavingsProductParameters(new DateTime(2009, 7, 13, 12, 0, 0, 0), SavingsProductParameters.MANDATORY, SavingsProductParameters.GROUPS);
    savingsProductHelper.createSavingsProduct(params);
    CreateSavingsAccountSearchParameters searchParameters = new CreateSavingsAccountSearchParameters();
    searchParameters.setSearchString(groupName);
    searchParameters.setSavingsProduct(params.getProductInstanceName());
    CreateSavingsAccountSubmitParameters submitAccountParameters = new CreateSavingsAccountSubmitParameters();
    submitAccountParameters.setAmount("250.0");
    String savingsId = savingsAccountHelper.createSavingsAccount(searchParameters, submitAccountParameters).getAccountId();
    EditAccountStatusParameters editAccountStatusParameters = new EditAccountStatusParameters();
    editAccountStatusParameters.setAccountStatus(AccountStatus.SAVINGS_ACTIVE);
    editAccountStatusParameters.setNote("change status to active");
    savingsAccountHelper.changeStatus(savingsId, editAccountStatusParameters);
    // When / Then
    clientTestHelper.deleteClientGroupMembership(clientName, "remove group membership");
}
Also used : CreateLoanAccountSearchParameters(org.mifos.test.acceptance.framework.loan.CreateLoanAccountSearchParameters) CreateSavingsAccountSearchParameters(org.mifos.test.acceptance.framework.savings.CreateSavingsAccountSearchParameters) CreateLoanAccountSubmitParameters(org.mifos.test.acceptance.framework.loan.CreateLoanAccountSubmitParameters) SavingsProductParameters(org.mifos.test.acceptance.framework.savingsproduct.SavingsProductParameters) DateTime(org.joda.time.DateTime) CreateSavingsAccountSubmitParameters(org.mifos.test.acceptance.framework.savings.CreateSavingsAccountSubmitParameters) EditAccountStatusParameters(org.mifos.test.acceptance.framework.account.EditAccountStatusParameters) Test(org.testng.annotations.Test)

Example 3 with CreateSavingsAccountSearchParameters

use of org.mifos.test.acceptance.framework.savings.CreateSavingsAccountSearchParameters in project head by mifos.

the class QuestionGroupSavingsAccountTest method verifyCapturingResponsesDuringSavingsCreation.

//http://mifosforge.jira.com/browse/MIFOSTEST-669
/*
     * need to fix up commonality between questionaire pages for loan and savings.
     */
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
//TODO http://mifosforge.jira.com/browse/MIFOS-5081
@Test(enabled = false)
public void verifyCapturingResponsesDuringSavingsCreation() throws Exception {
    DateTimeUpdaterRemoteTestingService dateTimeUpdaterRemoteTestingService = new DateTimeUpdaterRemoteTestingService(selenium);
    DateTime targetTime = new DateTime(2011, 2, 28, 15, 0, 0, 0);
    dateTimeUpdaterRemoteTestingService.setDateTime(targetTime);
    setQuestionGroup();
    createClient("669");
    CreateSavingsAccountSearchParameters searchParameters = new CreateSavingsAccountSearchParameters();
    searchParameters.setSearchString("Joe669 Doe669");
    searchParameters.setSavingsProduct("MonthlyClientSavingsAccount");
    CreateSavingsAccountSubmitParameters submitAccountParameters = new CreateSavingsAccountSubmitParameters();
    submitAccountParameters.setAmount("248.0");
    QuestionResponseParameters questionResponseParameters = new QuestionResponseParameters();
    questionResponseParameters.addTextAnswer("questionGroups[1].sectionDetails[0].questions[0].value", "textquestion");
    questionResponseParameters.addTextAnswer("questionGroups[1].sectionDetails[0].questions[1].value", "100");
    questionResponseParameters.addTextAnswer("questionGroups[1].sectionDetails[0].questions[2].value", "Text");
    questionResponseParameters.addSingleSelectAnswer("questionGroups[1].sectionDetails[0].questions[3].value", "blue");
    questionResponseParameters.addSingleSelectAnswer("questionGroups[1].sectionDetails[1].questions[0].values", "two");
    questionResponseParameters.addTextAnswer("questionGroups[1].sectionDetails[1].questions[1].value", "6");
    questionResponseParameters.addTextAnswer("questionGroups[0].sectionDetails[0].questions[0].value", "04/02/2011");
    questionResponseParameters.addSingleSelectAnswer("questionGroups[0].sectionDetails[0].questions[1].values", "one");
    questionResponseParameters.addTextAnswer("questionGroups[0].sectionDetails[0].questions[2].value", "123");
    questionResponseParameters.addTextAnswer("questionGroups[0].sectionDetails[0].questions[3].value", "7");
    questionResponseParameters.addTextAnswer("questionGroups[0].sectionDetails[1].questions[0].value", "Text");
    questionResponseParameters.addSingleSelectAnswer("questionGroups[0].sectionDetails[1].questions[1].value", "red");
    questionResponseParameters.addTextAnswer("questionGroups[0].sectionDetails[2].questions[0].value", "Text");
    QuestionResponseParameters questionResponseParameters2 = new QuestionResponseParameters();
    questionResponseParameters2.addTextAnswer("questionGroups[1].sectionDetails[0].questions[0].value", "textQuestion");
    questionResponseParameters2.addTextAnswer("questionGroups[0].sectionDetails[0].questions[3].value", "9");
    savingsAccountHelper.fillQuestionGroupsDurringCreationSavingsAccount(searchParameters, submitAccountParameters, questionResponseParameters);
    SavingsAccountDetailPage savingsAccountDetailPage = savingsAccountHelper.editAdditionalInformationDurringCreationSavingsAccount(questionResponseParameters2);
    String savingsId = savingsAccountDetailPage.getAccountId();
    questionGroupTestHelper.markQuestionGroupAsInactive("QGForCreateSavingsAccount");
    questionGroupTestHelper.markQuestionAsInactive("SingleSelect");
    questionGroupTestHelper.markQuestionAsInactive("NumberBetween5And10");
    questionGroupTestHelper.markQuestionAsInactive("Question1");
    questionGroupTestHelper.markQuestionAsInactive("question 1");
    CreateQuestionParameters createQuestionParameters = new CreateQuestionParameters();
    createQuestionParameters.setType(CreateQuestionParameters.TYPE_FREE_TEXT);
    createQuestionParameters.setText("newQuestion232");
    List<CreateQuestionParameters> newQuestionList = new ArrayList<CreateQuestionParameters>();
    newQuestionList.add(createQuestionParameters);
    questionGroupTestHelper.addNewQuestionsToQuestionGroup("QGForCreateSavingsAccount2", newQuestionList);
    Map<String, String> questionsAndAnswers = new HashMap<String, String>();
    questionsAndAnswers.put("MultiSelect", "two");
    questionsAndAnswers.put("Number", "100");
    questionsAndAnswers.put("FreeText", "textquestion");
    String[] questionsExist = { "newQuestion232", "MultiSelect", "Number", "FreeText" };
    String[] questionsInactive = { "SingleSelect", "NumberBetween5And10", "Question1", "question 1", "Date" };
    QuestionnairePage questionnairePage = savingsAccountHelper.navigateToQuestionResponseDuringCreateSavings(searchParameters, submitAccountParameters);
    questionnairePage.verifyQuestionsExists(questionsExist);
    questionnairePage.verifyQuestionsDoesnotappear(questionsInactive);
    verifyQuestionResponsesExistInDatabase(savingsId, "Create Savings", questionsAndAnswers);
    questionGroupTestHelper.markQuestionGroupAsInactive("QGForCreateSavingsAccount2");
    questionGroupTestHelper.markQuestionAsActive("SingleSelect");
    questionGroupTestHelper.markQuestionAsActive("NumberBetween5And10");
    questionGroupTestHelper.markQuestionAsActive("Question1");
    questionGroupTestHelper.markQuestionAsActive("question 1");
}
Also used : HashMap(java.util.HashMap) QuestionnairePage(org.mifos.test.acceptance.framework.questionnaire.QuestionnairePage) ArrayList(java.util.ArrayList) SavingsAccountDetailPage(org.mifos.test.acceptance.framework.savings.SavingsAccountDetailPage) DateTime(org.joda.time.DateTime) QuestionResponseParameters(org.mifos.test.acceptance.framework.loan.QuestionResponseParameters) CreateSavingsAccountSubmitParameters(org.mifos.test.acceptance.framework.savings.CreateSavingsAccountSubmitParameters) CreateQuestionParameters(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionParameters) CreateSavingsAccountSearchParameters(org.mifos.test.acceptance.framework.savings.CreateSavingsAccountSearchParameters) DateTimeUpdaterRemoteTestingService(org.mifos.test.acceptance.remote.DateTimeUpdaterRemoteTestingService) Test(org.testng.annotations.Test)

Example 4 with CreateSavingsAccountSearchParameters

use of org.mifos.test.acceptance.framework.savings.CreateSavingsAccountSearchParameters in project head by mifos.

the class QuestionGroupSavingsAccountTest method verifyCapturingResponsesDuringSavingsClosing.

@SuppressWarnings("PMD.SignatureDeclareThrowsException")
@Test(enabled = true)
public void verifyCapturingResponsesDuringSavingsClosing() throws Exception {
    DateTimeUpdaterRemoteTestingService dateTimeUpdaterRemoteTestingService = new DateTimeUpdaterRemoteTestingService(selenium);
    DateTime targetTime = new DateTime(2011, 2, 28, 15, 0, 0, 0);
    dateTimeUpdaterRemoteTestingService.setDateTime(targetTime);
    questionGroupTestHelper.markQuestionGroupAsActive("QGForCloseSavings");
    try {
        createClient("670");
        CreateSavingsAccountSearchParameters searchParameters = new CreateSavingsAccountSearchParameters();
        searchParameters.setSearchString("Joe670 Doe670");
        searchParameters.setSavingsProduct("MonthlyClientSavingsAccount");
        CreateSavingsAccountSubmitParameters submitAccountParameters = new CreateSavingsAccountSubmitParameters();
        submitAccountParameters.setAmount("248.0");
        QuestionResponseParameters questionResponseParameters = new QuestionResponseParameters();
        questionResponseParameters.addSingleSelectAnswer("questionGroups[0].sectionDetails[0].questions[0].valuesAsArray", "three");
        questionResponseParameters.addTextAnswer("questionGroups[0].sectionDetails[0].questions[1].value", "20");
        String savingsId = savingsAccountHelper.createSavingsAccount(searchParameters, submitAccountParameters).getAccountId();
        EditAccountStatusParameters editAccountStatusParameters = new EditAccountStatusParameters();
        editAccountStatusParameters.setAccountStatus(AccountStatus.SAVINGS_ACTIVE);
        editAccountStatusParameters.setNote("test");
        savingsAccountHelper.changeStatus(savingsId, editAccountStatusParameters);
        String[] questionsExist = { "MultiSelect", "Number" };
        savingsAccountHelper.fillQuestionGroupsDuringClosingSavingsAccount(savingsId, questionResponseParameters, questionsExist);
        Map<String, String> questionsAndAnswers = new HashMap<String, String>();
        questionsAndAnswers.put("MultiSelect", "three");
        questionsAndAnswers.put("Number", "20");
        verifyQuestionResponsesExistInDatabase(savingsId, "Close Savings", questionsAndAnswers);
    } finally {
        questionGroupTestHelper.markQuestionGroupAsInactive("QGForCloseSavings");
    }
}
Also used : HashMap(java.util.HashMap) CreateSavingsAccountSearchParameters(org.mifos.test.acceptance.framework.savings.CreateSavingsAccountSearchParameters) DateTimeUpdaterRemoteTestingService(org.mifos.test.acceptance.remote.DateTimeUpdaterRemoteTestingService) DateTime(org.joda.time.DateTime) QuestionResponseParameters(org.mifos.test.acceptance.framework.loan.QuestionResponseParameters) CreateSavingsAccountSubmitParameters(org.mifos.test.acceptance.framework.savings.CreateSavingsAccountSubmitParameters) EditAccountStatusParameters(org.mifos.test.acceptance.framework.account.EditAccountStatusParameters) Test(org.testng.annotations.Test)

Example 5 with CreateSavingsAccountSearchParameters

use of org.mifos.test.acceptance.framework.savings.CreateSavingsAccountSearchParameters in project head by mifos.

the class UpdateCustomPropertiesTest method verifyPropertyPendingApprovalStateEnabledForSavingsAndLoanAccounts.

/*
     * 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");
}
Also used : CreateLoanAccountSearchParameters(org.mifos.test.acceptance.framework.loan.CreateLoanAccountSearchParameters) CreateSavingsAccountSearchParameters(org.mifos.test.acceptance.framework.savings.CreateSavingsAccountSearchParameters) CreateLoanAccountSubmitParameters(org.mifos.test.acceptance.framework.loan.CreateLoanAccountSubmitParameters) SavingsAccountDetailPage(org.mifos.test.acceptance.framework.savings.SavingsAccountDetailPage) LoanAccountPage(org.mifos.test.acceptance.framework.loan.LoanAccountPage) LoanTestHelper(org.mifos.test.acceptance.framework.testhelpers.LoanTestHelper) CreateSavingsAccountSubmitParameters(org.mifos.test.acceptance.framework.savings.CreateSavingsAccountSubmitParameters) Test(org.testng.annotations.Test)

Aggregations

CreateSavingsAccountSearchParameters (org.mifos.test.acceptance.framework.savings.CreateSavingsAccountSearchParameters)14 CreateSavingsAccountSubmitParameters (org.mifos.test.acceptance.framework.savings.CreateSavingsAccountSubmitParameters)14 SavingsAccountDetailPage (org.mifos.test.acceptance.framework.savings.SavingsAccountDetailPage)9 Test (org.testng.annotations.Test)9 EditAccountStatusParameters (org.mifos.test.acceptance.framework.account.EditAccountStatusParameters)6 DateTime (org.joda.time.DateTime)5 SavingsProductParameters (org.mifos.test.acceptance.framework.savingsproduct.SavingsProductParameters)3 HashMap (java.util.HashMap)2 CreateLoanAccountSearchParameters (org.mifos.test.acceptance.framework.loan.CreateLoanAccountSearchParameters)2 CreateLoanAccountSubmitParameters (org.mifos.test.acceptance.framework.loan.CreateLoanAccountSubmitParameters)2 QuestionResponseParameters (org.mifos.test.acceptance.framework.loan.QuestionResponseParameters)2 DepositWithdrawalSavingsParameters (org.mifos.test.acceptance.framework.savings.DepositWithdrawalSavingsParameters)2 DateTimeUpdaterRemoteTestingService (org.mifos.test.acceptance.remote.DateTimeUpdaterRemoteTestingService)2 ArrayList (java.util.ArrayList)1 AdminPage (org.mifos.test.acceptance.framework.admin.AdminPage)1 DefineAcceptedPaymentTypesPage (org.mifos.test.acceptance.framework.admin.DefineAcceptedPaymentTypesPage)1 ClientViewDetailsPage (org.mifos.test.acceptance.framework.client.ClientViewDetailsPage)1 LoanAccountPage (org.mifos.test.acceptance.framework.loan.LoanAccountPage)1 CreateQuestionParameters (org.mifos.test.acceptance.framework.questionnaire.CreateQuestionParameters)1 QuestionnairePage (org.mifos.test.acceptance.framework.questionnaire.QuestionnairePage)1