Search in sources :

Example 1 with CreateUserEnterDataPage

use of org.mifos.test.acceptance.framework.user.CreateUserEnterDataPage in project head by mifos.

the class UserHelper method createUser.

/**
     * Creates a user.
     * @param userParameters Parameters for the user that is created.
     * @param officeName The name of the office that this user will belong to.
     * @return The user details page for the newly created user.
     */
public UserViewDetailsPage createUser(CreateUserParameters userParameters, String officeName) {
    ChooseOfficePage chooseOfficePage = navigationHelper.navigateToCreateUserPage();
    CreateUserEnterDataPage userEnterDataPage = chooseOfficePage.selectOffice(officeName);
    CreateUserPreviewDataPage userPreviewDataPage = userEnterDataPage.submitAndGotoCreateUserPreviewDataPage(userParameters);
    CreateUserConfirmationPage userConfirmationPage = userPreviewDataPage.submit();
    userConfirmationPage.verifyPage();
    UserViewDetailsPage userDetailsPage = userConfirmationPage.navigateToUserViewDetailsPage();
    userDetailsPage.verifyPage();
    if (userParameters.getSecondLastName() == null) {
        Assert.assertTrue(userDetailsPage.getFullName().contains(userParameters.getFirstName() + " " + userParameters.getLastName()));
    } else if (userParameters.getSecondLastName() != null) {
        Assert.assertTrue(userDetailsPage.getFullName().contains(userParameters.getFirstName() + " " + userParameters.getSecondLastName() + " " + userParameters.getLastName()));
    }
    return userDetailsPage;
}
Also used : CreateUserPreviewDataPage(org.mifos.test.acceptance.framework.user.CreateUserPreviewDataPage) CreateUserEnterDataPage(org.mifos.test.acceptance.framework.user.CreateUserEnterDataPage) CreateUserConfirmationPage(org.mifos.test.acceptance.framework.user.CreateUserConfirmationPage) ChooseOfficePage(org.mifos.test.acceptance.framework.office.ChooseOfficePage) UserViewDetailsPage(org.mifos.test.acceptance.framework.user.UserViewDetailsPage)

Example 2 with CreateUserEnterDataPage

use of org.mifos.test.acceptance.framework.user.CreateUserEnterDataPage in project head by mifos.

the class PersonnelTest method changePasswordTest.

//http://mifosforge.jira.com/browse/MIFOSTEST-296
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void changePasswordTest() throws Exception {
    HomePage homePage = loginSuccessfully();
    AdminPage adminPage = homePage.navigateToAdminPage();
    CreateUserParameters userParameters = adminPage.getAdminUserParameters();
    ChooseOfficePage createUserPage = adminPage.navigateToCreateUserPage();
    createUserPage.verifyPage();
    CreateUserEnterDataPage userEnterDataPage = createUserPage.selectOffice("MyOfficeDHMFT");
    CreateUserPreviewDataPage userPreviewDataPage = userEnterDataPage.submitAndGotoCreateUserPreviewDataPage(userParameters);
    CreateUserConfirmationPage userConfirmationPage = userPreviewDataPage.submit();
    //Then
    userConfirmationPage.verifyPage();
    UserViewDetailsPage userDetailsPage = userConfirmationPage.navigateToUserViewDetailsPage();
    userDetailsPage.verifyPage();
    Assert.assertTrue(userDetailsPage.getFullName().contains(userParameters.getFirstName() + " " + userParameters.getLastName()));
    //When
    EditUserDataPage editUserPage = userDetailsPage.navigateToEditUserDataPage();
    CreateUserParameters passwordParameters = new CreateUserParameters();
    passwordParameters.setPassword("tester1");
    passwordParameters.setPasswordRepeat("tester");
    //Then
    editUserPage = editUserPage.submitWithInvalidData(passwordParameters);
    editUserPage.verifyPasswordChangeError();
    //When
    passwordParameters.setPasswordRepeat("tester1");
    //Then
    EditUserPreviewDataPage editPreviewDataPage = editUserPage.submitAndGotoEditUserPreviewDataPage(passwordParameters);
    UserViewDetailsPage submitUserpage = editPreviewDataPage.submit();
    submitUserpage.verifyPage();
    //When
    LoginPage loginPage = (new MifosPage(selenium)).logout();
    // tester1
    ChangePasswordPage changePasswordPage = loginPage.loginAndGoToChangePasswordPageAs(userParameters.getUserName(), passwordParameters.getPassword());
    ChangePasswordPage.SubmitFormParameters changePasswordParameters = new ChangePasswordPage.SubmitFormParameters();
    // wrong old password
    changePasswordParameters.setOldPassword("tester");
    // empty new password
    changePasswordParameters.setNewPassword("");
    changePasswordParameters.setConfirmPassword("");
    //Then
    changePasswordPage = changePasswordPage.submitWithInvalidData(changePasswordParameters);
    //When
    //wrong old password with good new
    changePasswordParameters.setNewPassword("tester2");
    changePasswordParameters.setConfirmPassword("tester2");
    //Then
    changePasswordPage = changePasswordPage.submitWithInvalidData(changePasswordParameters);
    //When
    // good old password and good new
    changePasswordParameters.setOldPassword("tester1");
    changePasswordParameters.setNewPassword("tester2");
    changePasswordParameters.setConfirmPassword("tester2");
    //Then
    HomePage homePage2 = changePasswordPage.submitAndGotoHomePage(changePasswordParameters);
    Assert.assertTrue(homePage2.getWelcome().contains(userParameters.getFirstName()));
    loginPage = (new MifosPage(selenium)).logout();
    homePage = loginPage.loginSuccessfulAs(userParameters.getUserName(), "tester2");
    changePasswordPage = homePage.navigateToYourSettingsPage().navigateToChangePasswordPage();
    changePasswordPage = changePasswordPage.submitWithInvalidData(changePasswordParameters);
    //When
    //wrong old password with good new
    changePasswordParameters.setNewPassword("tester2");
    changePasswordParameters.setConfirmPassword("tester2");
    //Then
    changePasswordPage = changePasswordPage.submitWithInvalidData(changePasswordParameters);
    //When
    // good old password and good new
    changePasswordParameters.setOldPassword("tester2");
    changePasswordParameters.setNewPassword("tester3");
    changePasswordParameters.setConfirmPassword("tester3");
    changePasswordPage.submitAndGotoHomePage(changePasswordParameters);
    loginPage = (new MifosPage(selenium)).logout();
    homePage = loginPage.loginSuccessfulAs(userParameters.getUserName(), changePasswordParameters.getNewPassword());
    Assert.assertTrue(homePage.getWelcome().contains(userParameters.getFirstName()));
}
Also used : AdminPage(org.mifos.test.acceptance.framework.admin.AdminPage) CreateUserEnterDataPage(org.mifos.test.acceptance.framework.user.CreateUserEnterDataPage) CreateUserConfirmationPage(org.mifos.test.acceptance.framework.user.CreateUserConfirmationPage) ChooseOfficePage(org.mifos.test.acceptance.framework.office.ChooseOfficePage) UserViewDetailsPage(org.mifos.test.acceptance.framework.user.UserViewDetailsPage) EditUserDataPage(org.mifos.test.acceptance.framework.user.EditUserDataPage) MifosPage(org.mifos.test.acceptance.framework.MifosPage) LoginPage(org.mifos.test.acceptance.framework.login.LoginPage) CreateUserPreviewDataPage(org.mifos.test.acceptance.framework.user.CreateUserPreviewDataPage) EditUserPreviewDataPage(org.mifos.test.acceptance.framework.user.EditUserPreviewDataPage) HomePage(org.mifos.test.acceptance.framework.HomePage) CreateUserParameters(org.mifos.test.acceptance.framework.user.CreateUserParameters) ChangePasswordPage(org.mifos.test.acceptance.framework.login.ChangePasswordPage)

Example 3 with CreateUserEnterDataPage

use of org.mifos.test.acceptance.framework.user.CreateUserEnterDataPage in project head by mifos.

the class PersonnelTest method createUserWithQuestionGroup.

//http://mifosforge.jira.com/browse/MIFOSTEST-670
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void createUserWithQuestionGroup() throws Exception {
    //Given
    createQuestions();
    //When
    Map<String, List<String>> sectionQuestions = new HashMap<String, List<String>>();
    List<String> questions = new ArrayList<String>();
    questions.add("user question 1");
    sectionQuestions.put("Sec 1", questions);
    questions = new ArrayList<String>();
    questions.add("user question 2");
    questions.add("user question 3");
    sectionQuestions.put("Sec 2", questions);
    CreateQuestionGroupParameters createQuestionGroupParameters = new CreateQuestionGroupParameters();
    createQuestionGroupParameters.setAnswerEditable(true);
    createQuestionGroupParameters.setAppliesTo("Create Personnel");
    createQuestionGroupParameters.setTitle("Create Personnel QG1");
    createQuestionGroupParameters.setExistingQuestions(sectionQuestions);
    questionGroupTestHelper.createQuestionGroup(createQuestionGroupParameters);
    sectionQuestions = new HashMap<String, List<String>>();
    questions = new ArrayList<String>();
    questions.add("user question 4");
    sectionQuestions.put("Sec 3", questions);
    createQuestionGroupParameters = new CreateQuestionGroupParameters();
    createQuestionGroupParameters.setAnswerEditable(true);
    createQuestionGroupParameters.setAppliesTo("Create Personnel");
    createQuestionGroupParameters.setTitle("Create Personnel QG2");
    createQuestionGroupParameters.setExistingQuestions(sectionQuestions);
    questionGroupTestHelper.createQuestionGroup(createQuestionGroupParameters);
    AdminPage adminPage = navigationHelper.navigateToAdminPage();
    CreateUserParameters userParameters = adminPage.getAdminUserParameters();
    ChooseOfficePage createUserPage = adminPage.navigateToCreateUserPage();
    createUserPage.verifyPage();
    CreateUserEnterDataPage userEnterDataPage = createUserPage.selectOffice("MyOfficeDHMFT");
    QuestionResponsePage questionResponsePage = userEnterDataPage.submitAndNavigateToQuestionResponsePage(userParameters);
    questionResponsePage.verifyPage();
    QuestionResponseParameters responseParameters = new QuestionResponseParameters();
    responseParameters.addSingleSelectAnswer("questionGroups[0].sectionDetails[0].questions[0].value", "yes");
    responseParameters.addTextAnswer("questionGroups[0].sectionDetails[1].questions[1].value", "text1");
    questionResponsePage.populateAnswers(responseParameters);
    CreateUserPreviewDataPage createUserPreviewDataPage = questionResponsePage.continueAndNavigateToCreateUserPreviewPage();
    questionResponsePage = createUserPreviewDataPage.navigateToEditAdditionalInformation();
    questionResponsePage.populateTextAnswer("questionGroups[0].sectionDetails[1].questions[1].value", "text2");
    createUserPreviewDataPage = questionResponsePage.continueAndNavigateToCreateUserPreviewPage();
    CreateUserConfirmationPage userConfirmationPage = createUserPreviewDataPage.submit();
    QuestionnairePage questionnairePage = userConfirmationPage.navigateToUserViewDetailsPage().navigateToQuestionnairePage();
    //Then
    questionnairePage.verifyRadioGroup("details[0].sectionDetails[0].questions[0].value", "yes", true);
    questionnairePage.verifyRadioGroup("details[0].sectionDetails[1].questions[0].value", "good", false);
    questionnairePage.verifyField("details[0].sectionDetails[1].questions[1].value", "text2");
    //When
    questionnairePage.typeText("details[0].sectionDetails[1].questions[1].value", "text3");
    questionnairePage.submitAndNavigateToPersonnalDetailsPage();
    List<String> questionToAdd = new ArrayList<String>();
    questionToAdd.add("user question 5");
    questionToAdd.add("user question 6");
    List<String> questionToDesactivate = new ArrayList<String>();
    questionToDesactivate.add("user question 1");
    questionToDesactivate.add("user question 2");
    questionToDesactivate.add("user question 3");
    createQuestionGroupParameters = new CreateQuestionGroupParameters();
    for (String question : questionToAdd) {
        createQuestionGroupParameters.addExistingQuestion("Sec 1", question);
    }
    questionGroupTestHelper.addQuestionsToQuestionGroup("Create Personnel QG1", createQuestionGroupParameters.getExistingQuestions());
    for (String question : questionToDesactivate) {
        questionGroupTestHelper.markQuestionAsInactive(question);
    }
    questionGroupTestHelper.markQuestionGroupAsInactive("Create Personnel QG2");
    adminPage = navigationHelper.navigateToAdminPage();
    userParameters = adminPage.getAdminUserParameters();
    createUserPage = adminPage.navigateToCreateUserPage();
    createUserPage.verifyPage();
    userEnterDataPage = createUserPage.selectOffice("MyOfficeDHMFT");
    questionResponsePage = userEnterDataPage.submitAndNavigateToQuestionResponsePage(userParameters);
    questionResponsePage.verifyPage();
    //Then
    questionResponsePage.verifyQuestionsDoesnotappear(questionToDesactivate.toArray(new String[questionToDesactivate.size()]));
    questionResponsePage.verifyQuestionsExists(questionToAdd.toArray(new String[questionToAdd.size()]));
    questionResponsePage.verifySectionDoesnotappear("Sec 2");
    questionGroupTestHelper.markQuestionGroupAsInactive("Create Personnel QG1");
}
Also used : AdminPage(org.mifos.test.acceptance.framework.admin.AdminPage) CreateQuestionGroupParameters(org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters) HashMap(java.util.HashMap) QuestionResponsePage(org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage) CreateUserEnterDataPage(org.mifos.test.acceptance.framework.user.CreateUserEnterDataPage) QuestionnairePage(org.mifos.test.acceptance.framework.questionnaire.QuestionnairePage) ArrayList(java.util.ArrayList) CreateUserConfirmationPage(org.mifos.test.acceptance.framework.user.CreateUserConfirmationPage) ChooseOfficePage(org.mifos.test.acceptance.framework.office.ChooseOfficePage) QuestionResponseParameters(org.mifos.test.acceptance.framework.loan.QuestionResponseParameters) CreateUserPreviewDataPage(org.mifos.test.acceptance.framework.user.CreateUserPreviewDataPage) CreateUserParameters(org.mifos.test.acceptance.framework.user.CreateUserParameters) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

ChooseOfficePage (org.mifos.test.acceptance.framework.office.ChooseOfficePage)3 CreateUserConfirmationPage (org.mifos.test.acceptance.framework.user.CreateUserConfirmationPage)3 CreateUserEnterDataPage (org.mifos.test.acceptance.framework.user.CreateUserEnterDataPage)3 CreateUserPreviewDataPage (org.mifos.test.acceptance.framework.user.CreateUserPreviewDataPage)3 AdminPage (org.mifos.test.acceptance.framework.admin.AdminPage)2 CreateUserParameters (org.mifos.test.acceptance.framework.user.CreateUserParameters)2 UserViewDetailsPage (org.mifos.test.acceptance.framework.user.UserViewDetailsPage)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 HomePage (org.mifos.test.acceptance.framework.HomePage)1 MifosPage (org.mifos.test.acceptance.framework.MifosPage)1 QuestionResponseParameters (org.mifos.test.acceptance.framework.loan.QuestionResponseParameters)1 ChangePasswordPage (org.mifos.test.acceptance.framework.login.ChangePasswordPage)1 LoginPage (org.mifos.test.acceptance.framework.login.LoginPage)1 CreateQuestionGroupParameters (org.mifos.test.acceptance.framework.questionnaire.CreateQuestionGroupParameters)1 QuestionResponsePage (org.mifos.test.acceptance.framework.questionnaire.QuestionResponsePage)1 QuestionnairePage (org.mifos.test.acceptance.framework.questionnaire.QuestionnairePage)1 EditUserDataPage (org.mifos.test.acceptance.framework.user.EditUserDataPage)1 EditUserPreviewDataPage (org.mifos.test.acceptance.framework.user.EditUserPreviewDataPage)1