Search in sources :

Example 1 with UserProfilePage

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

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 2 with UserProfilePage

use of org.olat.selenium.page.user.UserProfilePage 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)

Aggregations

RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)2 Test (org.junit.Test)2 GroupsPage (org.olat.selenium.page.group.GroupsPage)2 UserProfilePage (org.olat.selenium.page.user.UserProfilePage)2 UserToolsPage (org.olat.selenium.page.user.UserToolsPage)2 VisitingCardPage (org.olat.selenium.page.user.VisitingCardPage)2 UserRestClient (org.olat.test.rest.UserRestClient)2 UserVO (org.olat.user.restapi.UserVO)2