Search in sources :

Example 1 with ForumCEPage

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

the class CourseElementTest method forumWithGuest.

/**
 * An administrator create a category in catalog. It creates a new course
 * with a forum open to guests. it publish the course in the
 * catalog.<br>
 * The guest find the course, create a new thread. The administrator reply
 * to the message, the guest to its reply.<br>
 * The administrator checks the last message in its new messages, click
 * back, use the list of users to see the messages of the guest. It clicks
 * back to the threads list and checks the thread has 3 messages.
 *
 * @param loginPage
 * @param guestBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void forumWithGuest(@InitialPage LoginPage loginPage, @Drone @User WebDriver guestBrowser) throws IOException, URISyntaxException {
    loginPage.loginAs("administrator", "openolat").resume();
    String node1 = "Forums " + UUID.randomUUID();
    navBar.openCatalogAdministration().addCatalogNode(node1, "First level of the catalog");
    // create a course
    String courseTitle = "Guest FO " + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    // go the authoring environment to create a forum
    String foTitle = "GFO - " + UUID.randomUUID();
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("fo").nodeTitle(foTitle);
    // configure for guest
    ForumCEPage forumConfig = new ForumCEPage(browser);
    forumConfig.selectConfiguration().allowGuest();
    // publish the course
    courseEditor.publish().nextSelectNodes().selectAccess(UserAccess.guest).nextAccess().selectCatalog(true).selectCategory(null, node1).nextCatalog().finish();
    // back in course
    courseEditor.clickToolbarBack();
    // guest go to the catalog and find the course
    LoginPage guestLogin = LoginPage.getLoginPage(guestBrowser, deploymentUrl);
    guestLogin.asGuest();
    NavigationPage guestNavBar = new NavigationPage(guestBrowser);
    guestNavBar.openCatalog().selectCatalogEntry(node1).select(courseTitle).start();
    // go to the forum
    new CoursePageFragment(guestBrowser).clickTree().selectWithTitle(foTitle.substring(0, 20));
    String guestAlias = "Guest-" + UUID.randomUUID();
    ForumPage guestForum = ForumPage.getCourseForumPage(guestBrowser).createThread("Your favorite author", "Name your favorite author", guestAlias);
    // admin go to the forum
    new CoursePageFragment(browser).clickTree().selectWithTitle(foTitle.substring(0, 20));
    // admin reply to the thread of guest
    ForumPage adminForum = ForumPage.getCourseForumPage(browser).openThread("Your favorite author").assertOnGuestPseudonym(guestAlias).newMessages().assertOnGuestPseudonym(guestAlias).replyToMessage("Your favorite author", "Huxley is my favorite author", "My favorite author is Huxley");
    // guest refresh the view and reply to admin
    guestForum.flatView().assertMessageBody("Huxley").replyToMessage("Huxley is my favorite author", " I prefer Orwell", "Orwell is my favorite author");
    // admin see its new messages, see the list of users, select the guest and its messages
    // JMS message need to be delivered
    OOGraphene.waitingALittleLonger();
    adminForum.newMessages().assertMessageBody("Orwell").clickBack().userFilter().selectFilteredUser(guestAlias).assertMessageBody("Orwell").clickBack().clickBack().assertThreadListOnNumber("Your favorite author", 3);
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) ForumCEPage(org.olat.selenium.page.course.ForumCEPage) 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) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 2 with ForumCEPage

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

the class CourseElementTest method forumWithGuest.

/**
 * An administrator create a category in catalog. It creates a new course
 * with a forum open to guests. it publish the course in the
 * catalog.<br>
 * The guest find the course, create a new thread. The administrator reply
 * to the message, the guest to its reply.<br>
 * The administrator checks the last message in its new messages, click
 * back, use the list of users to see the messages of the guest. It clicks
 * back to the threads list and checks the thread has 3 messages.
 *
 * @param loginPage
 * @param guestBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void forumWithGuest(@InitialPage LoginPage loginPage, @Drone @User WebDriver guestBrowser) throws IOException, URISyntaxException {
    loginPage.loginAs("administrator", "openolat").resume();
    String node1 = "Forums " + UUID.randomUUID();
    navBar.openCatalogAdministration().addCatalogNode(node1, "First level of the catalog");
    // create a course
    String courseTitle = "Guest FO " + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    // go the authoring environment to create a forum
    String foTitle = "GFO - " + UUID.randomUUID();
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("fo").nodeTitle(foTitle);
    // configure for guest
    ForumCEPage forumConfig = new ForumCEPage(browser);
    forumConfig.selectConfiguration().allowGuest();
    // publish the course
    courseEditor.publish().nextSelectNodes().selectAccess(UserAccess.guest).nextAccess().selectCatalog(true).selectCategory(null, node1).nextCatalog().finish();
    // back in course
    courseEditor.clickToolbarBack();
    // guest go to the catalog and find the course
    LoginPage guestLogin = LoginPage.getLoginPage(guestBrowser, deploymentUrl);
    guestLogin.asGuest();
    NavigationPage guestNavBar = new NavigationPage(guestBrowser);
    guestNavBar.openCatalog().selectCatalogEntry(node1).select(courseTitle).start();
    // go to the forum
    new CoursePageFragment(guestBrowser).clickTree().selectWithTitle(foTitle.substring(0, 20));
    String guestAlias = "Guest-" + UUID.randomUUID();
    ForumPage guestForum = ForumPage.getCourseForumPage(guestBrowser).createThread("Your favorite author", "Name your favorite author", guestAlias);
    // admin go to the forum
    new CoursePageFragment(browser).clickTree().selectWithTitle(foTitle.substring(0, 20));
    // admin reply to the thread of guest
    ForumPage adminForum = ForumPage.getCourseForumPage(browser).openThread("Your favorite author").assertOnGuestPseudonym(guestAlias).newMessages().assertOnGuestPseudonym(guestAlias).replyToMessage("Your favorite author", "Huxley is my favorite author", "My favorite author is Huxley");
    // guest refresh the view and reply to admin
    guestForum.flatView().assertMessageBody("Huxley").replyToMessage("Huxley is my favorite author", " I prefer Orwell", "Orwell is my favorite author");
    // admin see its new messages, see the list of users, select the guest and its messages
    // JMS message need to be delivered
    OOGraphene.waitingALittleLonger();
    adminForum.newMessages().assertMessageBody("Orwell").clickBack().userFilter().selectFilteredUser(guestAlias).assertMessageBody("Orwell").clickBack().clickBack().assertThreadListOnNumber("Your favorite author", 3);
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) ForumCEPage(org.olat.selenium.page.course.ForumCEPage) 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) 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 LoginPage (org.olat.selenium.page.LoginPage)2 NavigationPage (org.olat.selenium.page.NavigationPage)2 CourseEditorPageFragment (org.olat.selenium.page.course.CourseEditorPageFragment)2 CoursePageFragment (org.olat.selenium.page.course.CoursePageFragment)2 ForumCEPage (org.olat.selenium.page.course.ForumCEPage)2 ForumPage (org.olat.selenium.page.forum.ForumPage)2