Search in sources :

Example 66 with CourseEditorPageFragment

use of org.olat.selenium.page.course.CourseEditorPageFragment in project OpenOLAT by OpenOLAT.

the class PortfolioV2Test method collectBlogEntryMediaInBlogResource.

/**
 * Create a blog as learn resource, create a new entry and publish it.
 * Than pick the entry as a media and go to the media center to see it.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void collectBlogEntryMediaInBlogResource(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    loginPage.loginAs(author.getLogin(), author.getPassword()).resume();
    // create a course
    String courseTitle = "Course-With-Blog-" + UUID.randomUUID().toString();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    String blogNodeTitle = "Blog-EP-1";
    String blogTitle = "Blog - EP - " + UUID.randomUUID().toString();
    // create a course element of type blog with a blog
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("blog").nodeTitle(blogNodeTitle).selectTabLearnContent().createFeed(blogTitle);
    // publish the course
    courseEditor.publish().quickPublish();
    // open the course and see the CP
    CoursePageFragment course = courseEditor.clickToolbarBack();
    course.clickTree().selectWithTitle(blogNodeTitle);
    String postTitle = "Post-EP-" + UUID.randomUUID();
    String postSummary = "Some explantations as teaser";
    String postContent = "Content of the post";
    FeedPage feed = FeedPage.getFeedPage(browser);
    feed.newBlog().fillPostForm(postTitle, postSummary, postContent).publishPost();
    String mediaTitle = "My very own entry";
    feed.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 : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserToolsPage(org.olat.selenium.page.user.UserToolsPage) UserVO(org.olat.user.restapi.UserVO) FeedPage(org.olat.selenium.page.repository.FeedPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) 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 67 with CourseEditorPageFragment

use of org.olat.selenium.page.course.CourseEditorPageFragment in project openolat by klemens.

the class ImsQTI21Test method qti21Course.

/**
 * Upload a test in QTI 2.1 format, create a course, bind
 * the test in a course element, run it and check if
 * the attempt go up.
 *
 * @param authorLoginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void qti21Course(@InitialPage LoginPage authorLoginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    // upload a test
    String qtiTestTitle = "Simple QTI 2.1 " + UUID.randomUUID();
    URL qtiTestUrl = JunitTestHelper.class.getResource("file_resources/qti21/simple_QTI_21_test.zip");
    File qtiTestFile = new File(qtiTestUrl.toURI());
    navBar.openAuthoringEnvironment().uploadResource(qtiTestTitle, qtiTestFile);
    // create a course
    String courseTitle = "Course QTI 2.1 " + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    String testNodeTitle = "QTI21Test-1";
    // create a course element of type CP with the CP that we create above
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("iqtest").nodeTitle(testNodeTitle).selectTabLearnContent().chooseTest(qtiTestTitle);
    QTI21ConfigurationCEPage configPage = new QTI21ConfigurationCEPage(browser);
    configPage.selectConfiguration().showScoreOnHomepage(true).saveConfiguration();
    // publish the course
    courseEditor.publish().quickPublish();
    // open the course and see the CP
    CoursePageFragment course = courseEditor.clickToolbarBack();
    course.clickTree().selectWithTitle(testNodeTitle);
    // check that the title of the start page of test is correct
    WebElement testH2 = browser.findElement(By.cssSelector("div.o_course_run h2"));
    Assert.assertEquals(testNodeTitle, testH2.getText().trim());
    QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
    qtiPage.start().answerSingleChoiceWithParagraph("Right").saveAnswer().endTest().assertOnCourseAttempts(1).assertOnCourseAssessmentTestScore(1);
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) QTI21ConfigurationCEPage(org.olat.selenium.page.qti.QTI21ConfigurationCEPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) WebElement(org.openqa.selenium.WebElement) File(java.io.File) URL(java.net.URL) UserRestClient(org.olat.test.rest.UserRestClient) QTI21Page(org.olat.selenium.page.qti.QTI21Page) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 68 with CourseEditorPageFragment

use of org.olat.selenium.page.course.CourseEditorPageFragment in project openolat by klemens.

the class PortfolioV2Test method collectBlogEntryMediaInBlogResource.

/**
 * Create a blog as learn resource, create a new entry and publish it.
 * Than pick the entry as a media and go to the media center to see it.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void collectBlogEntryMediaInBlogResource(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    loginPage.loginAs(author.getLogin(), author.getPassword()).resume();
    // create a course
    String courseTitle = "Course-With-Blog-" + UUID.randomUUID().toString();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    String blogNodeTitle = "Blog-EP-1";
    String blogTitle = "Blog - EP - " + UUID.randomUUID().toString();
    // create a course element of type blog with a blog
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("blog").nodeTitle(blogNodeTitle).selectTabLearnContent().createFeed(blogTitle);
    // publish the course
    courseEditor.publish().quickPublish();
    // open the course and see the CP
    CoursePageFragment course = courseEditor.clickToolbarBack();
    course.clickTree().selectWithTitle(blogNodeTitle);
    String postTitle = "Post-EP-" + UUID.randomUUID();
    String postSummary = "Some explantations as teaser";
    String postContent = "Content of the post";
    FeedPage feed = FeedPage.getFeedPage(browser);
    feed.newBlog().fillPostForm(postTitle, postSummary, postContent).publishPost();
    String mediaTitle = "My very own entry";
    feed.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 : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserToolsPage(org.olat.selenium.page.user.UserToolsPage) UserVO(org.olat.user.restapi.UserVO) FeedPage(org.olat.selenium.page.repository.FeedPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) 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 69 with CourseEditorPageFragment

use of org.olat.selenium.page.course.CourseEditorPageFragment in project openolat by klemens.

the class BusinessGroupTest method enrollmentWithWaitingList.

/**
 * An author create a course, with an enrollment course element. It
 * configure it and create a group with max. participant set to 1 and
 * enables the waiting list.<br>
 *
 * Three users goes to the course and try to enroll. One will become
 * a participant, the 2 others land in the waiting list.
 *
 * @param authorLoginPage
 * @param ryomouBrowser
 * @param reiBrowser
 * @param kanuBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void enrollmentWithWaitingList(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver ryomouBrowser, @Drone @Participant WebDriver reiBrowser, @Drone @Student WebDriver kanuBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
    UserVO kanu = new UserRestClient(deploymentUrl).createRandomUser("kanu");
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    // create a course
    String courseTitle = "Enrolment-1-" + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    // create a course element of type Enrolment
    String enNodeTitle = "Enrolment-1";
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("en").nodeTitle(enNodeTitle);
    // configure enrolment with a group that we create
    String groupName = "Enrolment group - 1 " + UUID.randomUUID();
    EnrollmentConfigurationPage enrolmentConfig = new EnrollmentConfigurationPage(browser);
    enrolmentConfig.selectConfiguration().createBusinessGroup(groupName, "-", 1, true, false);
    // publish the course
    courseEditor.publish().quickPublish(UserAccess.registred);
    courseEditor.clickToolbarBack();
    GroupPage authorGroup = navBar.openGroups(browser).selectGroup(groupName).openAdministration().openAdminMembers().setVisibility(true, true, true).openMembers().assertParticipantList();
    // Rei open the course
    Enrollment[] participantDrivers = new Enrollment[] { new Enrollment(ryomou, ryomouBrowser), new Enrollment(rei, reiBrowser), new Enrollment(kanu, kanuBrowser) };
    for (Enrollment enrollment : participantDrivers) {
        WebDriver driver = enrollment.getDriver();
        LoginPage.getLoginPage(driver, deploymentUrl).loginAs(enrollment.getUser()).resume();
        NavigationPage participantNavBar = new NavigationPage(driver);
        participantNavBar.openMyCourses().openSearch().extendedSearch(courseTitle).select(courseTitle).start();
        // go to the enrollment
        CoursePageFragment participantCourse = new CoursePageFragment(driver);
        participantCourse.clickTree().selectWithTitle(enNodeTitle);
        EnrollmentPage enrollmentPage = new EnrollmentPage(driver);
        enrollmentPage.assertOnEnrolmentPage();
        enrollment.setEnrollmentPage(enrollmentPage);
    }
    // enroll
    for (Enrollment enrollment : participantDrivers) {
        enrollment.getEnrollmentPage().enrollNoWait();
    }
    // wait
    for (Enrollment enrollment : participantDrivers) {
        OOGraphene.waitBusy(enrollment.getDriver());
    }
    // author check the lists
    authorGroup.openMembers();
    // must a participant and 2 in waiting list
    int participants = 0;
    int waitingList = 0;
    for (Enrollment enrollment : participantDrivers) {
        if (authorGroup.isInMembersParticipantList(enrollment.getUser()))
            participants++;
        if (authorGroup.isInMembersInWaitingList(enrollment.getUser()))
            waitingList++;
    }
    Assert.assertEquals(1, participants);
    Assert.assertEquals(2, waitingList);
}
Also used : WebDriver(org.openqa.selenium.WebDriver) GroupPage(org.olat.selenium.page.group.GroupPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) UserRestClient(org.olat.test.rest.UserRestClient) CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) EnrollmentPage(org.olat.selenium.page.course.EnrollmentPage) EnrollmentConfigurationPage(org.olat.selenium.page.course.EnrollmentConfigurationPage) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 70 with CourseEditorPageFragment

use of org.olat.selenium.page.course.CourseEditorPageFragment in project openolat by klemens.

the class BusinessGroupTest method enrollmentWithMultiEnrollment.

/**
 * An author create a course, with an enrollment course element. It
 * configure it and create 3 groups and set the maximum enrollment counter to 2<br>
 *
 * One user goes to the course and enrolls in 2 of the groups. It shouldent be possible
 * enroll in the third<br>
 *
 * @param authorLoginPage
 * @param ryomouBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void enrollmentWithMultiEnrollment(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver ryomouBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    // create a course
    String courseTitle = "Enrolment-3-" + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    // create a course element of type Enrolment
    String enNodeTitle = "Enrolment-3";
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("en").nodeTitle(enNodeTitle);
    // configure enrolment with a group that we create
    List<String> groups = new ArrayList<String>();
    groups.add("Enrolment group - 3 " + UUID.randomUUID());
    groups.add("Enrolment group - 3 " + UUID.randomUUID());
    groups.add("Enrolment group - 3 " + UUID.randomUUID());
    EnrollmentConfigurationPage enrolmentConfig = new EnrollmentConfigurationPage(browser);
    enrolmentConfig.selectConfiguration().createBusinessGroup(groups.get(0), "-", 4, false, false).createBusinessGroup(groups.get(1), "-", 4, false, false).createBusinessGroup(groups.get(2), "-", 4, false, false).selectMultipleEnrollments(2);
    // publish the course
    courseEditor.publish().quickPublish(UserAccess.registred);
    courseEditor.clickToolbarBack();
    for (String groupName : groups) {
        navBar.openGroups(browser).selectGroup(groupName).openAdministration().openAdminMembers().setVisibility(true, true, false).openMembers();
    }
    // Ryomou open the course
    LoginPage.getLoginPage(ryomouBrowser, deploymentUrl).loginAs(ryomou).resume();
    NavigationPage participantNavBar = new NavigationPage(ryomouBrowser);
    participantNavBar.openMyCourses().openSearch().extendedSearch(courseTitle).select(courseTitle).start();
    OOGraphene.waitBusy(ryomouBrowser);
    // go to the enrollment
    CoursePageFragment participantCourse = new CoursePageFragment(ryomouBrowser);
    participantCourse.clickTree().selectWithTitle(enNodeTitle);
    EnrollmentPage enrollmentPage = new EnrollmentPage(ryomouBrowser);
    enrollmentPage.assertOnEnrolmentPage().multiEnroll(2);
    // assert that that no more enrollment is allowed
    enrollmentPage.assertNoEnrollmentAllowed();
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) EnrollmentPage(org.olat.selenium.page.course.EnrollmentPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) ArrayList(java.util.ArrayList) EnrollmentConfigurationPage(org.olat.selenium.page.course.EnrollmentConfigurationPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Aggregations

RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)86 Test (org.junit.Test)86 CourseEditorPageFragment (org.olat.selenium.page.course.CourseEditorPageFragment)86 UserRestClient (org.olat.test.rest.UserRestClient)84 UserVO (org.olat.user.restapi.UserVO)84 CoursePageFragment (org.olat.selenium.page.course.CoursePageFragment)80 NavigationPage (org.olat.selenium.page.NavigationPage)44 LoginPage (org.olat.selenium.page.LoginPage)40 MembersPage (org.olat.selenium.page.course.MembersPage)30 WebElement (org.openqa.selenium.WebElement)30 URL (java.net.URL)24 File (java.io.File)22 UserToolsPage (org.olat.selenium.page.user.UserToolsPage)16 AuthoringEnvPage (org.olat.selenium.page.repository.AuthoringEnvPage)14 AssessmentCEConfigurationPage (org.olat.selenium.page.course.AssessmentCEConfigurationPage)10 AssessmentToolPage (org.olat.selenium.page.course.AssessmentToolPage)10 By (org.openqa.selenium.By)10 EnrollmentConfigurationPage (org.olat.selenium.page.course.EnrollmentConfigurationPage)8 EnrollmentPage (org.olat.selenium.page.course.EnrollmentPage)8 GroupPage (org.olat.selenium.page.group.GroupPage)8