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);
}
}
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);
}
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);
}
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");
}
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();
}
Aggregations