Search in sources :

Example 1 with ForumPage

use of org.olat.selenium.page.forum.ForumPage in project OpenOLAT by OpenOLAT.

the class PortfolioV2Test method collectForumMediaInCourse.

/**
 * Create a course with a forum, open a new thread and pick it as
 * a media. Go in the media center and check that the media
 * is waiting there, click the details and check again.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void collectForumMediaInCourse(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    loginPage.loginAs(author.getLogin(), author.getPassword()).resume();
    String courseTitle = "Collect-Forum-" + UUID.randomUUID();
    String forumTitle = ("Forum-" + UUID.randomUUID()).substring(0, 24);
    // go to authoring, create a course with a forum
    navBar.openAuthoringEnvironment().openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(courseTitle).clickToolbarBack();
    // open course editor
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("fo").nodeTitle(forumTitle).publish().quickPublish();
    courseEditor.clickToolbarBack();
    CoursePageFragment course = CoursePageFragment.getCourse(browser);
    course.clickTree().selectWithTitle(forumTitle);
    String mediaTitle = "A post";
    String threadTitle = "Very interessant thread";
    ForumPage forum = ForumPage.getCourseForumPage(browser);
    forum.createThread(threadTitle, "With a lot of content", null).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) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) ForumPage(org.olat.selenium.page.forum.ForumPage) 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 2 with ForumPage

use of org.olat.selenium.page.forum.ForumPage in project openolat by klemens.

the class DialogPage method openForum.

public ForumPage openForum(String filename) {
    By openForumBy = By.xpath("//table//tr[td/a[contains(text(),'" + filename + "')]]/td/a[contains(@href,'forum')]");
    browser.findElement(openForumBy).click();
    OOGraphene.waitBusy(browser);
    By forumBy = By.cssSelector("div.o_sel_dialog div.o_sel_forum");
    OOGraphene.waitElement(forumBy, browser);
    return new ForumPage(browser);
}
Also used : By(org.openqa.selenium.By) ForumPage(org.olat.selenium.page.forum.ForumPage)

Example 3 with ForumPage

use of org.olat.selenium.page.forum.ForumPage 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 4 with ForumPage

use of org.olat.selenium.page.forum.ForumPage 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 5 with ForumPage

use of org.olat.selenium.page.forum.ForumPage in project OpenOLAT by OpenOLAT.

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)

Aggregations

ForumPage (org.olat.selenium.page.forum.ForumPage)8 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)6 Test (org.junit.Test)6 CourseEditorPageFragment (org.olat.selenium.page.course.CourseEditorPageFragment)6 CoursePageFragment (org.olat.selenium.page.course.CoursePageFragment)6 LoginPage (org.olat.selenium.page.LoginPage)4 NavigationPage (org.olat.selenium.page.NavigationPage)4 UserRestClient (org.olat.test.rest.UserRestClient)4 UserVO (org.olat.user.restapi.UserVO)4 ForumCEPage (org.olat.selenium.page.course.ForumCEPage)2 MediaCenterPage (org.olat.selenium.page.portfolio.MediaCenterPage)2 UserToolsPage (org.olat.selenium.page.user.UserToolsPage)2 By (org.openqa.selenium.By)2