use of org.mifos.test.acceptance.framework.questionnaire.CreateQuestionPage in project head by mifos.
the class QuestionGroupTest method testValidationAddQuestion.
private void testValidationAddQuestion() {
CreateQuestionPage createQuestionPage = questionGroupTestHelper.navigateToCreateQuestionPage();
CreateQuestionParameters createQuestionParameters = new CreateQuestionParameters();
createQuestionParameters.setText("");
createQuestionParameters.setType(CreateQuestionParameters.TYPE_FREE_TEXT);
createQuestionPage.addQuestion(createQuestionParameters);
createQuestionPage.verifyTextPresent("Please specify the question", "No text <Please specify the question> present on the page");
createQuestionPage.verifySubmitButtonStatus("true");
createQuestionPage.cancelQuestion();
createQuestionPage = questionGroupTestHelper.navigateToCreateQuestionPage();
createQuestionPage.setNumberQuestion("NumberQuestion", noNumber, noNumber);
createQuestionPage.verifyNumberQuestion("", "");
createQuestionPage.setNumberQuestion("NumberQuestion", "", "");
for (int i = 0; i < charactersList.size(); i++) {
createQuestionParameters.setText(charactersList.get(i));
createQuestionPage.addQuestion(createQuestionParameters);
createQuestionPage.verifyQuestionPresent(createQuestionParameters, i + 1);
}
}
use of org.mifos.test.acceptance.framework.questionnaire.CreateQuestionPage in project head by mifos.
the class QuestionGroupHelper method createQuestionGroupSmart.
@SuppressWarnings("unchecked")
public void createQuestionGroupSmart(String questionGroupTitle, String appliesTo, String question1, String choice1, String choice2, List<String> tag1, List<String> tag2) {
AdminPage adminPage = navigationHelper.navigateToAdminPage();
CreateQuestionPage createQuestionPage = adminPage.navigateToCreateQuestionPage();
createQuestionPage.addQuestion(getCreateQuestionParams(question1, "Smart Select", asList(choice1, choice2), asList(tag1, tag2)));
adminPage = createQuestionPage.submitQuestions();
CreateQuestionGroupPage createQuestionGroupPage = adminPage.navigateToCreateQuestionGroupPage();
CreateQuestionGroupParameters parameters = getCreateQuestionGroupParameters(questionGroupTitle, question1, appliesTo);
for (String section : parameters.getExistingQuestions().keySet()) {
createQuestionGroupPage.addExistingQuestion(section, parameters.getExistingQuestions().get(section));
}
createQuestionGroupPage.markEveryOtherQuestionsMandatory(asList(question1));
createQuestionGroupPage.submit(parameters);
}
use of org.mifos.test.acceptance.framework.questionnaire.CreateQuestionPage in project head by mifos.
the class QuestionGroupHelper method createQuestionGroup.
public void createQuestionGroup(String questionGroupTitle, String question1, String question2, String appliesTo) {
AdminPage adminPage = navigationHelper.navigateToAdminPage();
CreateQuestionPage createQuestionPage = adminPage.navigateToCreateQuestionPage();
createQuestionPage.addQuestion(getCreateQuestionParams(question1, CreateClientLoanAccountTest.DATE, null));
createQuestionPage.addQuestion(getCreateQuestionParams(question2, CreateClientLoanAccountTest.SINGLE_SELECT, asList("Choice1", "Choice2")));
adminPage = createQuestionPage.submitQuestions();
CreateQuestionGroupPage createQuestionGroupPage = adminPage.navigateToCreateQuestionGroupPage();
CreateQuestionGroupParameters parameters = getCreateQuestionGroupParameters(questionGroupTitle, question1, question2, appliesTo);
for (String section : parameters.getExistingQuestions().keySet()) {
createQuestionGroupPage.addExistingQuestion(section, parameters.getExistingQuestions().get(section));
}
createQuestionGroupPage.markEveryOtherQuestionsMandatory(asList(question1));
createQuestionGroupPage.submit(parameters);
}
use of org.mifos.test.acceptance.framework.questionnaire.CreateQuestionPage in project head by mifos.
the class GroupTest method createQuestionGroupForCreateGroup.
private void createQuestionGroupForCreateGroup(String questionGroupTitle, String question1, String question2, List<Choice> choices) {
AdminPage adminPage = navigationHelper.navigateToAdminPage();
CreateQuestionPage createQuestionPage = adminPage.navigateToCreateQuestionPage();
createQuestionPage.addQuestion(getCreateQuestionParams(question1, NUMBER, 10, 100, null));
createQuestionPage.addQuestion(getCreateQuestionParams(question2, SMART_SELECT, null, null, choices));
adminPage = createQuestionPage.submitQuestions();
CreateQuestionGroupPage createQuestionGroupPage = adminPage.navigateToCreateQuestionGroupPage();
CreateQuestionGroupParameters parameters = getCreateQuestionGroupParameters(questionGroupTitle, asList(question1, question2));
for (String section : parameters.getExistingQuestions().keySet()) {
createQuestionGroupPage.addExistingQuestion(section, parameters.getExistingQuestions().get(section));
}
createQuestionGroupPage.markEveryOtherQuestionsMandatory(asList(question1));
createQuestionGroupPage.submit(parameters);
}
use of org.mifos.test.acceptance.framework.questionnaire.CreateQuestionPage in project head by mifos.
the class QuestionGroupTest method createAndEditQuestionsTest.
/**
* Creating and editing Questions
* http://mifosforge.jira.com/browse/MIFOSTEST-700
*
* @throws Exception
*/
@Test(enabled = true)
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void createAndEditQuestionsTest() throws Exception {
//When
testValidationAddQuestion();
CreateQuestionPage createQuestionPage = questionGroupTestHelper.navigateToCreateQuestionPage();
CreateQuestionParameters createQuestionParameters = new CreateQuestionParameters();
createQuestionParameters.setText("TextQuestionTest");
createQuestionParameters.setType(CreateQuestionParameters.TYPE_FREE_TEXT);
createQuestionPage.addQuestion(createQuestionParameters);
createQuestionParameters.setText("DateQuestionTest");
createQuestionParameters.setType(CreateQuestionParameters.TYPE_DATE);
createQuestionPage.addQuestion(createQuestionParameters);
createQuestionParameters.setText("NumberQuestionTest");
createQuestionParameters.setType(CreateQuestionParameters.TYPE_NUMBER);
createQuestionParameters.setNumericMin(1);
createQuestionParameters.setNumericMax(10);
createQuestionPage.addQuestion(createQuestionParameters);
createQuestionParameters.setText("MultiSelectQuestionTest");
createQuestionParameters.setType(CreateQuestionParameters.TYPE_MULTI_SELECT);
List<Choice> choices = new ArrayList<Choice>();
Choice c = new Choice("choice 1", EMPTY_LIST);
choices.add(c);
c = new Choice("choice 2", EMPTY_LIST);
choices.add(c);
c = new Choice("choice 3", EMPTY_LIST);
choices.add(c);
createQuestionParameters.setChoices(choices);
createQuestionPage.addQuestion(createQuestionParameters);
createQuestionParameters.setText("SingleSelectQuestionTest");
createQuestionParameters.setType(CreateQuestionParameters.TYPE_SINGLE_SELECT);
createQuestionParameters.setChoices(choices);
createQuestionPage.addQuestion(createQuestionParameters);
createQuestionParameters.setText("SmartSelectQuestionTest");
createQuestionParameters.setChoices(choices);
createQuestionParameters.setType(CreateQuestionParameters.TYPE_SMART_SELECT);
createQuestionPage.addQuestion(createQuestionParameters);
AdminPage adminPage = createQuestionPage.submitQuestions();
ViewAllQuestionsPage viewAllQuestionsPage = adminPage.navigateToViewAllQuestions();
//Then
viewAllQuestionsPage.verifyQuestions(QUESTIONS.keySet());
//When
c = new Choice("answerChoice1", EMPTY_LIST);
choices.add(c);
c = new Choice("answerChoice3", EMPTY_LIST);
choices.add(c);
for (String question : QUESTIONS.keySet()) {
QuestionDetailPage questionDetailPage = viewAllQuestionsPage.navigateToQuestionDetail(question);
EditQuestionPage editQuestionPage = questionDetailPage.navigateToEditQuestionPage();
createQuestionParameters.setText("");
editQuestionPage.tryUpdate(createQuestionParameters);
//Then
editQuestionPage.verifyTextPresent("Please specify the question", "No text <Please specify the question> present on the page");
questionDetailPage = editQuestionPage.cancelEdit();
//When
editQuestionPage = questionDetailPage.navigateToEditQuestionPage();
for (String characters : charactersList) {
editQuestionPage.setQuestionName(characters);
editQuestionPage.verifyQuestionName(characters);
}
if ("NumberQuestionTest".equals(question)) {
editQuestionPage.setNumberQuestion(noNumber, noNumber);
editQuestionPage.verifyNumberQuestion("", "");
editQuestionPage.setNumberQuestion("", "");
} else if ("MultiSelectQuestionTest".equals(question) || "SingleSelectQuestionTest".equals(question)) {
editQuestionPage.addAnswerChoices(asList("answerChoice1", "answerChoice2", "answerChoice3"));
editQuestionPage.removeAnswerChoice("4");
} else if ("SmartSelectQuestionTest".equals(question)) {
editQuestionPage.addSmartAnswerChoices(asList("answerChoice1", "answerChoice2", "answerChoice3"));
editQuestionPage.removeAnswerChoice("4");
}
editQuestionPage.setQuestionName(question + "Edit");
questionDetailPage = editQuestionPage.deactivate();
//Then
questionDetailPage.verifyQuestionTitle(question + "Edit");
if ("MultiSelectQuestionTest".equals(question) || "SingleSelectQuestionTest".equals(question) || "SmartSelectQuestionTest".equals(question)) {
questionDetailPage.assertForChoices(QUESTIONS.get(question), choices);
}
viewAllQuestionsPage = questionDetailPage.navigateToViewAllQuestionsPage();
}
}
Aggregations