Search in sources :

Example 11 with QuestionResponsePage

use of org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage in project head by mifos.

the class OfficeHelper method navigateToQuestionResponsePage.

public QuestionResponsePage navigateToQuestionResponsePage(OfficeParameters officeParameters) {
    AdminPage adminPage = navigationHelper.navigateToAdminPage();
    CreateOfficeEnterDataPage officeEnterDataPage = adminPage.navigateToCreateOfficeEnterDataPage();
    officeEnterDataPage.verifyPage();
    QuestionResponsePage questionResponsePage = officeEnterDataPage.submitAndGotoQuestionResponsePage(officeParameters);
    questionResponsePage.verifyPage();
    return questionResponsePage;
}
Also used : AdminPage(org.mifos.test.acceptance.framework.admin.AdminPage) QuestionResponsePage(org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage) CreateOfficeEnterDataPage(org.mifos.test.acceptance.framework.office.CreateOfficeEnterDataPage)

Example 12 with QuestionResponsePage

use of org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage in project head by mifos.

the class QuestionGroupTestHelper method createOfficeWithQuestionGroup.

public CreateOfficePreviewDataPage createOfficeWithQuestionGroup(QuestionResponsePage questionResponsePage, QuestionResponseParameters initialResponse, QuestionResponseParameters updatedResponse) {
    questionResponsePage.populateAnswers(initialResponse);
    CreateOfficePreviewDataPage createOfficePreviewDataPage = questionResponsePage.navigateToNextPageAndReturnPage();
    QuestionResponsePage questionResponsePage2 = createOfficePreviewDataPage.editAdditionalInformation();
    questionResponsePage2.populateAnswers(updatedResponse);
    createOfficePreviewDataPage = questionResponsePage2.navigateToNextPageAndReturnPage();
    return createOfficePreviewDataPage.submitWithError();
}
Also used : CreateOfficePreviewDataPage(org.mifos.test.acceptance.framework.office.CreateOfficePreviewDataPage) QuestionResponsePage(org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage)

Example 13 with QuestionResponsePage

use of org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage in project head by mifos.

the class PersonnelTest method createUserWithQuestionGroup.

//http://mifosforge.jira.com/browse/MIFOSTEST-670
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void createUserWithQuestionGroup() throws Exception {
    //Given
    createQuestions();
    //When
    Map<String, List<String>> sectionQuestions = new HashMap<String, List<String>>();
    List<String> questions = new ArrayList<String>();
    questions.add("user question 1");
    sectionQuestions.put("Sec 1", questions);
    questions = new ArrayList<String>();
    questions.add("user question 2");
    questions.add("user question 3");
    sectionQuestions.put("Sec 2", questions);
    CreateQuestionGroupParameters createQuestionGroupParameters = new CreateQuestionGroupParameters();
    createQuestionGroupParameters.setAnswerEditable(true);
    createQuestionGroupParameters.setAppliesTo("Create Personnel");
    createQuestionGroupParameters.setTitle("Create Personnel QG1");
    createQuestionGroupParameters.setExistingQuestions(sectionQuestions);
    questionGroupTestHelper.createQuestionGroup(createQuestionGroupParameters);
    sectionQuestions = new HashMap<String, List<String>>();
    questions = new ArrayList<String>();
    questions.add("user question 4");
    sectionQuestions.put("Sec 3", questions);
    createQuestionGroupParameters = new CreateQuestionGroupParameters();
    createQuestionGroupParameters.setAnswerEditable(true);
    createQuestionGroupParameters.setAppliesTo("Create Personnel");
    createQuestionGroupParameters.setTitle("Create Personnel QG2");
    createQuestionGroupParameters.setExistingQuestions(sectionQuestions);
    questionGroupTestHelper.createQuestionGroup(createQuestionGroupParameters);
    AdminPage adminPage = navigationHelper.navigateToAdminPage();
    CreateUserParameters userParameters = adminPage.getAdminUserParameters();
    ChooseOfficePage createUserPage = adminPage.navigateToCreateUserPage();
    createUserPage.verifyPage();
    CreateUserEnterDataPage userEnterDataPage = createUserPage.selectOffice("MyOfficeDHMFT");
    QuestionResponsePage questionResponsePage = userEnterDataPage.submitAndNavigateToQuestionResponsePage(userParameters);
    questionResponsePage.verifyPage();
    QuestionResponseParameters responseParameters = new QuestionResponseParameters();
    responseParameters.addSingleSelectAnswer("questionGroups[0].sectionDetails[0].questions[0].value", "yes");
    responseParameters.addTextAnswer("questionGroups[0].sectionDetails[1].questions[1].value", "text1");
    questionResponsePage.populateAnswers(responseParameters);
    CreateUserPreviewDataPage createUserPreviewDataPage = questionResponsePage.continueAndNavigateToCreateUserPreviewPage();
    questionResponsePage = createUserPreviewDataPage.navigateToEditAdditionalInformation();
    questionResponsePage.populateTextAnswer("questionGroups[0].sectionDetails[1].questions[1].value", "text2");
    createUserPreviewDataPage = questionResponsePage.continueAndNavigateToCreateUserPreviewPage();
    CreateUserConfirmationPage userConfirmationPage = createUserPreviewDataPage.submit();
    QuestionnairePage questionnairePage = userConfirmationPage.navigateToUserViewDetailsPage().navigateToQuestionnairePage();
    //Then
    questionnairePage.verifyRadioGroup("details[0].sectionDetails[0].questions[0].value", "yes", true);
    questionnairePage.verifyRadioGroup("details[0].sectionDetails[1].questions[0].value", "good", false);
    questionnairePage.verifyField("details[0].sectionDetails[1].questions[1].value", "text2");
    //When
    questionnairePage.typeText("details[0].sectionDetails[1].questions[1].value", "text3");
    questionnairePage.submitAndNavigateToPersonnalDetailsPage();
    List<String> questionToAdd = new ArrayList<String>();
    questionToAdd.add("user question 5");
    questionToAdd.add("user question 6");
    List<String> questionToDesactivate = new ArrayList<String>();
    questionToDesactivate.add("user question 1");
    questionToDesactivate.add("user question 2");
    questionToDesactivate.add("user question 3");
    createQuestionGroupParameters = new CreateQuestionGroupParameters();
    for (String question : questionToAdd) {
        createQuestionGroupParameters.addExistingQuestion("Sec 1", question);
    }
    questionGroupTestHelper.addQuestionsToQuestionGroup("Create Personnel QG1", createQuestionGroupParameters.getExistingQuestions());
    for (String question : questionToDesactivate) {
        questionGroupTestHelper.markQuestionAsInactive(question);
    }
    questionGroupTestHelper.markQuestionGroupAsInactive("Create Personnel QG2");
    adminPage = navigationHelper.navigateToAdminPage();
    userParameters = adminPage.getAdminUserParameters();
    createUserPage = adminPage.navigateToCreateUserPage();
    createUserPage.verifyPage();
    userEnterDataPage = createUserPage.selectOffice("MyOfficeDHMFT");
    questionResponsePage = userEnterDataPage.submitAndNavigateToQuestionResponsePage(userParameters);
    questionResponsePage.verifyPage();
    //Then
    questionResponsePage.verifyQuestionsDoesnotappear(questionToDesactivate.toArray(new String[questionToDesactivate.size()]));
    questionResponsePage.verifyQuestionsExists(questionToAdd.toArray(new String[questionToAdd.size()]));
    questionResponsePage.verifySectionDoesnotappear("Sec 2");
    questionGroupTestHelper.markQuestionGroupAsInactive("Create Personnel QG1");
}
Also used : AdminPage(org.mifos.test.acceptance.framework.admin.AdminPage) CreateQuestionGroupParameters(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters) HashMap(java.util.HashMap) QuestionResponsePage(org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage) CreateUserEnterDataPage(org.mifos.test.acceptance.framework.user.CreateUserEnterDataPage) QuestionnairePage(org.mifos.test.acceptance.framework.questionnaire.QuestionnairePage) ArrayList(java.util.ArrayList) CreateUserConfirmationPage(org.mifos.test.acceptance.framework.user.CreateUserConfirmationPage) ChooseOfficePage(org.mifos.test.acceptance.framework.office.ChooseOfficePage) QuestionResponseParameters(org.mifos.test.acceptance.framework.loan.QuestionResponseParameters) CreateUserPreviewDataPage(org.mifos.test.acceptance.framework.user.CreateUserPreviewDataPage) CreateUserParameters(org.mifos.test.acceptance.framework.user.CreateUserParameters) ArrayList(java.util.ArrayList) List(java.util.List)

Example 14 with QuestionResponsePage

use of org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage in project head by mifos.

the class QuestionGroupLoanAccountTest method verifyResponsesDuringCreationOfLoanAccount.

/**
     * Capturing responses during the creation of Loan account
     * http://mifosforge.jira.com/browse/MIFOSTEST-683
     *
     * @throws Exception
     */
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void verifyResponsesDuringCreationOfLoanAccount() throws Exception {
    CreateLoanAccountSearchParameters createLoanAccountSearchParameters = new CreateLoanAccountSearchParameters();
    createLoanAccountSearchParameters.setLoanProduct("WeeklyClientFlatLoanWithNoFee");
    createLoanAccountSearchParameters.setSearchString("ClientWithLoan 20110221");
    CreateLoanAccountSubmitParameters formParameters = new CreateLoanAccountSubmitParameters();
    formParameters.setAdditionalFee1("oneTimeFee");
    formParameters.setAdditionalFee2("loanWeeklyFee");
    verifyQGNotDisplayed(createLoanAccountSearchParameters);
    questionGroupTestHelper.markQuestionGroupAsActive("QGForCreateLoan1");
    questionGroupTestHelper.markQuestionGroupAsActive("QGForCreateLoan2");
    try {
        QuestionResponseParameters questionResponseParameters = new QuestionResponseParameters();
        questionResponseParameters.addTextAnswer("questionGroups[0].sectionDetails[0].questions[0].value", "04/02/2011");
        questionResponseParameters.addTextAnswer("questionGroups[0].sectionDetails[0].questions[1].value", "free text");
        questionResponseParameters.addTextAnswer("questionGroups[0].sectionDetails[1].questions[0].value", "free text1");
        questionResponseParameters.addTextAnswer("questionGroups[1].sectionDetails[0].questions[0].value", "07/02/2011");
        questionResponseParameters.addTextAnswer("questionGroups[1].sectionDetails[0].questions[1].value", "20");
        questionResponseParameters.addSingleSelectAnswer("questionGroups[1].sectionDetails[1].questions[0].values", "three");
        questionResponseParameters.addTextAnswer("questionGroups[1].sectionDetails[1].questions[1].value", "free text2");
        CreateQuestionParameters createQuestionParameters = new CreateQuestionParameters();
        createQuestionParameters.setType(createQuestionParameters.TYPE_FREE_TEXT);
        createQuestionParameters.setText("questionByVerifyResponsesDuringCreationOfLoanAccount");
        List<CreateQuestionParameters> newQuestionList = new ArrayList<CreateQuestionParameters>();
        newQuestionList.add(createQuestionParameters);
        String[] questionsExist = { "Date", "FreeText", "SingleSelect", "questionByVerifyResponsesDuringCreationOfLoanAccount" };
        String[] questionsInactive = { "ToBeDisabled" };
        Map<String, String> questionsAndAnswers = new HashMap<String, String>();
        questionsAndAnswers.put("MultiSelect", "three");
        questionsAndAnswers.put("Number", "20");
        questionsAndAnswers.put("Date", "04/02/2011");
        QuestionResponsePage questionResponsePage = questionGroupTestHelper.navigateToQuestionResponsePageDuringLoanCreation(createLoanAccountSearchParameters, formParameters);
        questionResponsePage.populateAnswers(questionResponseParameters);
        CreateLoanAccountPreviewPage createLoanAccountPreviewPage = questionResponsePage.continueAndNavigateToCreateLoanAccountReviewInstallmentPage().clickPreviewAndGoToReviewLoanAccountPage();
        verifyCreateLoanAccountPreviewPage();
        questionResponsePage = createLoanAccountPreviewPage.navigateToQuestionResponsePage();
        questionResponseParameters.addSingleSelectAnswer("questionGroups[0].sectionDetails[1].questions[1].value", "blue");
        questionResponsePage.populateAnswers(questionResponseParameters);
        LoanAccountPage loanAccountPage = questionResponsePage.continueAndNavigateToCreateLoanAccountReviewInstallmentPage().clickPreviewAndGoToReviewLoanAccountPage().submit().navigateToLoanAccountDetailsPage();
        String loanID = loanAccountPage.getAccountId();
        verifyFees();
        ViewQuestionResponseDetailPage viewQuestionResponseDetailPage = questionGroupTestHelper.navigateToLoanViewQuestionResponseDetailPage(loanID);
        viewQuestionResponseDetailPage.verifyQuestionPresent("Date", "04/02/2011");
        viewQuestionResponseDetailPage.verifyQuestionPresent("ToBeDisabled", "free text");
        viewQuestionResponseDetailPage.verifyQuestionPresent("FreeText", "free text1");
        viewQuestionResponseDetailPage.verifyQuestionPresent("SingleSelect", "blue");
        viewQuestionResponseDetailPage.verifyQuestionPresent("DateQuestion", "07/02/2011");
        viewQuestionResponseDetailPage.verifyQuestionPresent("Number", "20");
        viewQuestionResponseDetailPage.verifyQuestionPresent("MultiSelect", "three");
        viewQuestionResponseDetailPage.verifyQuestionPresent("Text", "free text2");
        questionGroupTestHelper.markQuestionAsInactive("ToBeDisabled");
        questionGroupTestHelper.markQuestionGroupAsInactive("QGForCreateLoan2");
        questionGroupTestHelper.addNewQuestionsToQuestionGroup("QGForCreateLoan1", newQuestionList);
        questionResponsePage = questionGroupTestHelper.navigateToQuestionResponsePageDuringLoanCreation(createLoanAccountSearchParameters, null);
        questionResponsePage.verifyQuestionsExists(questionsExist);
        questionResponsePage.verifyQuestionsDoesnotappear(questionsInactive);
        viewQuestionResponseDetailPage = questionGroupTestHelper.navigateToLoanViewQuestionResponseDetailPage(loanID);
        viewQuestionResponseDetailPage.verifyQuestionPresent("MultiSelect", "three");
        viewQuestionResponseDetailPage.verifyQuestionPresent("Number", "20");
        viewQuestionResponseDetailPage.verifyQuestionPresent("Date", "04/02/2011");
        verifyQuestionResponsesExistInDatabase(loanID, "Create Loan", questionsAndAnswers);
    } finally {
        questionGroupTestHelper.markQuestionAsActive("ToBeDisabled");
        questionGroupTestHelper.markQuestionGroupAsInactive("QGForCreateLoan1");
        questionGroupTestHelper.markQuestionGroupAsInactive("QGForCreateLoan2");
    }
}
Also used : CreateLoanAccountSearchParameters(org.mifos.test.acceptance.framework.loan.CreateLoanAccountSearchParameters) ViewQuestionResponseDetailPage(org.mifos.test.acceptance.framework.questionnaire.ViewQuestionResponseDetailPage) HashMap(java.util.HashMap) QuestionResponsePage(org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage) ArrayList(java.util.ArrayList) QuestionResponseParameters(org.mifos.test.acceptance.framework.loan.QuestionResponseParameters) CreateQuestionParameters(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionParameters) CreateLoanAccountPreviewPage(org.mifos.test.acceptance.framework.loan.CreateLoanAccountPreviewPage) CreateLoanAccountSubmitParameters(org.mifos.test.acceptance.framework.loan.CreateLoanAccountSubmitParameters) LoanAccountPage(org.mifos.test.acceptance.framework.loan.LoanAccountPage)

Example 15 with QuestionResponsePage

use of org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage in project head by mifos.

the class QuestionGroupLoanAccountTest method verifyResponsesDuringLoanAccountApproval.

/**
     * Capturing responses while approving Loan account
     * http://mifosforge.jira.com/browse/MIFOSTEST-684
     *
     * @throws Exception
     */
@Test(enabled = true)
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void verifyResponsesDuringLoanAccountApproval() throws Exception {
    questionGroupTestHelper.markQuestionGroupAsActive("QGForApproveLoan1");
    questionGroupTestHelper.markQuestionGroupAsActive("QGForApproveLoan2");
    try {
        CreateLoanAccountSearchParameters createLoanAccountSearchParameters = new CreateLoanAccountSearchParameters();
        createLoanAccountSearchParameters.setLoanProduct("WeeklyClientFlatLoanWithNoFee");
        createLoanAccountSearchParameters.setSearchString("ClientWithLoan 20110221");
        EditAccountStatusParameters editAccountStatusParameters = new EditAccountStatusParameters();
        editAccountStatusParameters.setAccountStatus(AccountStatus.LOAN_APPROVED);
        editAccountStatusParameters.setNote("note note");
        QuestionResponseParameters questionResponseParameters = new QuestionResponseParameters();
        questionResponseParameters.addTextAnswer("questionGroups[0].sectionDetails[0].questions[0].value", "04/02/2011");
        questionResponseParameters.addTextAnswer("questionGroups[0].sectionDetails[0].questions[1].value", "free text");
        questionResponseParameters.addTextAnswer("questionGroups[0].sectionDetails[1].questions[0].value", "free text1");
        questionResponseParameters.addTextAnswer("questionGroups[1].sectionDetails[0].questions[0].value", "07/02/2011");
        questionResponseParameters.addTextAnswer("questionGroups[1].sectionDetails[0].questions[1].value", "20");
        questionResponseParameters.addSingleSelectAnswer("questionGroups[1].sectionDetails[1].questions[0].valuesAsArray", "three");
        questionResponseParameters.addTextAnswer("questionGroups[1].sectionDetails[1].questions[1].value", "free text2");
        CreateQuestionParameters createQuestionParameters = new CreateQuestionParameters();
        createQuestionParameters.setType(createQuestionParameters.TYPE_FREE_TEXT);
        createQuestionParameters.setText("questionByVerifyResponsesDuringLoanAccountApproval");
        List<CreateQuestionParameters> newQuestionList = new ArrayList<CreateQuestionParameters>();
        newQuestionList.add(createQuestionParameters);
        String[] questionsExist = { "Date", "FreeText", "SingleSelect", "questionByVerifyResponsesDuringLoanAccountApproval" };
        String[] questionsInactive = { "ToBeDisabled" };
        Map<String, String> questionsAndAnswers = new HashMap<String, String>();
        questionsAndAnswers.put("MultiSelect", "three");
        questionsAndAnswers.put("Number", "20");
        questionsAndAnswers.put("Date", "04/02/2011");
        LoanAccountPage loanAccountPage = loanTestHelper.createDefaultLoanAccount(createLoanAccountSearchParameters);
        String loanID1 = loanAccountPage.getAccountId();
        loanAccountPage = loanTestHelper.createDefaultLoanAccount(createLoanAccountSearchParameters);
        String loanID2 = loanAccountPage.getAccountId();
        QuestionResponsePage questionResponsePage = questionGroupTestHelper.navigateToQuestionResponsePageDuringLoanStatusChange(loanID1, editAccountStatusParameters);
        questionResponsePage.populateAnswers(questionResponseParameters);
        questionResponsePage = questionResponsePage.continueAndNavigateToEditAccountStatusConfirmationPage().navigateToEditStatus().submitAndNavigateToQuestionResponsePage(editAccountStatusParameters);
        questionResponseParameters.addTextAnswer("questionGroups[0].sectionDetails[1].questions[1].value", "blue");
        questionResponsePage.populateAnswers(questionResponseParameters);
        questionResponsePage.continueAndNavigateToEditAccountStatusConfirmationPage().submitAndNavigateToLoanAccountPage();
        questionGroupTestHelper.markQuestionAsInactive("ToBeDisabled");
        questionGroupTestHelper.markQuestionGroupAsInactive("QGForApproveLoan2");
        questionGroupTestHelper.addNewQuestionsToQuestionGroup("QGForApproveLoan1", newQuestionList);
        questionResponsePage = questionGroupTestHelper.navigateToQuestionResponsePageDuringLoanStatusChange(loanID2, editAccountStatusParameters);
        questionResponsePage.verifyQuestionsExists(questionsExist);
        questionResponsePage.verifyQuestionsDoesnotappear(questionsInactive);
        verifyQuestionResponsesExistInDatabase(loanID1, "Approve Loan", questionsAndAnswers);
    } finally {
        questionGroupTestHelper.markQuestionAsActive("ToBeDisabled");
        questionGroupTestHelper.markQuestionGroupAsInactive("QGForApproveLoan1");
        questionGroupTestHelper.markQuestionGroupAsInactive("QGForApproveLoan2");
    }
}
Also used : CreateLoanAccountSearchParameters(org.mifos.test.acceptance.framework.loan.CreateLoanAccountSearchParameters) CreateQuestionParameters(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionParameters) HashMap(java.util.HashMap) QuestionResponsePage(org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage) ArrayList(java.util.ArrayList) LoanAccountPage(org.mifos.test.acceptance.framework.loan.LoanAccountPage) QuestionResponseParameters(org.mifos.test.acceptance.framework.loan.QuestionResponseParameters) EditAccountStatusParameters(org.mifos.test.acceptance.framework.account.EditAccountStatusParameters) Test(org.testng.annotations.Test)

Aggregations

QuestionResponsePage (org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage)21 QuestionResponseParameters (org.mifos.test.acceptance.framework.loan.QuestionResponseParameters)10 ArrayList (java.util.ArrayList)9 Test (org.testng.annotations.Test)9 HashMap (java.util.HashMap)7 CreateQuestionParameters (org.mifos.test.acceptance.framework.questionnaire.CreateQuestionParameters)6 ViewQuestionResponseDetailPage (org.mifos.test.acceptance.framework.questionnaire.ViewQuestionResponseDetailPage)6 CreateLoanAccountSearchParameters (org.mifos.test.acceptance.framework.loan.CreateLoanAccountSearchParameters)5 CreateQuestionGroupParameters (org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters)5 LoanAccountPage (org.mifos.test.acceptance.framework.loan.LoanAccountPage)4 ClientViewDetailsPage (org.mifos.test.acceptance.framework.client.ClientViewDetailsPage)3 CreateClientEnterPersonalDataPage (org.mifos.test.acceptance.framework.client.CreateClientEnterPersonalDataPage)3 QuestionnairePage (org.mifos.test.acceptance.framework.questionnaire.QuestionnairePage)3 QuestionGroupTestHelper (org.mifos.test.acceptance.framework.testhelpers.QuestionGroupTestHelper)3 List (java.util.List)2 EditAccountStatusParameters (org.mifos.test.acceptance.framework.account.EditAccountStatusParameters)2 AdminPage (org.mifos.test.acceptance.framework.admin.AdminPage)2 CustomerChangeStatusPage (org.mifos.test.acceptance.framework.customer.CustomerChangeStatusPage)2 CustomerChangeStatusPreviewPage (org.mifos.test.acceptance.framework.customer.CustomerChangeStatusPreviewPage)2 CreateGroupSubmitParameters (org.mifos.test.acceptance.framework.group.CreateGroupEntryPage.CreateGroupSubmitParameters)2