Search in sources :

Example 56 with UserVO

use of org.olat.user.restapi.UserVO in project OpenOLAT by OpenOLAT.

the class AssessmentTest method certificatesGeneratedByTest.

/**
 * An author create a course, set up the root node to make efficiency statement,
 * add a test, publish it and add a participant. It set the certificate.<br>
 *
 * The participant logs in, make the test and look at its wonderful certificate
 * and the details of its performance.
 *
 * @param authorLoginPage
 * @param reiBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void certificatesGeneratedByTest(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver reiBrowser) throws IOException, URISyntaxException {
    // create an author and a participant
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
    // deploy the test
    URL testUrl = ArquillianDeployments.class.getResource("file_resources/e4_test.zip");
    String testTitle = "E4Test-" + UUID.randomUUID();
    new RepositoryRestClient(deploymentUrl, author).deployResource(new File(testUrl.toURI()), "-", testTitle);
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    // create a course
    String courseTitle = "Certif-" + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    // create a course element of type CP with the CP that we create above
    String testNodeTitle = "Test-QTI-1.2";
    CoursePageFragment courseRuntime = CoursePageFragment.getCourse(browser);
    courseRuntime.edit().createNode("iqtest").nodeTitle(testNodeTitle).selectTabLearnContent().chooseTest(testTitle).selectRoot().selectTabScore().enableRootScoreByNodes().autoPublish().accessConfiguration().setUserAccess(UserAccess.registred).clickToolbarBack();
    // add a participant to the course
    MembersPage members = courseRuntime.members();
    members.addMember().searchMember(rei, true).nextUsers().nextOverview().nextPermissions().finish();
    // return to course
    courseRuntime = members.clickToolbarBack().efficiencyStatementConfiguration().enableCertificates(true).enableRecertification().save().clickToolbarBack();
    // Participant log in
    LoginPage reiLoginPage = LoginPage.getLoginPage(reiBrowser, deploymentUrl);
    reiLoginPage.loginAs(rei.getLogin(), rei.getPassword()).resume();
    // open the course
    NavigationPage reiNavBar = new NavigationPage(reiBrowser);
    reiNavBar.openMyCourses().select(courseTitle);
    // go to the test
    CoursePageFragment reiTestCourse = new CoursePageFragment(reiBrowser);
    reiTestCourse.clickTree().selectWithTitle(testNodeTitle);
    // pass the test
    QTI12Page.getQTI12Page(reiBrowser).passE4(rei);
    // open the efficiency statements
    UserToolsPage reiUserTools = new UserToolsPage(reiBrowser);
    reiUserTools.openUserToolsMenu().openMyEfficiencyStatement().assertOnEfficiencyStatmentPage().assertOnCertificateAndStatements(courseTitle).selectStatement(courseTitle).selectStatementSegment().assertOnCourseDetails(testNodeTitle, true);
}
Also used : RepositoryRestClient(org.olat.test.rest.RepositoryRestClient) UserToolsPage(org.olat.selenium.page.user.UserToolsPage) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) MembersPage(org.olat.selenium.page.course.MembersPage) File(java.io.File) URL(java.net.URL) 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 57 with UserVO

use of org.olat.user.restapi.UserVO in project OpenOLAT by OpenOLAT.

the class CourseElementTest method courseWithSCORM_fullAuto.

/**
 * This test an edge case where a course start automatically its first
 *  course element, which is a structure node which start itself its first
 *  element, which is a SCORM which launch itself automatically.
 *
 * @param loginPage
 */
@Test
@RunAsClient
public void courseWithSCORM_fullAuto(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    loginPage.loginAs(author.getLogin(), author.getPassword());
    URL zipUrl = JunitTestHelper.class.getResource("file_resources/scorm/SCORM_course_full_auto.zip");
    File zipFile = new File(zipUrl.toURI());
    // go the authoring environment to import our course
    String zipTitle = "SCORM - " + UUID.randomUUID();
    navBar.openAuthoringEnvironment().uploadResource(zipTitle, zipFile);
    // publish the course
    new RepositoryEditDescriptionPage(browser).clickToolbarBack();
    CoursePageFragment.getCourse(browser).edit().autoPublish();
    // scorm is auto started -> back
    ScormPage.getScormPage(browser).back();
    // log out
    new UserToolsPage(browser).logout();
    // log in and resume test
    loginPage.loginAs(author.getLogin(), author.getPassword()).resume();
    // direct jump in SCORM content
    ScormPage.getScormPage(browser).passVerySimpleScorm().back().assertOnScormPassed().assertOnScormScore(33);
}
Also used : UserToolsPage(org.olat.selenium.page.user.UserToolsPage) UserVO(org.olat.user.restapi.UserVO) File(java.io.File) URL(java.net.URL) RepositoryEditDescriptionPage(org.olat.selenium.page.repository.RepositoryEditDescriptionPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 58 with UserVO

use of org.olat.user.restapi.UserVO in project OpenOLAT by OpenOLAT.

the class CourseElementTest method createCourseWithCP.

/**
 * Create a course, create a CP, go the the course editor,
 * create a course element of type CP, select the CP which just created,
 * close the course editor and check the presence of the CP with the
 * default title of the first page.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void createCourseWithCP(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    loginPage.loginAs(author.getLogin(), author.getPassword());
    // create a course
    String courseTitle = "Course-With-CP-" + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    // go the authoring environment to create a CP
    String cpTitle = "CP for a course - " + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCP(cpTitle).assertOnGeneralTab();
    navBar.openCourse(courseTitle);
    String cpNodeTitle = "CP-1";
    // create a course element of type CP with the CP that we create above
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("cp").nodeTitle(cpNodeTitle).selectTabLearnContent().chooseCP(cpTitle);
    // publish the course
    courseEditor.publish().quickPublish();
    // open the course and see the CP
    CoursePageFragment course = courseEditor.clickToolbarBack();
    course.clickTree().selectWithTitle(cpNodeTitle);
    // check that the default title of CP (Lorem Ipsum) is visible in the iframe
    WebElement cpIframe = browser.findElement(By.cssSelector("div.o_iframedisplay>iframe"));
    browser.switchTo().frame(cpIframe);
    browser.findElement(By.xpath("//h2[text()='Lorem Ipsum']"));
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) WebElement(org.openqa.selenium.WebElement) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 59 with UserVO

use of org.olat.user.restapi.UserVO in project OpenOLAT by OpenOLAT.

the class CourseElementTest method createCourseWithDialog.

/**
 * An author create a course with a dialog course element. It
 * add a participant to the course, a file to the dialog in
 * the course element configuration and after publishing the course
 * in the view of the dialog. It opens the forum of one of the files,
 * create a new thread.<br>
 * The participant log in, open the course and the dialog element. It
 * reads the thread and make a reply. The author answers to the reply.
 *
 * @param loginPage
 */
@Test
@RunAsClient
public void createCourseWithDialog(@InitialPage LoginPage authorLoginPage, @Drone @Participant WebDriver participantBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO participant = new UserRestClient(deploymentUrl).createRandomUser("Rei");
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    // go to authoring
    AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
    String title = "Course dialog " + UUID.randomUUID();
    // create course
    authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab().clickToolbarBack();
    // add a participant
    MembersPage members = new CoursePageFragment(browser).members();
    members.addMember().searchMember(participant, true).nextUsers().nextOverview().selectRepositoryEntryRole(false, false, true).nextPermissions().finish();
    members.clickToolbarBack();
    String dialogNodeTitle = "Dialog";
    // open course editor
    CoursePageFragment course = CoursePageFragment.getCourse(browser);
    CourseEditorPageFragment editor = course.assertOnCoursePage().assertOnTitle(title).openToolsMenu().edit().createNode("dialog").nodeTitle(dialogNodeTitle);
    // upload a file in the configuration
    URL imageUrl = JunitTestHelper.class.getResource("file_resources/IMG_1484.jpg");
    File imageFile = new File(imageUrl.toURI());
    DialogConfigurationPage dialogConfig = new DialogConfigurationPage(browser);
    dialogConfig.selectConfiguration().uploadFile(imageFile);
    // publish and go to the course element
    editor.publish().quickPublish(UserAccess.membersOnly);
    editor.clickToolbarBack();
    course.clickTree().selectWithTitle(dialogNodeTitle);
    // upload a second file
    URL imageRunUrl = JunitTestHelper.class.getResource("file_resources/IMG_1483.png");
    File imageRunFile = new File(imageRunUrl.toURI());
    DialogPage dialog = new DialogPage(browser);
    dialog.assertOnFile(imageFile.getName()).uploadFile(imageRunFile).assertOnFile(imageRunFile.getName()).openForum(imageRunFile.getName()).createThread("JPEG vs PNG", "Which is the best format", null);
    // The participant come in
    LoginPage participantLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    participantLoginPage.loginAs(participant.getLogin(), participant.getPassword()).resume();
    // The participant find the course
    NavigationPage participantNavBar = new NavigationPage(participantBrowser);
    participantNavBar.assertOnNavigationPage().openMyCourses().select(title);
    // And opens the dialog course element
    CoursePageFragment participantCourse = CoursePageFragment.getCourse(participantBrowser);
    participantCourse.clickTree().selectWithTitle(dialogNodeTitle);
    DialogPage participantDialog = new DialogPage(participantBrowser);
    participantDialog.assertOnFile(imageRunFile.getName()).openForum(imageRunFile.getName()).openThread("JPEG vs PNG").replyToMessage("JPEG vs PNG", "PNG for sure", "Not a loosy format");
    // The author reload the messages
    dialog.back().openForum(imageRunFile.getName()).openThread("JPEG vs PNG").assertMessageBody("Not a loosy format").replyToMessage("PNG for sure", "JPEG smaller", "JPEG is smaller");
    // The participant check the reply
    participantDialog.back().openForum(imageRunFile.getName()).openThread("JPEG vs PNG").assertMessageBody("JPEG is smaller");
}
Also used : CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) URL(java.net.URL) LoginPage(org.olat.selenium.page.LoginPage) UserRestClient(org.olat.test.rest.UserRestClient) CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) AuthoringEnvPage(org.olat.selenium.page.repository.AuthoringEnvPage) NavigationPage(org.olat.selenium.page.NavigationPage) DialogPage(org.olat.selenium.page.course.DialogPage) MembersPage(org.olat.selenium.page.course.MembersPage) File(java.io.File) DialogConfigurationPage(org.olat.selenium.page.course.DialogConfigurationPage) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 60 with UserVO

use of org.olat.user.restapi.UserVO in project OpenOLAT by OpenOLAT.

the class CourseElementTest method createCourseWithInfoMessages.

/**
 * Login, create a course, select "Messages Course", insert an info message
 * course element, publish the course, add messages, count if the messages
 * are there, show older messages, count the messages, show current messages,
 * count the messages, edit a message and delete an other, count the messages.
 *
 * @param authorLoginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void createCourseWithInfoMessages(@InitialPage LoginPage authorLoginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    // go to authoring
    AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
    String title = "Course Msg " + UUID.randomUUID().toString();
    // create course
    authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab().clickToolbarBack();
    String infoNodeTitle = "Infos - News";
    // open course editor
    CoursePageFragment course = CoursePageFragment.getCourse(browser);
    CourseEditorPageFragment editor = course.assertOnCoursePage().assertOnTitle(title).openToolsMenu().edit().createNode("info").nodeTitle(infoNodeTitle);
    // configure the info messages
    InfoMessageCEPage infoMsgConfig = new InfoMessageCEPage(browser);
    infoMsgConfig.selectConfiguration().configure(3);
    // publish
    editor.publish().quickPublish(UserAccess.registred);
    editor.clickToolbarBack();
    course.clickTree().selectWithTitle(infoNodeTitle);
    // set a message
    infoMsgConfig.createMessage().setMessage("Information 0", "A very important info").next().finish().assertOnMessageTitle("Information 0");
    for (int i = 1; i <= 3; i++) {
        infoMsgConfig.quickMessage("Information " + i, "More informations");
    }
    int numOfMessages = infoMsgConfig.countMessages();
    Assert.assertEquals(3, numOfMessages);
    // count old messages
    int numOfOldMessages = infoMsgConfig.oldMessages().countMessages();
    Assert.assertEquals(4, numOfOldMessages);
    // new messages
    infoMsgConfig.newMessages();
    int numOfNewMessages = infoMsgConfig.countMessages();
    Assert.assertEquals(3, numOfNewMessages);
    // edit
    infoMsgConfig.oldMessages();
    infoMsgConfig.editMessage("Information 2").setMessage("The latest information", "A very important info").save().assertOnMessageTitle("The latest information");
    // delete
    infoMsgConfig.deleteMessage("Information 3").confirmDelete();
    int numOfSurvivingMessages = infoMsgConfig.countMessages();
    Assert.assertEquals(3, numOfSurvivingMessages);
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) AuthoringEnvPage(org.olat.selenium.page.repository.AuthoringEnvPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) InfoMessageCEPage(org.olat.selenium.page.course.InfoMessageCEPage) UserRestClient(org.olat.test.rest.UserRestClient) 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