Search in sources :

Example 36 with UserToolsPage

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

the class UserTest method restUrlAfterLogin.

/**
 * Check if a user can use the rest url in OpenOLAT.
 * It jump from the static sites to its home, user tools,
 * to the visiting card of an other user.
 *
 * @param loginPage
 * @param authorBrowser
 * @param participantBrowser
 * @param reiBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void restUrlAfterLogin(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    // create a random user
    UserRestClient userClient = new UserRestClient(deploymentUrl);
    UserVO user = userClient.createRandomUser("Kanu");
    UserVO ryomou = userClient.createRandomUser("Ryomou");
    // load dmz
    loginPage.assertOnLoginPage().loginAs(user.getLogin(), user.getPassword());
    // go to courses
    navBar.openMyCourses();
    // use url to go to the other users business card
    String ryomouBusinessCardUrl = deploymentUrl.toString() + "auth/Identity/" + ryomou.getKey();
    browser.get(ryomouBusinessCardUrl);
    new VisitingCardPage(browser).assertOnVisitingCard().assertOnLastName(ryomou.getLastName());
    // return to my courses
    navBar.openMyCourses().assertOnMyCourses();
    // go to profile by url
    String userUrl = deploymentUrl.toString() + "url/Identity/" + user.getKey();
    browser.get(userUrl);
    new UserProfilePage(browser).assertOnProfile().assertOnUsername(user.getLogin());
    // go to groups
    String groupsUrl = deploymentUrl.toString() + "url/GroupsSite/0/AllGroups/0";
    browser.get(groupsUrl);
    new GroupsPage(browser).assertOnMyGroupsSelected();
    // go to my calendar
    String calendarUrl = deploymentUrl.toString() + "auth/HomeSite/0/calendar/0";
    browser.get(calendarUrl);
    new UserToolsPage(browser).assertOnCalendar();
    // go to my folder
    String folderUrl = deploymentUrl.toString() + "auth/HomeSite/" + user.getKey() + "/userfolder/0";
    browser.get(folderUrl);
    new UserToolsPage(browser).assertOnFolder();
}
Also used : UserToolsPage(org.olat.selenium.page.user.UserToolsPage) UserVO(org.olat.user.restapi.UserVO) UserProfilePage(org.olat.selenium.page.user.UserProfilePage) VisitingCardPage(org.olat.selenium.page.user.VisitingCardPage) UserRestClient(org.olat.test.rest.UserRestClient) GroupsPage(org.olat.selenium.page.group.GroupsPage) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 37 with UserToolsPage

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

the class UserTest method loginInHomeWithLandingPage.

/**
 * An user configures its landing page, log out
 * and try it.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void loginInHomeWithLandingPage(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    // create a random user
    UserRestClient userClient = new UserRestClient(deploymentUrl);
    UserVO user = userClient.createAuthor();
    loginPage.assertOnLoginPage().loginAs(user.getLogin(), user.getPassword());
    UserToolsPage userTools = new UserToolsPage(browser);
    userTools.openUserToolsMenu().openMySettings().openPreferences().setResume(ResumeOption.none).setLandingPage("/RepositorySite/0/Search/0");
    userTools.logout();
    loginPage.assertOnLoginPage().loginAs(user.getLogin(), user.getPassword());
    new AuthoringEnvPage(browser).assertOnGenericSearch();
}
Also used : UserToolsPage(org.olat.selenium.page.user.UserToolsPage) UserVO(org.olat.user.restapi.UserVO) AuthoringEnvPage(org.olat.selenium.page.repository.AuthoringEnvPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 38 with UserToolsPage

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

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 39 with UserToolsPage

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

the class UserTest method resumeCourseOnDemand.

/**
 * Set the resume preferences to resume the session on request,
 * open a course, log out, log in, resume the session and check
 * if the course is resumed.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
public void resumeCourseOnDemand(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    // create a random user
    UserVO user = new UserRestClient(deploymentUrl).createRandomUser();
    // deploy a course
    CourseVO course = new RepositoryRestClient(deploymentUrl).deployDemoCourse();
    // login
    loginPage.loginAs(user.getLogin(), user.getPassword());
    // set the preferences to resume automatically
    UserToolsPage userTools = new UserToolsPage(browser);
    userTools.openUserToolsMenu().openMySettings().openPreferences().setResume(ResumeOption.ondemand);
    // open a course via REST url and click it
    CoursePageFragment.getCourse(browser, deploymentUrl, course).clickTree();
    // logout
    userTools.logout();
    // login again
    loginPage.assertOnLoginPage().loginAs(user.getLogin(), user.getPassword());
    // resume
    loginPage.resumeWithAssert();
    // check the title of the course if any
    WebElement courseTitle = browser.findElement(By.tagName("h2"));
    Assert.assertNotNull(courseTitle);
    Assert.assertTrue(courseTitle.isDisplayed());
    Assert.assertTrue(courseTitle.getText().contains(course.getTitle()));
}
Also used : RepositoryRestClient(org.olat.test.rest.RepositoryRestClient) CourseVO(org.olat.restapi.support.vo.CourseVO) UserToolsPage(org.olat.selenium.page.user.UserToolsPage) UserVO(org.olat.user.restapi.UserVO) WebElement(org.openqa.selenium.WebElement) UserRestClient(org.olat.test.rest.UserRestClient) Test(org.junit.Test)

Example 40 with UserToolsPage

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

the class PortfolioV2Test method collectWikiMediaInWikiResource.

/**
 * Create a wiki as resource, add and fill a page. The author
 * picks the page as media and go in its media center to see it.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void collectWikiMediaInWikiResource(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    loginPage.loginAs(author.getLogin(), author.getPassword()).resume();
    // go to authoring
    AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
    String title = "PF-Wiki-" + UUID.randomUUID();
    // create a wiki and launch it
    authoringEnv.openCreateDropDown().clickCreate(ResourceType.wiki).fillCreateForm(title).assertOnGeneralTab().clickToolbarBack();
    // create a page in the wiki
    String page = "LMS-" + UUID.randomUUID();
    String content = "Learning Management System";
    WikiPage wiki = WikiPage.getWiki(browser);
    // create page and add it as artefact to portfolio
    String mediaTitle = "My own wiki page";
    wiki.createPage(page, content).addAsMedia().fillForumMedia(mediaTitle, "A post I write");
    UserToolsPage userTools = new UserToolsPage(browser);
    MediaCenterPage mediaCenter = userTools.openUserToolsMenu().openPortfolioV2().openMediaCenter();
    mediaCenter.assertOnMedia(mediaTitle).selectMedia(mediaTitle).assertOnMediaDetails(mediaTitle);
}
Also used : UserToolsPage(org.olat.selenium.page.user.UserToolsPage) UserVO(org.olat.user.restapi.UserVO) AuthoringEnvPage(org.olat.selenium.page.repository.AuthoringEnvPage) WikiPage(org.olat.selenium.page.wiki.WikiPage) MediaCenterPage(org.olat.selenium.page.portfolio.MediaCenterPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)64 UserToolsPage (org.olat.selenium.page.user.UserToolsPage)64 UserVO (org.olat.user.restapi.UserVO)64 UserRestClient (org.olat.test.rest.UserRestClient)62 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)60 CoursePageFragment (org.olat.selenium.page.course.CoursePageFragment)30 LoginPage (org.olat.selenium.page.LoginPage)24 NavigationPage (org.olat.selenium.page.NavigationPage)18 CourseEditorPageFragment (org.olat.selenium.page.course.CourseEditorPageFragment)16 File (java.io.File)14 URL (java.net.URL)14 WebElement (org.openqa.selenium.WebElement)14 PortfolioV2HomePage (org.olat.selenium.page.portfolio.PortfolioV2HomePage)12 AuthoringEnvPage (org.olat.selenium.page.repository.AuthoringEnvPage)12 MembersPage (org.olat.selenium.page.course.MembersPage)10 BinderPage (org.olat.selenium.page.portfolio.BinderPage)10 Calendar (java.util.Calendar)8 MediaCenterPage (org.olat.selenium.page.portfolio.MediaCenterPage)8 AssessmentCEConfigurationPage (org.olat.selenium.page.course.AssessmentCEConfigurationPage)6 AssessmentToolPage (org.olat.selenium.page.course.AssessmentToolPage)6