use of org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupPage in project head by mifos.
the class QuestionGroupTest method createQuestionGroup.
@Test(enabled = true)
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void createQuestionGroup() throws Exception {
try {
AdminPage adminPage = createQuestions(qTitle1, qTitle2, qTitle3);
CreateQuestionGroupPage createQuestionGroupPage = getCreateQuestionGroupPage(adminPage);
testMissingMandatoryInputs(createQuestionGroupPage);
testCreateQuestionGroup(createQuestionGroupPage, qgTitle1, APPLIES_TO_CREATE_CLIENT, true, SECTION_DEFAULT, asList(qTitle1, qTitle2), asList(qTitle3), qTitle4);
testShouldAllowDuplicateTitlesForQuestionGroup();
testCancelCreateQuestionGroup(getCreateQuestionGroupPage(new AdminPage(selenium)));
testViewQuestionGroups();
} finally {
questionGroupTestHelper.markQuestionGroupAsInactive(qgTitle1);
questionGroupTestHelper.markQuestionGroupAsInactive(qgTitle2);
questionGroupTestHelper.markQuestionGroupAsInactive(qgTitle3);
}
}
use of org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupPage in project head by mifos.
the class ClientTest method createQuestionGroup.
private void createQuestionGroup() {
Random random = new Random();
questionGroupTitle = "QG1" + random.nextInt(100);
question1 = "FT_" + random.nextInt(100);
question2 = "MS_" + random.nextInt(100);
response = "Hello World";
AdminPage adminPage = navigationHelper.navigateToAdminPage();
CreateQuestionPage createQuestionPage = adminPage.navigateToCreateQuestionPage();
createQuestionPage.addQuestion(getCreateQuestionParams(question1, "Free Text", null));
createQuestionPage.addQuestion(getCreateQuestionParams(question2, MULTI_SELECT, asList("Choice1", "Choice2", "Choice3", "Choice4")));
adminPage = createQuestionPage.submitQuestions();
CreateQuestionGroupPage createQuestionGroupPage = adminPage.navigateToCreateQuestionGroupPage();
CreateQuestionGroupParameters parameters;
parameters = questionGroupTestHelper.getCreateQuestionGroupParameters(questionGroupTitle, asList(question1), "View Client", "Section1");
for (String section : parameters.getExistingQuestions().keySet()) {
createQuestionGroupPage.addExistingQuestion(section, parameters.getExistingQuestions().get(section));
}
createQuestionGroupPage.markEveryOtherQuestionsMandatory(asList(question1));
parameters = questionGroupTestHelper.getCreateQuestionGroupParameters(questionGroupTitle, asList(question2), "View Client", "Section2");
for (String section : parameters.getExistingQuestions().keySet()) {
createQuestionGroupPage.addExistingQuestion(section, parameters.getExistingQuestions().get(section));
}
createQuestionGroupPage.submit(parameters);
}
use of org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupPage in project head by mifos.
the class QuestionGroupTestHelper method createQuestionGroup.
public void createQuestionGroup(CreateQuestionGroupParameters createQuestionGroupParameters) {
AdminPage adminPage = navigationHelper.navigateToAdminPage();
CreateQuestionGroupPage createQuestionGroupPage = adminPage.navigateToCreateQuestionGroupPage();
for (String section : createQuestionGroupParameters.getExistingQuestions().keySet()) {
createQuestionGroupPage.addExistingQuestion(section, createQuestionGroupParameters.getExistingQuestions().get(section));
}
for (String section : createQuestionGroupParameters.getNewQuestions().keySet()) {
createQuestionGroupPage.setSection(section);
for (CreateQuestionParameters createQuestionParameters : createQuestionGroupParameters.getNewQuestions().get(section)) {
createQuestionGroupPage.addNewQuestion(createQuestionParameters);
}
}
createQuestionGroupPage.submit(createQuestionGroupParameters);
}
use of org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupPage in project head by mifos.
the class QuestionGroupTest method checkQuestionGroupPermission.
@Test(enabled = true)
public void checkQuestionGroupPermission() {
AdminPage adminPage = getAdminPage();
CreateQuestionGroupPage createQuestionGroupPage = getCreateQuestionGroupPage(adminPage);
CreateQuestionGroupParameters parameters = new CreateQuestionGroupParameters();
parameters.setTitle(qgTitle4);
parameters.setAppliesTo(APPLIES_TO_CREATE_CLIENT);
parameters.setAnswerEditable(true);
for (String question : asList(qTitle1, qTitle2)) {
parameters.addExistingQuestion(SECTION_DEFAULT, question);
}
for (String section : parameters.getExistingQuestions().keySet()) {
createQuestionGroupPage.addExistingQuestion(section, parameters.getExistingQuestions().get(section));
}
createQuestionGroupPage.submit(parameters);
ViewRolesPage rolesPage = adminPage.navigateToViewRolesPage();
ManageRolePage manageRolePage = rolesPage.navigateToManageRolePage(ADMIN_ROLE);
manageRolePage.verifyPermissionText(QUESTION_PERMISSION_ID, QUESTION_PERMISSION_HEADER + qgTitle4);
manageRolePage.disablePermission(QUESTION_PERMISSION_ID);
manageRolePage.submitAndGotoViewRolesPage();
adminPage = getAdminPage();
Assert.assertTrue(adminPage.navigateToViewAllQuestionGroups().navigateToQuestionGroupDetailPage(qgTitle4).isAccessDeniedDisplayed());
//set question group on inactive
adminPage.navigateBack();
adminPage.navigateToAdminPageUsingHeaderTab();
manageRolePage = adminPage.navigateToViewRolesPage().navigateToManageRolePage(ADMIN_ROLE);
manageRolePage.verifyPermissionText(QUESTION_PERMISSION_ID, QUESTION_PERMISSION_HEADER + qgTitle4);
manageRolePage.enablePermission(QUESTION_PERMISSION_ID);
manageRolePage.submitAndGotoViewRolesPage().navigateToAdminPage().navigateToViewAllQuestionGroups().navigateToQuestionGroupDetailPage(qgTitle4);
questionGroupTestHelper.markQuestionGroupAsInactive(qgTitle4);
}
Aggregations