Search in sources :

Example 91 with UserVO

use of org.olat.user.restapi.UserVO in project openolat by klemens.

the class PortfolioV2Test method collectEfficiencyStatement.

/**
 * Create a course with an assessment course element, setup
 * efficiency statement, add a user and assess her.
 * The user log in, search its efficiency statement, pick it
 * as a media for is portfolio and goes in the media center
 * to search it and select it.
 *
 * @param authorLoginPage
 * @param ryomouBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void collectEfficiencyStatement(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver ryomouBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    // create a course
    String courseTitle = "Course-Assessment-" + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    // create a course element of type Test with the test that we create above
    String assessmentNodeTitle = "Efficiency PF";
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit().createNode("ms").nodeTitle(assessmentNodeTitle);
    // configure assessment
    AssessmentCEConfigurationPage assessmentConfig = new AssessmentCEConfigurationPage(browser);
    assessmentConfig.selectConfiguration().setScoreAuto(1.0f, 6.0f, 4.0f);
    // set the score / passed calculation in root node and publish
    courseEditor.selectRoot().selectTabScore().enableRootScoreByNodes().autoPublish().accessConfiguration().setUserAccess(UserAccess.registred);
    // go to members management
    CoursePageFragment courseRuntime = courseEditor.clickToolbarBack();
    MembersPage members = courseRuntime.members();
    members.addMember().searchMember(ryomou, true).nextUsers().nextOverview().nextPermissions().finish();
    // efficiency statement is default on
    // go to the assessment to to set the points
    members.clickToolbarBack().assessmentTool().users().assertOnUsers(ryomou).selectUser(ryomou).selectCourseNode(assessmentNodeTitle).setAssessmentScore(4.5f).assertUserPassedCourseNode(assessmentNodeTitle);
    // Ryomou login
    LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl);
    ryomouLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
    // see its beautiful efficiency statement
    String mediaTitle = "My efficiency";
    String mediaDesc = "My efficiency statement " + UUID.randomUUID();
    UserToolsPage ryomouUserTools = new UserToolsPage(ryomouBrowser);
    ryomouUserTools.openUserToolsMenu().openMyEfficiencyStatement().assertOnEfficiencyStatmentPage().assertOnStatement(courseTitle, true).addAsMediaInList(courseTitle).fillEfficiencyStatementMedia(mediaTitle, mediaDesc);
    MediaCenterPage mediaCenter = ryomouUserTools.openUserToolsMenu().openPortfolioV2().openMediaCenter();
    mediaCenter.assertOnMedia(mediaTitle).selectMedia(mediaTitle).assertOnMediaDetails(mediaTitle);
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserToolsPage(org.olat.selenium.page.user.UserToolsPage) UserVO(org.olat.user.restapi.UserVO) AssessmentCEConfigurationPage(org.olat.selenium.page.course.AssessmentCEConfigurationPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) MembersPage(org.olat.selenium.page.course.MembersPage) MediaCenterPage(org.olat.selenium.page.portfolio.MediaCenterPage) 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 92 with UserVO

use of org.olat.user.restapi.UserVO in project openolat by klemens.

the class PortfolioV2Test method editPage.

/**
 * A user create a page / entry, it edit it
 * and add a title, an image, a document
 * and a citation. It toggles between the editor
 * mode and the view mode to check if the parts it
 * add in the page are really there.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void editPage(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    UserVO user = new UserRestClient(deploymentUrl).createRandomUser("rei");
    loginPage.loginAs(user.getLogin(), user.getPassword()).resume();
    UserToolsPage userTools = new UserToolsPage(browser);
    PortfolioV2HomePage portfolio = userTools.openUserToolsMenu().openPortfolioV2();
    String pageTitle = "My page " + UUID.randomUUID();
    EntryPage entry = portfolio.openMyEntries().newPage(pageTitle).assertOnPage(pageTitle);
    // add a title
    String title = "My long title " + UUID.randomUUID();
    entry.addTitle(title).setTitleSize(4).closeEditFragment().assertOnTitle(title, 4);
    // add an image
    URL imageUrl = JunitTestHelper.class.getResource("file_resources/IMG_1484.jpg");
    File imageFile = new File(imageUrl.toURI());
    entry.addImage("Blue is the new black", imageFile).assertOnImage(imageFile);
    // close the editor and check
    entry.toggleEditor().assertOnTitle(title, 4).assertOnImage(imageFile);
    // reopen the editor and add a document
    URL pdfUrl = JunitTestHelper.class.getResource("file_resources/handInTopic1.pdf");
    File pdfFile = new File(pdfUrl.toURI());
    entry.toggleEditor().addDocument("Anything about", pdfFile).assertOnDocument(pdfFile);
    // and a citation
    String citation = "Close the world, open the next.";
    entry.addCitation("Serial experiment", citation).assertOnCitation(citation);
    // close the editor and check all parts
    entry.toggleEditor().assertOnTitle(title, 4).assertOnImage(imageFile).assertOnDocument(pdfFile).assertOnCitation(citation);
}
Also used : UserToolsPage(org.olat.selenium.page.user.UserToolsPage) UserVO(org.olat.user.restapi.UserVO) PortfolioV2HomePage(org.olat.selenium.page.portfolio.PortfolioV2HomePage) EntryPage(org.olat.selenium.page.portfolio.EntryPage) File(java.io.File) URL(java.net.URL) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 93 with UserVO

use of org.olat.user.restapi.UserVO in project openolat by klemens.

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)

Example 94 with UserVO

use of org.olat.user.restapi.UserVO 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 95 with UserVO

use of org.olat.user.restapi.UserVO 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)

Aggregations

UserVO (org.olat.user.restapi.UserVO)364 Test (org.junit.Test)332 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)260 UserRestClient (org.olat.test.rest.UserRestClient)258 LoginPage (org.olat.selenium.page.LoginPage)114 NavigationPage (org.olat.selenium.page.NavigationPage)110 CoursePageFragment (org.olat.selenium.page.course.CoursePageFragment)102 QTI21Page (org.olat.selenium.page.qti.QTI21Page)96 URL (java.net.URL)90 File (java.io.File)88 CourseEditorPageFragment (org.olat.selenium.page.course.CourseEditorPageFragment)84 URI (java.net.URI)72 HttpResponse (org.apache.http.HttpResponse)72 Identity (org.olat.core.id.Identity)72 UserToolsPage (org.olat.selenium.page.user.UserToolsPage)64 WebElement (org.openqa.selenium.WebElement)48 QTI21EditorPage (org.olat.selenium.page.qti.QTI21EditorPage)46 HttpGet (org.apache.http.client.methods.HttpGet)40 MembersPage (org.olat.selenium.page.course.MembersPage)36 AuthoringEnvPage (org.olat.selenium.page.repository.AuthoringEnvPage)34