Search in sources :

Example 6 with CreateQuestionGroupPage

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);
    }
}
Also used : AdminPage(org.mifos.test.acceptance.framework.admin.AdminPage) CreateQuestionGroupPage(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupPage) Test(org.testng.annotations.Test)

Example 7 with CreateQuestionGroupPage

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);
}
Also used : AdminPage(org.mifos.test.acceptance.framework.admin.AdminPage) Random(java.util.Random) CreateQuestionGroupParameters(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters) CreateQuestionPage(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionPage) CreateQuestionGroupPage(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupPage)

Example 8 with CreateQuestionGroupPage

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);
}
Also used : CreateQuestionParameters(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionParameters) AdminPage(org.mifos.test.acceptance.framework.admin.AdminPage) CreateQuestionGroupPage(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupPage)

Example 9 with CreateQuestionGroupPage

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);
}
Also used : ManageRolePage(org.mifos.test.acceptance.framework.admin.ManageRolePage) AdminPage(org.mifos.test.acceptance.framework.admin.AdminPage) CreateQuestionGroupParameters(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters) ViewRolesPage(org.mifos.test.acceptance.framework.admin.ViewRolesPage) CreateQuestionGroupPage(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupPage) Test(org.testng.annotations.Test)

Aggregations

CreateQuestionGroupPage (org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupPage)9 AdminPage (org.mifos.test.acceptance.framework.admin.AdminPage)8 CreateQuestionGroupParameters (org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters)6 CreateQuestionPage (org.mifos.test.acceptance.framework.questionnaire.CreateQuestionPage)4 Test (org.testng.annotations.Test)2 Random (java.util.Random)1 ManageRolePage (org.mifos.test.acceptance.framework.admin.ManageRolePage)1 ViewRolesPage (org.mifos.test.acceptance.framework.admin.ViewRolesPage)1 CreateQuestionParameters (org.mifos.test.acceptance.framework.questionnaire.CreateQuestionParameters)1