Search in sources :

Example 1 with UserAdminPage

use of org.olat.selenium.page.user.UserAdminPage in project OpenOLAT by OpenOLAT.

the class UserTest method importExistingUsers.

/**
 * Import 1 new user and 1 existing, change the password and the last name
 * of the existing user.
 *
 * @param loginPage
 * @param existingUserBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void importExistingUsers(@InitialPage LoginPage loginPage, @Drone @User WebDriver existingUserBrowser, @Drone @Student WebDriver newUserBrowser) throws IOException, URISyntaxException {
    UserVO user1 = new UserRestClient(deploymentUrl).createRandomUser("tsukune");
    // login
    loginPage.assertOnLoginPage().loginAs("administrator", "openolat").resume();
    UserAdminPage userAdminPage = navBar.openUserManagement().openImportUsers();
    // start import wizard
    ImportUserPage importWizard = userAdminPage.startImport();
    String uuid = UUID.randomUUID().toString();
    String username1 = "moka-" + uuid;
    StringBuilder csv = new StringBuilder();
    UserVO newUser = importWizard.append(username1, "rosario02", "Moka", "Akashiya", csv);
    user1 = importWizard.append(user1, "Aono", "openolat2", csv);
    importWizard.fill(csv.toString()).nextData().assertGreen(1).assertWarn(1).updatePasswords().updateUsers().nextOverview().nextGroups().finish();
    OOGraphene.waitAndCloseBlueMessageWindow(browser);
    // existing user log in with its new password and check if its name was updated
    LoginPage userLoginPage = LoginPage.getLoginPage(existingUserBrowser, deploymentUrl);
    // tools
    userLoginPage.loginAs(user1.getLogin(), "openolat2").resume().assertLoggedInByLastName("Aono");
    // new user log in
    LoginPage newLoginPage = LoginPage.getLoginPage(newUserBrowser, deploymentUrl);
    // tools
    newLoginPage.loginAs(newUser.getLogin(), "rosario02").resume().assertLoggedInByLastName("Akashiya");
}
Also used : UserVO(org.olat.user.restapi.UserVO) UserAdminPage(org.olat.selenium.page.user.UserAdminPage) ImportUserPage(org.olat.selenium.page.user.ImportUserPage) LoginPage(org.olat.selenium.page.LoginPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 2 with UserAdminPage

use of org.olat.selenium.page.user.UserAdminPage in project openolat by klemens.

the class UserTest method importUsers.

/**
 * Import 2 new users and check if the first can log in.
 *
 * @param loginPage
 * @param userBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void importUsers(@InitialPage LoginPage loginPage, @Drone @User WebDriver userBrowser) throws IOException, URISyntaxException {
    // login
    loginPage.assertOnLoginPage().loginAs("administrator", "openolat").resume();
    UserAdminPage userAdminPage = navBar.openUserManagement().openImportUsers();
    // start import wizard
    ImportUserPage importWizard = userAdminPage.startImport();
    String uuid = UUID.randomUUID().toString();
    String username1 = "moka-" + uuid;
    String username2 = "mizore-" + uuid;
    StringBuilder csv = new StringBuilder();
    UserVO user1 = importWizard.append(username1, "rosario01", "Moka", "Akashiya", csv);
    importWizard.append(username2, "vampire01", "Mizore", "Shirayuki", csv);
    importWizard.fill(csv.toString()).nextData().assertGreen(2).nextOverview().nextGroups().finish();
    OOGraphene.waitAndCloseBlueMessageWindow(browser);
    // user log in
    LoginPage userLoginPage = LoginPage.getLoginPage(userBrowser, deploymentUrl);
    // tools
    userLoginPage.loginAs(username1, "rosario01").resume().assertLoggedIn(user1);
}
Also used : UserVO(org.olat.user.restapi.UserVO) UserAdminPage(org.olat.selenium.page.user.UserAdminPage) ImportUserPage(org.olat.selenium.page.user.ImportUserPage) LoginPage(org.olat.selenium.page.LoginPage) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 3 with UserAdminPage

use of org.olat.selenium.page.user.UserAdminPage in project openolat by klemens.

the class UserTest method deleteUser.

/**
 * Test if deleted user cannot login anymore. An administrator
 * create a user. This user log in and log out. The administrator
 * use the direct delete workflow in user management to delete
 * it.<br>
 * The user try to log in again, unsuccessfully. The
 * administrator doesn't find it anymore in the user
 * search of the user management tab.
 */
@Test
@RunAsClient
public void deleteUser(@InitialPage LoginPage loginPage, @Drone @User WebDriver userBrowser) {
    // login
    loginPage.assertOnLoginPage().loginAs("administrator", "openolat").resume();
    String uuid = UUID.randomUUID().toString();
    String username = "miku-" + uuid;
    String lastName = "Hatsune" + uuid;
    UserVO userVo = UserAdminPage.createUserVO(username, "Miku", lastName, "miku-" + uuid + "@openolat.com", "miku01");
    UserAdminPage userAdminPage = navBar.openUserManagement().openCreateUser().fillUserForm(userVo).assertOnUserEditView(username);
    // user log in
    LoginPage userLoginPage = LoginPage.getLoginPage(userBrowser, deploymentUrl);
    // tools
    userLoginPage.loginAs(username, "miku01").resume().assertLoggedIn(userVo);
    // log out
    new UserToolsPage(userBrowser).logout();
    // admin delete
    userAdminPage.openDirectDeleteUser().searchUserToDelete(username).selectAndDeleteUser(lastName);
    // user try the login
    userLoginPage = LoginPage.getLoginPage(userBrowser, deploymentUrl);
    userLoginPage.loginDenied(username, "miku01");
    // assert on error message
    By errorMessageby = By.cssSelector("div.modal-body.alert.alert-danger");
    OOGraphene.waitElement(errorMessageby, 2, userBrowser);
    // administrator search the deleted user
    userAdminPage.openSearchUser().searchByUsername(username).assertNotInUserList(username);
}
Also used : UserToolsPage(org.olat.selenium.page.user.UserToolsPage) UserVO(org.olat.user.restapi.UserVO) By(org.openqa.selenium.By) UserAdminPage(org.olat.selenium.page.user.UserAdminPage) LoginPage(org.olat.selenium.page.LoginPage) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 4 with UserAdminPage

use of org.olat.selenium.page.user.UserAdminPage in project openolat by klemens.

the class UserTest method createUser.

/**
 * The administrator create an user, the user log in.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void createUser(@InitialPage LoginPage loginPage, @Drone @User WebDriver userBrowser) throws IOException, URISyntaxException {
    // login
    loginPage.assertOnLoginPage().loginAs("administrator", "openolat").resume();
    String uuid = UUID.randomUUID().toString();
    String username = "miku-" + uuid;
    UserVO userVo = UserAdminPage.createUserVO(username, "Miku", "Hatsune", "miku-" + uuid + "@openolat.com", "miku01");
    UserAdminPage userAdminPage = navBar.openUserManagement().openCreateUser().fillUserForm(userVo).assertOnUserEditView(username);
    userAdminPage.openSearchUser().searchByUsername(username).assertOnUserInList(username).selectByUsername(username).assertOnUserEditView(username);
    // user log in
    LoginPage userLoginPage = LoginPage.getLoginPage(userBrowser, deploymentUrl);
    // tools
    userLoginPage.loginAs(username, "miku01").resume().assertLoggedIn(userVo);
}
Also used : UserVO(org.olat.user.restapi.UserVO) UserAdminPage(org.olat.selenium.page.user.UserAdminPage) LoginPage(org.olat.selenium.page.LoginPage) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 5 with UserAdminPage

use of org.olat.selenium.page.user.UserAdminPage in project OpenOLAT by OpenOLAT.

the class UserTest method importUsers.

/**
 * Import 2 new users and check if the first can log in.
 *
 * @param loginPage
 * @param userBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void importUsers(@InitialPage LoginPage loginPage, @Drone @User WebDriver userBrowser) throws IOException, URISyntaxException {
    // login
    loginPage.assertOnLoginPage().loginAs("administrator", "openolat").resume();
    UserAdminPage userAdminPage = navBar.openUserManagement().openImportUsers();
    // start import wizard
    ImportUserPage importWizard = userAdminPage.startImport();
    String uuid = UUID.randomUUID().toString();
    String username1 = "moka-" + uuid;
    String username2 = "mizore-" + uuid;
    StringBuilder csv = new StringBuilder();
    UserVO user1 = importWizard.append(username1, "rosario01", "Moka", "Akashiya", csv);
    importWizard.append(username2, "vampire01", "Mizore", "Shirayuki", csv);
    importWizard.fill(csv.toString()).nextData().assertGreen(2).nextOverview().nextGroups().finish();
    OOGraphene.waitAndCloseBlueMessageWindow(browser);
    // user log in
    LoginPage userLoginPage = LoginPage.getLoginPage(userBrowser, deploymentUrl);
    // tools
    userLoginPage.loginAs(username1, "rosario01").resume().assertLoggedIn(user1);
}
Also used : UserVO(org.olat.user.restapi.UserVO) UserAdminPage(org.olat.selenium.page.user.UserAdminPage) ImportUserPage(org.olat.selenium.page.user.ImportUserPage) LoginPage(org.olat.selenium.page.LoginPage) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Aggregations

RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)8 Test (org.junit.Test)8 LoginPage (org.olat.selenium.page.LoginPage)8 UserAdminPage (org.olat.selenium.page.user.UserAdminPage)8 UserVO (org.olat.user.restapi.UserVO)8 ImportUserPage (org.olat.selenium.page.user.ImportUserPage)4 UserToolsPage (org.olat.selenium.page.user.UserToolsPage)2 UserRestClient (org.olat.test.rest.UserRestClient)2 By (org.openqa.selenium.By)2