use of org.olat.selenium.page.course.CourseEditorPageFragment 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);
}
use of org.olat.selenium.page.course.CourseEditorPageFragment 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);
}
use of org.olat.selenium.page.course.CourseEditorPageFragment in project OpenOLAT by OpenOLAT.
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());
}
use of org.olat.selenium.page.course.CourseEditorPageFragment in project OpenOLAT by OpenOLAT.
the class CourseElementTest method blogWithMultipleUsers.
/**
* An author create a course with a blog, open it, add a post. A student
* open the course, see the blog post. The author add a new post, the
* student must see it.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void blogWithMultipleUsers(@InitialPage LoginPage loginPage, @Drone @Participant WebDriver participantDrone) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO participant = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
loginPage.loginAs(author.getLogin(), author.getPassword());
// create a course with a blog
String courseTitle = "Course-Blog-1-" + UUID.randomUUID().toString();
navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
String blogNodeTitle = "Blog-RW-1";
String blogTitle = "Blog - RW - " + 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 blog
CoursePageFragment course = courseEditor.clickToolbarBack();
course.clickTree().selectWithTitle(blogNodeTitle);
String postTitle = "Blog-RW-1-" + 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();
// participant go to the blog
participantDrone.navigate().to(deploymentUrl);
LoginPage participantLogin = LoginPage.getLoginPage(participantDrone, deploymentUrl);
participantLogin.loginAs(participant.getLogin(), participant.getPassword());
// search the course in "My courses"
NavigationPage participantNavigation = new NavigationPage(participantDrone);
participantNavigation.openMyCourses().openSearch().extendedSearch(courseTitle).select(courseTitle).start();
// Navigate the course to the blog
CoursePageFragment participantCourse = new CoursePageFragment(participantDrone);
participantCourse.clickTree().selectWithTitle(blogNodeTitle);
FeedPage participantFeed = FeedPage.getFeedPage(participantDrone);
participantFeed.assertOnBlogPost(postTitle);
// the author publish a second post in its blog
String post2Title = "Blog-RW-2-" + UUID.randomUUID();
String post2Summary = "Some explantations as teaser";
String post2Content = "Content of the post";
feed.addBlogPost().fillPostForm(post2Title, post2Summary, post2Content).publishPost();
// the participant must see the new post after some click
participantFeed.clickFirstMonthOfPager().assertOnBlogPost(post2Title);
}
use of org.olat.selenium.page.course.CourseEditorPageFragment in project OpenOLAT by OpenOLAT.
the class CourseElementTest method createCourseWithLTI.
/**
* An author setup a course with a LTI course element with score enabled.
* A participant take the course and see the LTI content. The back channel
* need the url of the OpenOLAT instance which is currently difficult
* for a selenium test. The grading is not tested until a LTI server
* can be installed on localhost.
*
* @param authorLoginPage
* @param participantBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void createCourseWithLTI(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO participant = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
// create a course
String courseTitle = "Course-LTI-" + UUID.randomUUID();
navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
// create a course element of type Test with the test that we create above
String ltiTitle = "LTI";
CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit().createNode("lti").nodeTitle(ltiTitle);
// configure assessment
LTIConfigurationPage ltiConfig = new LTIConfigurationPage(browser);
ltiConfig.selectConfiguration().setLtiPage("http://lti.frentix.com/tool.php", "123456", "secret").enableScore(10.0d, 5.0d).save();
// set the score / passed calculation in root node and publish
courseEditor.selectRoot().selectTabScore().enableRootScoreByNodes().autoPublish().accessConfiguration().setUserAccess(UserAccess.registred);
// go to members management
CoursePageFragment courseRuntime = courseEditor.clickToolbarBack();
MembersPage members = courseRuntime.members();
members.addMember().searchMember(participant, true).nextUsers().nextOverview().nextPermissions().finish();
// Participant login
LoginPage participantLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
participantLoginPage.loginAs(participant.getLogin(), participant.getPassword()).resume();
NavigationPage participantNavBar = new NavigationPage(participantBrowser);
participantNavBar.openMyCourses().openSearch().extendedSearch(courseTitle).select(courseTitle);
CoursePageFragment participantCourse = new CoursePageFragment(participantBrowser);
participantCourse.clickTree().selectWithTitle(ltiTitle);
LTIPage lti = new LTIPage(participantBrowser);
lti.start().outcomeToolProvider();
// .sendGrade(0.8d);
}
Aggregations