Search in sources :

Example 6 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 7 with QuestionResponsePage

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

the class CenterTest method createCenterTest.

/**
     * Capturing responses during the Center creation http://mifosforge.jira.com/browse/MIFOSTEST-665
     *
     * @throws Exception
     */
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
@Test(enabled = true)
public void createCenterTest() throws Exception {
    String officeName = "MyOfficeDHMFT";
    String qG1Name = "CreateCenterQG";
    String qG2Name = "CreateCenterQG2";
    createQuestions();
    CreateQuestionGroupParameters qG1 = questionTestHelper.getCreateQuestionGroupParameters(qG1Name, asList("center question 1", "center question 2", "center question 3"), "Create Center", "Sec 1");
    questionTestHelper.createQuestionGroup(qG1);
    CreateQuestionGroupParameters qG2 = questionTestHelper.getCreateQuestionGroupParameters(qG2Name, asList("center question 4", "center question 5", "center question 6"), "Create Center", "Sec 2");
    questionTestHelper.createQuestionGroup(qG2);
    String testCenterName = "Center" + StringUtil.getRandomString(6);
    CreateCenterEnterDataPage.SubmitFormParameters centerParams = getCenterParameters(testCenterName, "loan officer");
    QuestionResponseParameters responseParams = getQuestionResponseParameters("answer1");
    QuestionResponseParameters responseParams2 = getQuestionResponseParameters("answer2");
    List<CreateQuestionParameters> questionsList = new ArrayList<CreateQuestionParameters>();
    questionsList.add(newFreeTextQuestionParameters("new center question 1"));
    questionsList.add(newFreeTextQuestionParameters("new center question 2"));
    String[] newActiveQuestions = { "new center question 1", "center question 2" };
    String[] deactivateArray = { "center question 3", "center question 4" };
    List<String> deactivateList = Arrays.asList(deactivateArray);
    CenterViewDetailsPage centerViewDetailsPage = centerTestHelper.createCenterWithQuestionGroupsEdited(centerParams, officeName, responseParams, responseParams2);
    centerViewDetailsPage.navigateToViewAdditionalInformation().navigateBack();
    questionTestHelper.addNewQuestionsToQuestionGroup(qG1Name, questionsList);
    questionTestHelper.markQuestionsAsInactive(deactivateList);
    questionTestHelper.markQuestionGroupAsInactive(qG2Name);
    QuestionResponsePage responsePage = centerTestHelper.navigateToQuestionResponsePageWhenCreatingCenter(centerParams, officeName);
    responsePage.verifyQuestionsDoesnotappear(deactivateArray);
    responsePage.verifyQuestionsExists(newActiveQuestions);
    centerViewDetailsPage = centerTestHelper.navigateToCenterViewDetailsPage(testCenterName);
    centerViewDetailsPage.verifyActiveCenter(centerParams);
    ViewQuestionResponseDetailPage responseDetailsPage = centerViewDetailsPage.navigateToViewAdditionalInformation();
    responseDetailsPage.verifyQuestionsDoesnotappear(deactivateArray);
    responseDetailsPage.verifyEditButtonDisabled("1");
    QuestionnairePage questionnairePage = responseDetailsPage.navigateToEditSection("0");
    questionnairePage.verifyField("details[0].sectionDetails[0].questions[0].value", "");
    questionnairePage.verifyField("details[0].sectionDetails[0].questions[1].value", "");
    questionTestHelper.markQuestionGroupAsInactive(qG1Name);
}
Also used : CreateCenterEnterDataPage(org.mifos.test.acceptance.framework.center.CreateCenterEnterDataPage) ViewQuestionResponseDetailPage(org.mifos.test.acceptance.framework.questionnaire.ViewQuestionResponseDetailPage) CreateQuestionGroupParameters(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters) QuestionResponsePage(org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage) QuestionnairePage(org.mifos.test.acceptance.framework.questionnaire.QuestionnairePage) ArrayList(java.util.ArrayList) QuestionResponseParameters(org.mifos.test.acceptance.framework.loan.QuestionResponseParameters) CreateQuestionParameters(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionParameters) CenterViewDetailsPage(org.mifos.test.acceptance.framework.center.CenterViewDetailsPage) Test(org.testng.annotations.Test)

Example 8 with QuestionResponsePage

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

the class ClientTest method closeClientAccountWithQG.

// http://mifosforge.jira.com/browse/MIFOSTEST-663
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
@Test(enabled = true)
public void closeClientAccountWithQG() throws Exception {
    //Given
    String groupName = "group1";
    CreateClientEnterPersonalDataPage.SubmitFormParameters clientParams = clientParams();
    clientParams.setFirstName("John");
    clientParams.setLastName("Doe4321");
    ClientViewDetailsPage clientPage = clientTestHelper.createNewClient(groupName, clientParams);
    String clientName = clientPage.getGlobalCustNum();
    clientTestHelper.changeCustomerStatus(clientPage, ClientStatus.ACTIVE);
    createQuestions2();
    createQuestionGroup2();
    String qG_1 = "CloseClientQG";
    String qG_2 = "CloseClientQG2";
    QuestionResponseParameters responseParams = getQuestionResponseParametersForClientAccountClose("answer1");
    QuestionResponseParameters responseParams2 = getQuestionResponseParametersForClientAccountClose("answer2");
    QuestionResponseParameters responseParamsAfterModyfication = getQuestionResponseParametersForClientAccountCloseAfterModyfication("answer2");
    List<CreateQuestionParameters> questionsList = new ArrayList<CreateQuestionParameters>();
    questionsList.add(newFreeTextQuestionParameters("663new question 1"));
    questionsList.add(newFreeTextQuestionParameters("663new question 2"));
    questionsList.add(newFreeTextQuestionParameters("663new question 3"));
    String[] newActiveQuestions = { "663new question 1", "663new question 2" };
    String[] deactivateArray = { "663new question 3", question3, question6, question2, question5 };
    String[] deactivatedGroupArray = { question10, question11 };
    List<String> deactivateList = Arrays.asList(deactivateArray);
    Map<String, String> questionsAndAnswers = new HashMap<String, String>();
    questionsAndAnswers.put("663new question 1", "answer2");
    questionsAndAnswers.put("663new question 2", "answer2");
    questionsAndAnswers.put(question1, "24/01/2011");
    questionsAndAnswers.put(question4, "10");
    questionsAndAnswers.put(question7, "24/01/2011");
    questionsAndAnswers.put(question8, "jan");
    questionsAndAnswers.put(question9, "answer2");
    //When / Then
    QuestionResponsePage responsePage = clientTestHelper.navigateToQuestionResponsePageWhenCloseClientAccount(clientName);
    responsePage.populateAnswers(responseParams);
    responsePage.navigateToNextPage();
    responsePage = new CustomerChangeStatusPreviewPage(selenium).navigateToEditAdditionalInformation();
    responsePage.populateAnswers(responseParams2);
    responsePage.navigateToNextPage();
    new CustomerChangeStatusPreviewPage(selenium).cancelAndGotoClientViewDetailsPage();
    QuestionGroupTestHelper questionTestHelper = new QuestionGroupTestHelper(selenium);
    questionTestHelper.addNewQuestionsToQuestionGroup(qG_1, questionsList);
    questionTestHelper.markQuestionsAsInactive(deactivateList);
    questionTestHelper.markQuestionGroupAsInactive(qG_2);
    responsePage = clientTestHelper.navigateToQuestionResponsePageWhenCloseClientAccount(clientName);
    responsePage.verifyQuestionsDoesnotappear(deactivateArray);
    responsePage.verifyQuestionsDoesnotappear(deactivatedGroupArray);
    responsePage.verifyQuestionsExists(newActiveQuestions);
    clientTestHelper.closeClientWithQG(clientName, responseParamsAfterModyfication);
    verifyQuestionResponsesExistInDatabase(clientName, "Close Client", questionsAndAnswers);
    questionTestHelper.markQuestionsAsInactive(asList("663new question 1", "663new question 2", question1, question2, question4, question7, question8, question9, question10, question11));
    questionTestHelper.markQuestionGroupAsInactive(qG_1);
}
Also used : QuestionGroupTestHelper(org.mifos.test.acceptance.framework.testhelpers.QuestionGroupTestHelper) CreateClientEnterPersonalDataPage(org.mifos.test.acceptance.framework.client.CreateClientEnterPersonalDataPage) HashMap(java.util.HashMap) QuestionResponsePage(org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage) ClientViewDetailsPage(org.mifos.test.acceptance.framework.client.ClientViewDetailsPage) ArrayList(java.util.ArrayList) QuestionResponseParameters(org.mifos.test.acceptance.framework.loan.QuestionResponseParameters) CustomerChangeStatusPreviewPage(org.mifos.test.acceptance.framework.customer.CustomerChangeStatusPreviewPage) CreateQuestionParameters(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionParameters) Test(org.testng.annotations.Test)

Example 9 with QuestionResponsePage

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

the class GroupTest method createGroupWithQuestionGroup.

@Test(singleThreaded = true, groups = { "group", "acceptance", "ui", "no_db_unit" }, enabled = true)
// https://mifosforge.jira.com/browse/MIFOS-5850
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void createGroupWithQuestionGroup() throws Exception {
    //Given
    CreateQuestionGroupParameters questionGroupParams = new CreateQuestionGroupParameters();
    questionGroupParams.setTitle("CreateGroupQG");
    questionGroupParams.setAppliesTo("Create Group");
    questionGroupParams.setAnswerEditable(true);
    questionGroupParams.addExistingQuestion("Sec 1", "Date");
    questionGroupParams.addExistingQuestion("Sec 1", "ToBeDisabled");
    questionGroupParams.addExistingQuestion("Sec 2", "FreeText");
    questionGroupParams.addExistingQuestion("Sec 2", "SingleSelect");
    questionGroupTestHelper.createQuestionGroup(questionGroupParams);
    CreateQuestionGroupParameters questionGroupParams2 = new CreateQuestionGroupParameters();
    questionGroupParams2.setTitle("CreateGroupQG2");
    questionGroupParams2.setAppliesTo("Create Group");
    questionGroupParams2.setAnswerEditable(true);
    questionGroupParams2.addExistingQuestion("Sec 1", "DateQuestion");
    questionGroupParams2.addExistingQuestion("Sec 1", "Number");
    questionGroupParams2.addExistingQuestion("Sec 2", "MultiSelect");
    questionGroupParams2.addExistingQuestion("Sec 2", "Text");
    questionGroupTestHelper.createQuestionGroup(questionGroupParams2);
    CreateGroupSubmitParameters groupParams = new CreateGroupSubmitParameters();
    groupParams.setGroupName("GroupTest");
    String centerName = "Default Center";
    String qG_1 = "CreateGroupQG";
    String qG_2 = "CreateGroupQG2";
    QuestionResponseParameters responseParams = getQuestionResponseParametersForGroupCreation("answer1");
    QuestionResponseParameters responseParams2 = getQuestionResponseParametersForGroupCreation("answer2");
    List<CreateQuestionParameters> questionsList = new ArrayList<CreateQuestionParameters>();
    questionsList.add(newFreeTextQuestionParameters("new question 1"));
    questionsList.add(newFreeTextQuestionParameters("new question 2"));
    questionsList.add(newFreeTextQuestionParameters("new question 3"));
    String[] newActiveQuestions = { "new question 1", "new question 2" };
    String[] deactivateArray = { "new question 3", "SingleSelect", "ToBeDisabled" };
    String[] deactivatedGroupArray = { "MultiSelect", "DateQuestion" };
    List<String> deactivateList = Arrays.asList(deactivateArray);
    //When / Then
    GroupViewDetailsPage groupViewDetailsPage = groupTestHelper.createGroupWithQuestionGroupsEdited(groupParams, centerName, responseParams, responseParams2);
    groupViewDetailsPage.navigateToViewAdditionalInformationPage().navigateBack();
    QuestionGroupTestHelper questionTestHelper = new QuestionGroupTestHelper(selenium);
    questionTestHelper.addNewQuestionsToQuestionGroup(qG_1, questionsList);
    questionTestHelper.markQuestionsAsInactive(deactivateList);
    questionTestHelper.markQuestionGroupAsInactive(qG_2);
    QuestionResponsePage responsePage = groupTestHelper.navigateToQuestionResponsePageWhenCreatingGroup(groupParams, centerName);
    responsePage.verifyQuestionsDoesnotappear(deactivateArray);
    responsePage.verifyQuestionsDoesnotappear(deactivatedGroupArray);
    responsePage.verifyQuestionsExists(newActiveQuestions);
    groupViewDetailsPage = navigationHelper.navigateToGroupViewDetailsPage(groupParams.getGroupName());
    ViewQuestionResponseDetailPage responseDetailsPage = groupViewDetailsPage.navigateToViewAdditionalInformationPage();
    responseDetailsPage.verifyQuestionsDoesnotappear(deactivateArray);
    QuestionnairePage questionnairePage = responseDetailsPage.navigateToEditSection("0");
    questionnairePage.verifyField("details[0].sectionDetails[0].questions[0].value", "");
    questionnairePage.verifyField("details[0].sectionDetails[0].questions[1].value", "");
    questionGroupTestHelper.markQuestionGroupAsInactive(qG_1);
    questionTestHelper.markQuestionAsActive("SingleSelect");
    questionTestHelper.markQuestionAsActive("ToBeDisabled");
}
Also used : QuestionGroupTestHelper(org.mifos.test.acceptance.framework.testhelpers.QuestionGroupTestHelper) ViewQuestionResponseDetailPage(org.mifos.test.acceptance.framework.questionnaire.ViewQuestionResponseDetailPage) CreateGroupSubmitParameters(org.mifos.test.acceptance.framework.group.CreateGroupEntryPage.CreateGroupSubmitParameters) CreateQuestionGroupParameters(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters) QuestionResponsePage(org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage) GroupViewDetailsPage(org.mifos.test.acceptance.framework.group.GroupViewDetailsPage) QuestionnairePage(org.mifos.test.acceptance.framework.questionnaire.QuestionnairePage) ArrayList(java.util.ArrayList) QuestionResponseParameters(org.mifos.test.acceptance.framework.loan.QuestionResponseParameters) CreateQuestionParameters(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionParameters) Test(org.testng.annotations.Test)

Example 10 with QuestionResponsePage

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

the class LoanTestHelper method populateQuestionGroupResponses.

private void populateQuestionGroupResponses(QuestionResponseParameters responseParameters) {
    QuestionResponsePage responsePage = new QuestionResponsePage(selenium);
    responsePage.populateAnswers(responseParameters);
    responsePage.navigateToNextPage();
}
Also used : 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