Search in sources :

Example 11 with CreateQuestionParameters

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

the class ClientTest method getCreateQuestionParams.

private CreateQuestionParameters getCreateQuestionParams(String title, String type, List<String> choices) {
    CreateQuestionParameters parameters = new CreateQuestionParameters();
    parameters.setText(title);
    parameters.setType(type);
    parameters.setChoicesFromStrings(choices);
    return parameters;
}
Also used : CreateQuestionParameters(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionParameters)

Example 12 with CreateQuestionParameters

use of org.mifos.test.acceptance.framework.questionnaire.CreateQuestionParameters 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 13 with CreateQuestionParameters

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

the class GroupTest method getCreateQuestionParams.

private CreateQuestionParameters getCreateQuestionParams(String title, String type, Integer numericMin, Integer numericMax, List<Choice> choices) {
    CreateQuestionParameters parameters = new CreateQuestionParameters();
    parameters.setText(title);
    parameters.setType(type);
    parameters.setChoices(choices);
    parameters.setNumericMin(numericMin);
    parameters.setNumericMax(numericMax);
    return parameters;
}
Also used : CreateQuestionParameters(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionParameters)

Example 14 with CreateQuestionParameters

use of org.mifos.test.acceptance.framework.questionnaire.CreateQuestionParameters 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 15 with CreateQuestionParameters

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

the class QuestionGroupTestHelper method createQuestions.

public void createQuestions(List<CreateQuestionParameters> questions) {
    AdminPage adminPage = navigationHelper.navigateToAdminPage();
    CreateQuestionPage createQuestionPage = adminPage.navigateToCreateQuestionPage();
    for (CreateQuestionParameters question : questions) {
        createQuestionPage.addQuestion(question);
    }
    adminPage = createQuestionPage.submitQuestions();
}
Also used : CreateQuestionParameters(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionParameters) AdminPage(org.mifos.test.acceptance.framework.admin.AdminPage) CreateQuestionPage(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionPage)

Aggregations

CreateQuestionParameters (org.mifos.test.acceptance.framework.questionnaire.CreateQuestionParameters)26 ArrayList (java.util.ArrayList)13 QuestionResponseParameters (org.mifos.test.acceptance.framework.loan.QuestionResponseParameters)7 Test (org.testng.annotations.Test)7 QuestionResponsePage (org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage)6 HashMap (java.util.HashMap)5 CreateQuestionGroupParameters (org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters)4 CreateQuestionPage (org.mifos.test.acceptance.framework.questionnaire.CreateQuestionPage)4 AdminPage (org.mifos.test.acceptance.framework.admin.AdminPage)3 CreateLoanAccountSearchParameters (org.mifos.test.acceptance.framework.loan.CreateLoanAccountSearchParameters)3 LoanAccountPage (org.mifos.test.acceptance.framework.loan.LoanAccountPage)3 QuestionnairePage (org.mifos.test.acceptance.framework.questionnaire.QuestionnairePage)3 ViewQuestionResponseDetailPage (org.mifos.test.acceptance.framework.questionnaire.ViewQuestionResponseDetailPage)3 Choice (org.mifos.test.acceptance.framework.questionnaire.Choice)2 QuestionGroupTestHelper (org.mifos.test.acceptance.framework.testhelpers.QuestionGroupTestHelper)2 DateTime (org.joda.time.DateTime)1 AppLauncher (org.mifos.test.acceptance.framework.AppLauncher)1 EditAccountStatusParameters (org.mifos.test.acceptance.framework.account.EditAccountStatusParameters)1 CenterViewDetailsPage (org.mifos.test.acceptance.framework.center.CenterViewDetailsPage)1 CreateCenterEnterDataPage (org.mifos.test.acceptance.framework.center.CreateCenterEnterDataPage)1