Search in sources :

Example 1 with QuestionnairePage

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

the class ClientTest method checkMandatoryQuestionValidation.

private QuestionnairePage checkMandatoryQuestionValidation(String questionGroupTitle, String question1, String question2, ClientViewDetailsPage viewDetailsPage) {
    QuestionnairePage questionnairePage = viewDetailsPage.getQuestionnairePage(questionGroupTitle);
    questionnairePage.setResponsesForMultiSelect(question2, 4, "Choice1", "Choice3", "Choice4");
    MifosPage mifosPage = questionnairePage.submit();
    Assert.assertTrue(mifosPage instanceof QuestionnairePage);
    questionnairePage = (QuestionnairePage) mifosPage;
    Assert.assertTrue(questionnairePage.isErrorPresent("Please specify " + question1));
    return questionnairePage;
}
Also used : QuestionnairePage(org.mifos.test.acceptance.framework.questionnaire.QuestionnairePage) MifosPage(org.mifos.test.acceptance.framework.MifosPage)

Example 2 with QuestionnairePage

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

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

the class QuestionGroupTest method editResponses.

private void editResponses(ClientViewDetailsPage clientViewDetailsPage, int id, Map<String, String> answers) {
    QuestionGroupResponsePage questionGroupResponsePage = clientViewDetailsPage.navigateToQuestionGroupResponsePage(id);
    QuestionnairePage questionnairePage = questionGroupResponsePage.navigateToEditResponses();
    for (String question : answers.keySet()) {
        questionnairePage.setResponse(question, answers.get(question));
    }
    ClientViewDetailsPage clientViewDetailsPage2 = (ClientViewDetailsPage) questionnairePage.submit();
    Assert.assertEquals(clientViewDetailsPage2.getQuestionGroupInstances().get(id).getName(), "TestQuestionGroup");
}
Also used : QuestionGroupResponsePage(org.mifos.test.acceptance.framework.questionnaire.QuestionGroupResponsePage) QuestionnairePage(org.mifos.test.acceptance.framework.questionnaire.QuestionnairePage) ClientViewDetailsPage(org.mifos.test.acceptance.framework.client.ClientViewDetailsPage)

Example 4 with QuestionnairePage

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

the class QuestionGroupTestHelper method editResponses.

public void editResponses(ClientViewDetailsPage clientViewDetailsPage, int id, Map<String, String> answers) {
    QuestionGroupResponsePage questionGroupResponsePage = clientViewDetailsPage.navigateToQuestionGroupResponsePage(id);
    QuestionnairePage questionnairePage = questionGroupResponsePage.navigateToEditResponses();
    for (String question : answers.keySet()) {
        questionnairePage.setResponse(question, answers.get(question));
    }
    ClientViewDetailsPage clientViewDetailsPage2 = (ClientViewDetailsPage) questionnairePage.submit();
    if (clientViewDetailsPage2 != null && clientViewDetailsPage2.getQuestionGroupInstances() != null && clientViewDetailsPage2.getQuestionGroupInstances().size() > 2) {
        Assert.assertEquals(clientViewDetailsPage2.getQuestionGroupInstances().get(2).getName(), "TestQuestionGroup");
    }
}
Also used : QuestionGroupResponsePage(org.mifos.test.acceptance.framework.questionnaire.QuestionGroupResponsePage) QuestionnairePage(org.mifos.test.acceptance.framework.questionnaire.QuestionnairePage) ClientViewDetailsPage(org.mifos.test.acceptance.framework.client.ClientViewDetailsPage)

Example 5 with QuestionnairePage

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

the class QuestionGroupTestHelper method verifyErrorsWhileAttachingQuestionGroupToCenter.

public CenterViewDetailsPage verifyErrorsWhileAttachingQuestionGroupToCenter(AttachQuestionGroupParameters attachParams) {
    QuestionnairePage questionnairePage = (QuestionnairePage) navigationHelper.navigateToCenterViewDetailsPage(attachParams.getTarget()).navigateToAttachSurveyPage().selectSurvey(attachParams.getQuestionGroupName()).setResponses(attachParams.getTextResponses()).checkResponses(attachParams.getCheckResponses()).submitAndNavigateToCenterViewDetailsPage();
    questionnairePage.verifyErrorsOnPage(attachParams.getErrors());
    return questionnairePage.cancelAndNavigateToCenterViewDetailsPage();
}
Also used : QuestionnairePage(org.mifos.test.acceptance.framework.questionnaire.QuestionnairePage)

Aggregations

QuestionnairePage (org.mifos.test.acceptance.framework.questionnaire.QuestionnairePage)19 ClientViewDetailsPage (org.mifos.test.acceptance.framework.client.ClientViewDetailsPage)6 ArrayList (java.util.ArrayList)4 QuestionResponseParameters (org.mifos.test.acceptance.framework.loan.QuestionResponseParameters)4 MifosPage (org.mifos.test.acceptance.framework.MifosPage)3 CreateQuestionGroupParameters (org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters)3 CreateQuestionParameters (org.mifos.test.acceptance.framework.questionnaire.CreateQuestionParameters)3 QuestionGroupResponsePage (org.mifos.test.acceptance.framework.questionnaire.QuestionGroupResponsePage)3 QuestionResponsePage (org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage)3 ViewQuestionResponseDetailPage (org.mifos.test.acceptance.framework.questionnaire.ViewQuestionResponseDetailPage)3 Test (org.testng.annotations.Test)3 HashMap (java.util.HashMap)2 AttachSurveyPage (org.mifos.test.acceptance.framework.loan.AttachSurveyPage)2 SavingsAccountDetailPage (org.mifos.test.acceptance.framework.savings.SavingsAccountDetailPage)2 List (java.util.List)1 DateTime (org.joda.time.DateTime)1 AdminPage (org.mifos.test.acceptance.framework.admin.AdminPage)1 CenterViewDetailsPage (org.mifos.test.acceptance.framework.center.CenterViewDetailsPage)1 CreateCenterEnterDataPage (org.mifos.test.acceptance.framework.center.CreateCenterEnterDataPage)1 CreateGroupSubmitParameters (org.mifos.test.acceptance.framework.group.CreateGroupEntryPage.CreateGroupSubmitParameters)1