Search in sources :

Example 1 with CreateUserParameters

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

the class AdminPage method getNonAdminUserParameters.

public CreateUserParameters getNonAdminUserParameters() {
    CreateUserParameters formParameters = new CreateUserParameters();
    formParameters.setFirstName("NonAdmin");
    formParameters.setLastName("User" + StringUtil.getRandomString(8));
    formParameters.setDateOfBirthDD("04");
    formParameters.setDateOfBirthMM("04");
    formParameters.setDateOfBirthYYYY("1986");
    formParameters.setGender(CreateUserParameters.MALE);
    formParameters.setUserLevel(CreateUserParameters.NON_LOAN_OFFICER);
    formParameters.setUserName("test" + StringUtil.getRandomString(5));
    formParameters.setPassword("tester");
    formParameters.setPasswordRepeat("tester");
    return formParameters;
}
Also used : CreateUserParameters(org.mifos.test.acceptance.framework.user.CreateUserParameters)

Example 2 with CreateUserParameters

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

the class PersonnelTest method createUserWithNonAdminRoleTest.

//http://mifosforge.jira.com/browse/MIFOSTEST-298
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
@Test(enabled = true, groups = { "acceptance" })
public void createUserWithNonAdminRoleTest() throws Exception {
    AdminPage adminPage = navigationHelper.navigateToAdminPage();
    CreateUserParameters formParameters = adminPage.getNonAdminUserParameters();
    //When
    userHelper.createUser(formParameters, "MyOfficeDHMFT");
    LoginPage loginPage = new AppLauncher(selenium).launchMifos();
    loginPage.verifyPage();
    //Then
    HomePage homePage = loginPage.loginSuccessfulAsWithChnagePasw(formParameters.getUserName(), formParameters.getPassword());
    homePage.verifyPage();
    adminPage = navigationHelper.navigateToAdminPageAsLogedUser(formParameters.getUserName(), "newPasw");
    adminPage.navigateToCreateUserPage();
    String error = selenium.getText("admin.error.message");
    Assert.assertEquals(error.contains("You do not have permissions to perform this activity. Contact your system administrator to grant you the required permissions and try again."), true);
}
Also used : AdminPage(org.mifos.test.acceptance.framework.admin.AdminPage) HomePage(org.mifos.test.acceptance.framework.HomePage) CreateUserParameters(org.mifos.test.acceptance.framework.user.CreateUserParameters) AppLauncher(org.mifos.test.acceptance.framework.AppLauncher) LoginPage(org.mifos.test.acceptance.framework.login.LoginPage) Test(org.testng.annotations.Test)

Example 3 with CreateUserParameters

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

the class PersonnelTest method createUserTest.

@SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void createUserTest() throws Exception {
    AdminPage adminPage = navigationHelper.navigateToAdminPage();
    CreateUserParameters formParameters = adminPage.getAdminUserParameters();
    //When
    userHelper.createUser(formParameters, "MyOfficeDHMFT");
    LoginPage loginPage = new AppLauncher(selenium).launchMifos();
    loginPage.verifyPage();
    //Then
    HomePage homePage = loginPage.loginSuccessfulAsWithChnagePasw(formParameters.getUserName(), formParameters.getPassword());
    homePage.verifyPage();
}
Also used : AdminPage(org.mifos.test.acceptance.framework.admin.AdminPage) HomePage(org.mifos.test.acceptance.framework.HomePage) CreateUserParameters(org.mifos.test.acceptance.framework.user.CreateUserParameters) AppLauncher(org.mifos.test.acceptance.framework.AppLauncher) LoginPage(org.mifos.test.acceptance.framework.login.LoginPage)

Example 4 with CreateUserParameters

use of org.mifos.test.acceptance.framework.user.CreateUserParameters 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 5 with CreateUserParameters

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

the class PersonnelTest method userPermissionRefreshingTest.

/**
     * This test checks if user permissions are refreshed properly
     * 
     * We create new user with Admin role
     * we log as this user and remove Admin rights
     * Then we check if we are allowed to define new fees
     * If error occurs then test passed 
     */
@Test(enabled = true)
public void userPermissionRefreshingTest() {
    //Given
    //center
    String officeName = "branch1";
    String accessDeniedElement = "admin.error.message";
    //new system user with Admin permissions
    String userName = "jtest1";
    String password = "jtest123";
    String userFirstName = "John";
    String userLastName = "Tester1";
    String adminRole = "Admin";
    CreateUserParameters userParameters = new CreateUserParameters();
    userParameters.setFirstName(userFirstName);
    userParameters.setLastName(userLastName);
    userParameters.setUserName(userName);
    userParameters.setPassword(password);
    userParameters.setPasswordRepeat(password);
    userParameters.setUserLevel(CreateUserParameters.NON_LOAN_OFFICER);
    userParameters.setDateOfBirthDD("10");
    userParameters.setDateOfBirthMM("10");
    userParameters.setDateOfBirthYYYY("1970");
    userParameters.setGender(CreateUserParameters.MALE);
    userParameters.setRole(adminRole);
    userHelper.createUser(userParameters, officeName);
    //When
    CreateUserParameters userParametersNewRole = new CreateUserParameters();
    userParametersNewRole.setRole("");
    navigationHelper.navigateToHomePageAsNewUser(userName, password).navigateToAdminPage().navigateToViewSystemUsersPage().searchAndNavigateToUserViewDetailsPage(userLastName).navigateToEditUserDataPage().submitAndGotoEditUserPreviewDataPage(userParametersNewRole).submit().navigateToAdminPageUsingHeaderTab().navigateToFeesCreate();
    //Then
    Assert.assertTrue(selenium.isElementPresent(accessDeniedElement));
}
Also used : CreateUserParameters(org.mifos.test.acceptance.framework.user.CreateUserParameters) Test(org.testng.annotations.Test)

Aggregations

CreateUserParameters (org.mifos.test.acceptance.framework.user.CreateUserParameters)11 AdminPage (org.mifos.test.acceptance.framework.admin.AdminPage)7 Test (org.testng.annotations.Test)4 HomePage (org.mifos.test.acceptance.framework.HomePage)3 LoginPage (org.mifos.test.acceptance.framework.login.LoginPage)3 AppLauncher (org.mifos.test.acceptance.framework.AppLauncher)2 ChooseOfficePage (org.mifos.test.acceptance.framework.office.ChooseOfficePage)2 UserHelper (org.mifos.test.acceptance.framework.testhelpers.UserHelper)2 CreateUserConfirmationPage (org.mifos.test.acceptance.framework.user.CreateUserConfirmationPage)2 CreateUserEnterDataPage (org.mifos.test.acceptance.framework.user.CreateUserEnterDataPage)2 CreateUserPreviewDataPage (org.mifos.test.acceptance.framework.user.CreateUserPreviewDataPage)2 EditUserDataPage (org.mifos.test.acceptance.framework.user.EditUserDataPage)2 EditUserPreviewDataPage (org.mifos.test.acceptance.framework.user.EditUserPreviewDataPage)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 MifosPage (org.mifos.test.acceptance.framework.MifosPage)1 ViewSystemUsersPage (org.mifos.test.acceptance.framework.admin.ViewSystemUsersPage)1 CreateCenterEnterDataPage (org.mifos.test.acceptance.framework.center.CreateCenterEnterDataPage)1