Search in sources :

Example 26 with CourseEditorPageFragment

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

the class CourseElementTest method createCourseWithWiki.

/**
 * Create a course, create a wiki, go the the course editor,
 * create a course element of type wiki, select the wiki which just created,
 * close the course editor and select the index page of the wiki.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void createCourseWithWiki(@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-Wiki-" + UUID.randomUUID().toString();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    // go the authoring environment to create a CP
    String wikiTitle = "Wiki for a course - " + UUID.randomUUID().toString();
    navBar.openAuthoringEnvironment().createWiki(wikiTitle).assertOnGeneralTab();
    navBar.openCourse(courseTitle);
    String wikiNodeTitle = "Wiki-1";
    // create a course element of type CP with the CP that we create above
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("wiki").nodeTitle(wikiNodeTitle).selectTabLearnContent().chooseWiki(wikiTitle);
    // publish the course
    courseEditor.publish().quickPublish();
    // open the course and see the CP
    CoursePageFragment course = courseEditor.clickToolbarBack();
    course.clickTree().selectWithTitle(wikiNodeTitle).selectWithTitle("Index");
    // check that the title of the index article/page is visible
    WebElement indexArticleTitle = browser.findElement(By.className("o_wikimod_heading"));
    Assert.assertEquals("Index", indexArticleTitle.getText().trim());
}
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 27 with CourseEditorPageFragment

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

the class CourseElementTest method createCourseWithWiki_createInCourseEditor.

/**
 * Create a course, create a course element of type wiki. Open
 * the resource chooser, create a wiki, close the editor, show the
 * index page of the wiki.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void createCourseWithWiki_createInCourseEditor(@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-Wiki-" + UUID.randomUUID().toString();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    String wikiNodeTitle = "Wiki-1";
    String wikiTitle = "Wiki for a course - " + UUID.randomUUID().toString();
    // create a course element of type CP with the CP that we create above
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("wiki").nodeTitle(wikiNodeTitle).selectTabLearnContent().createWiki(wikiTitle);
    // publish the course
    courseEditor.publish().quickPublish();
    // open the course and see the CP
    CoursePageFragment course = courseEditor.clickToolbarBack();
    course.clickTree().selectWithTitle(wikiNodeTitle).selectWithTitle("Index");
    // check that the title of the index article/page is visible
    WebElement indexArticleTitle = browser.findElement(By.className("o_wikimod_heading"));
    Assert.assertEquals("Index", indexArticleTitle.getText().trim());
}
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 28 with CourseEditorPageFragment

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

the class CourseElementTest method forumConcurrent.

/**
 * An author creates a course with a forum, publish it, open a new thread.
 * A first user come to see the thread. A second come via the peekview.
 * The three make a reply at the same time. And they check that they see
 * the replies, and the ones of the others.
 *
 * @param loginPage
 * @param kanuBrowser
 * @param reiBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void forumConcurrent(@InitialPage LoginPage loginPage, @Drone @Participant WebDriver kanuBrowser, @Drone @Student WebDriver reiBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO kanu = new UserRestClient(deploymentUrl).createRandomUser("Kanu");
    UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
    loginPage.loginAs(author.getLogin(), author.getPassword());
    // create a course
    String courseTitle = "Course FO " + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    // go the authoring environment to create a forum
    String foTitle = "FO - " + UUID.randomUUID();
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("fo").nodeTitle(foTitle).publish().quickPublish(UserAccess.registred);
    // go to the forum
    courseEditor.clickToolbarBack().clickTree().selectWithTitle(foTitle.substring(0, 20));
    ForumPage authorForum = ForumPage.getCourseForumPage(browser);
    authorForum.createThread("The best anime ever", "What is the best anime ever?", null);
    // First user go to the course
    LoginPage kanuLoginPage = LoginPage.getLoginPage(kanuBrowser, deploymentUrl);
    kanuLoginPage.loginAs(kanu.getLogin(), kanu.getPassword()).resume();
    NavigationPage kanuNavBar = new NavigationPage(kanuBrowser);
    kanuNavBar.openMyCourses().openSearch().extendedSearch(courseTitle).select(courseTitle).start();
    // go to the forum
    new CoursePageFragment(kanuBrowser).clickTree().selectWithTitle(foTitle.substring(0, 20));
    ForumPage kanuForum = ForumPage.getCourseForumPage(kanuBrowser).openThread("The best anime ever");
    // First user go to the course
    LoginPage reiLoginPage = LoginPage.getLoginPage(reiBrowser, deploymentUrl);
    reiLoginPage.loginAs(rei).resume();
    NavigationPage reiNavBar = new NavigationPage(reiBrowser);
    reiNavBar.openMyCourses().openSearch().extendedSearch(courseTitle).select(courseTitle).start();
    // select the thread in peekview
    ForumPage reiForum = new ForumPage(reiBrowser).openThreadInPeekview("The best anime ever");
    // concurrent reply
    String kanuReply = "Ikki Touzen";
    String reiReply = "Neon Genesis Evangelion";
    String authorReply = "Lain, serial experiment";
    authorForum.replyToMessageNoWait("The best anime ever", null, authorReply);
    reiForum.replyToMessageNoWait("The best anime ever", null, reiReply);
    kanuForum.replyToMessageNoWait("The best anime ever", null, kanuReply);
    // wait the responses
    OOGraphene.waitBusy(browser);
    OOGraphene.waitBusy(kanuBrowser);
    OOGraphene.waitBusy(reiBrowser);
    // check own responses
    authorForum.assertMessageBody(authorReply);
    kanuForum.assertMessageBody(kanuReply);
    reiForum.assertMessageBody(reiReply);
    // check others responses
    authorForum.flatView().waitMessageBody(kanuReply);
    reiForum.flatView().waitMessageBody(kanuReply);
    kanuForum.flatView().waitMessageBody(reiReply);
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) ForumPage(org.olat.selenium.page.forum.ForumPage) 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 29 with CourseEditorPageFragment

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

the class CourseElementTest method createCourseWithBlog_externalFeed.

@Test
@RunAsClient
public void createCourseWithBlog_externalFeed(@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-Blog-" + UUID.randomUUID().toString();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    String blogNodeTitle = "Blog-1";
    String blogTitle = "Blog - " + UUID.randomUUID();
    // create a course element of type 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 blog
    CoursePageFragment course = courseEditor.clickToolbarBack();
    course.clickTree().selectWithTitle(blogNodeTitle);
    // check that the title of the podcast is correct
    WebElement podcastH2 = browser.findElement(By.cssSelector("div.o_blog_info>h2>i.o_FileResource-BLOG_icon"));
    Assert.assertNotNull(podcastH2);
    // Assert.assertEquals(blogTitle, podcastH2.getText().trim());
    FeedPage feed = FeedPage.getFeedPage(browser);
    feed.newExternalBlog(blogTitle, "https://www.openolat.com/feed/");
// check only that the subscription link is visible
/*
		By subscriptionBy = By.cssSelector("div.o_subscription>a");
		OOGraphene.waitElement(subscriptionBy, 20, browser);
		WebElement subscriptionLink = browser.findElement(subscriptionBy);
		Assert.assertTrue(subscriptionLink.isDisplayed());
		*/
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) FeedPage(org.olat.selenium.page.repository.FeedPage) 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 30 with CourseEditorPageFragment

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

the class CourseTest method createCourseWithCalendar_alt.

/**
 * This is a variant of the test above based on the
 * feedback of our beta-testerin.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void createCourseWithCalendar_alt(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    loginPage.loginAs(author.getLogin(), author.getPassword());
    // create a course
    String courseTitle = "Course-iCal-" + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    navBar.openCourse(courseTitle);
    // activate the calendar options
    CoursePageFragment course = CoursePageFragment.getCourse(browser);
    course.options().calendar(Boolean.TRUE).save().clickToolbarBack();
    String calendarNodeTitle = "iCal-2";
    // create a course element of type calendar
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("cal").nodeTitle(calendarNodeTitle);
    // publish the course
    course = courseEditor.autoPublish();
    // open the course and see the CP
    course.clickTree().selectWithTitle(calendarNodeTitle);
    // create a recurring event
    CalendarPage calendar = new CalendarPage(browser);
    calendar.addEvent(2).setDescription("Repeat", "Loop", "Foreach").setAllDay(false).setBeginEnd(14, 18).setRecurringEvent(KalendarEvent.WEEKLY, 28).save().assertOnEvents("Repeat", 4);
    // pick an occurence which is not the first and modify it
    calendar.openDetailsOccurence("Repeat", 16).edit().setBeginEnd(15, 18).save().confirmModifyAllOccurences().assertOnEventsAt("Repeat", 4, 15);
    // delete futur event of the same event as above
    calendar.openDetailsOccurence("Repeat", 16).edit().delete().confirmDeleteFuturOccurences().assertOnEventsAt("Repeat", 2, 15);
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) CalendarPage(org.olat.selenium.page.core.CalendarPage) 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