Search in sources :

Example 1 with QuestionResponsePage

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

the class ClientTest method createClientWithQuestionGroups.

@SuppressWarnings("PMD.SignatureDeclareThrowsException")
// http://mifosforge.jira.com/browse/MIFOSTEST-681
@Test(enabled = true)
public void createClientWithQuestionGroups() throws Exception {
    createQuestions();
    CreateQuestionGroupParameters qg = questionGroupTestHelper.getCreateQuestionGroupParameters("CreateClientQG", asList("q1", "q2", "q3"), "Create Client", "Sec 1");
    questionGroupTestHelper.createQuestionGroup(qg);
    CreateQuestionGroupParameters qg2 = questionGroupTestHelper.getCreateQuestionGroupParameters("CreateClientQG2", asList("q6"), "Create Client", "Sec 2");
    questionGroupTestHelper.createQuestionGroup(qg2);
    CreateClientEnterPersonalDataPage.SubmitFormParameters formParameters = createFormParameters();
    QuestionResponseParameters responseParams = new QuestionResponseParameters();
    responseParams.addSingleSelectAnswer("questionGroups[0].sectionDetails[0].questions[0].value", "yes");
    responseParams.addSingleSelectAnswer("questionGroups[0].sectionDetails[0].questions[1].value", "good");
    responseParams.addTextAnswer("questionGroups[0].sectionDetails[0].questions[2].value", "qwer");
    // When
    clientTestHelper.createClientWithQuestionGroups(formParameters, "group1", responseParams);
    List<String> questionToAdd = new ArrayList<String>();
    questionToAdd.add("q4");
    questionToAdd.add("q5");
    List<String> questionToDeactivate = new ArrayList<String>();
    questionToDeactivate.add("q6");
    CreateQuestionGroupParameters createQuestionGroupParameters = new CreateQuestionGroupParameters();
    for (String question : questionToAdd) {
        createQuestionGroupParameters.addExistingQuestion("Sec 1", question);
    }
    questionGroupTestHelper.addQuestionsToQuestionGroup("CreateClientQG", createQuestionGroupParameters.getExistingQuestions());
    for (String question : questionToDeactivate) {
        questionGroupTestHelper.markQuestionAsInactive(question);
    }
    questionGroupTestHelper.markQuestionGroupAsInactive("CreateClientQG2");
    QuestionResponsePage questionResponsePage = clientTestHelper.navigateToQuestionResponsePage(formParameters, "group1");
    // Then
    questionResponsePage.verifyQuestionsDoesnotappear(questionToDeactivate.toArray(new String[questionToDeactivate.size()]));
    questionResponsePage.verifyQuestionsExists(questionToAdd.toArray(new String[questionToAdd.size()]));
    questionResponsePage.verifySectionDoesnotappear("Sec 2");
    questionGroupTestHelper.markQuestionGroupAsInactive("CreateClientQG");
}
Also used : CreateClientEnterPersonalDataPage(org.mifos.test.acceptance.framework.client.CreateClientEnterPersonalDataPage) CreateQuestionGroupParameters(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters) QuestionResponsePage(org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage) ArrayList(java.util.ArrayList) QuestionResponseParameters(org.mifos.test.acceptance.framework.loan.QuestionResponseParameters) Test(org.testng.annotations.Test)

Example 2 with QuestionResponsePage

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

the class CreateLoanAccountEntryPage method populateCreateLoanQuestionResponsesIfNeeded.

private void populateCreateLoanQuestionResponsesIfNeeded(QuestionResponseParameters responseParameters, String pageId) {
    if (StringUtils.equalsIgnoreCase(pageId, "captureQuestionResponse")) {
        QuestionResponsePage responsePage = new QuestionResponsePage(selenium);
        responsePage.populateAnswers(responseParameters);
        responsePage.navigateToNextPage();
    } else if ("Exception".equals(pageId)) {
        String stackTrace = selenium.getText("css=div.stackTrace pre");
        Assert.fail("Expected page <???>, actual page <" + pageId + ">!!! with exception stack  > " + stackTrace);
    } else if (getErrors().length() > 0) {
        String errors = getErrors();
        Assert.fail("Expected page <???>, actual page <" + pageId + ">!!! with error message > " + errors);
    }
}
Also used : QuestionResponsePage(org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage)

Example 3 with QuestionResponsePage

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

the class CenterTestHelper method createCenterWithQuestionGroupsEdited.

public CenterViewDetailsPage createCenterWithQuestionGroupsEdited(CreateCenterEnterDataPage.SubmitFormParameters formParameters, String officeName, QuestionResponseParameters responseParams, QuestionResponseParameters responseParams2) {
    QuestionResponsePage responsePage = navigationHelper.navigateToClientsAndAccountsPage().navigateToCreateNewCenterPage().selectOffice(officeName).submitAndNavigateToQuestionResponsePage(formParameters);
    responsePage.populateAnswers(responseParams);
    responsePage.navigateToNextPage();
    new CreateCenterPreviewDataPage(selenium).navigateToEditQuestionResponsePage();
    responsePage.populateAnswers(responseParams2);
    responsePage.navigateToNextPage();
    return new CreateCenterPreviewDataPage(selenium).submit().navigateToCenterViewDetailsPage();
}
Also used : QuestionResponsePage(org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage) CreateCenterPreviewDataPage(org.mifos.test.acceptance.framework.center.CreateCenterPreviewDataPage)

Example 4 with QuestionResponsePage

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

the class ClientTestHelper method closeClientWithQG.

public ClientViewDetailsPage closeClientWithQG(String clientName, QuestionResponseParameters responseParamsAfterModyfication) {
    EditCustomerStatusParameters editCustomerStatusParameters = new EditCustomerStatusParameters();
    editCustomerStatusParameters.setClientStatus(ClientStatus.CLOSED);
    editCustomerStatusParameters.setClientCloseReason(ClientCloseReason.LEFT_PROGRAM);
    editCustomerStatusParameters.setNote("Close client account");
    ClientViewDetailsPage clientDetailsPage = navigationHelper.navigateToClientViewDetailsPage(clientName);
    CustomerChangeStatusPage statusChangePage = clientDetailsPage.navigateToCustomerChangeStatusPage();
    QuestionResponsePage questionResponsePage = statusChangePage.changeStatusAndNavigateToQuestionResponsePage(editCustomerStatusParameters);
    questionResponsePage.populateAnswers(responseParamsAfterModyfication);
    questionResponsePage.navigateToNextPage();
    new CustomerChangeStatusPreviewPage(selenium).submitAndGotoClientViewDetailsPage();
    return new ClientViewDetailsPage(selenium);
}
Also used : QuestionResponsePage(org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage) ClientViewDetailsPage(org.mifos.test.acceptance.framework.client.ClientViewDetailsPage) EditCustomerStatusParameters(org.mifos.test.acceptance.framework.group.EditCustomerStatusParameters) CustomerChangeStatusPage(org.mifos.test.acceptance.framework.customer.CustomerChangeStatusPage) CustomerChangeStatusPreviewPage(org.mifos.test.acceptance.framework.customer.CustomerChangeStatusPreviewPage)

Example 5 with QuestionResponsePage

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

the class GroupTestHelper method createGroupWithQuestionGroupsEdited.

public GroupViewDetailsPage createGroupWithQuestionGroupsEdited(CreateGroupSubmitParameters groupParams, String centerName, QuestionResponseParameters responseParams, QuestionResponseParameters responseParams2) {
    QuestionResponsePage responsePage = navigateToCreateGroupEntryPage(centerName).submitAndNavigateToQuestionResponsePage(groupParams);
    responsePage.populateAnswers(responseParams);
    responsePage.navigateToNextPage();
    new CreateGroupPreviewDataPage(selenium).navigateToEditQuestionResponsePage();
    responsePage.populateAnswers(responseParams2);
    responsePage.navigateToNextPage();
    return new CreateGroupPreviewDataPage(selenium).submitForApproval().navigateToGroupDetailsPage();
}
Also used : CreateGroupPreviewDataPage(org.mifos.test.acceptance.framework.group.CreateGroupPreviewDataPage) QuestionResponsePage(org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage)

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