use of org.olat.selenium.page.course.CoursePageFragment 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.CoursePageFragment 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.CoursePageFragment 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);
}
use of org.olat.selenium.page.course.CoursePageFragment in project OpenOLAT by OpenOLAT.
the class CourseElementTest method createCourseWithParticipantFolder.
/**
* An author create a course with a participant folder course
* element. It add a participant to the course and upload file
* in the return box of this participant.<br>
* The participant come in and open the course, see the file
* uploaded by the author in its return box and it uploads an
* image in its drop box. The author go the see the image.
*
* @param authorLoginPage
* @param participantBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void createCourseWithParticipantFolder(@InitialPage LoginPage authorLoginPage, @Drone @Participant WebDriver participantBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO participant = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
// go to authoring
AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
String title = "Course partilist " + UUID.randomUUID();
// create course
authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab().clickToolbarBack();
String participantFolderTitle = "ParticipantList";
// open course editor
CoursePageFragment course = CoursePageFragment.getCourse(browser);
CourseEditorPageFragment editor = course.assertOnCoursePage().assertOnTitle(title).openToolsMenu().edit().createNode("pf").nodeTitle(participantFolderTitle);
// publish
editor.publish().quickPublish(UserAccess.membersOnly);
editor.clickToolbarBack();
// add a participant
MembersPage members = new CoursePageFragment(browser).members();
members.addMember().searchMember(participant, true).nextUsers().nextOverview().selectRepositoryEntryRole(false, false, true).nextPermissions().finish();
members.clickToolbarBack();
// go to the course element
course.clickTree().selectWithTitle(participantFolderTitle);
// open the return box of the participant and upload a file
URL coachImageUrl = JunitTestHelper.class.getResource("file_resources/IMG_1484.jpg");
File coachImageFile = new File(coachImageUrl.toURI());
ParticipantFolderPage folder = new ParticipantFolderPage(browser);
folder.assertOnParticipantsList().assertOnParticipant(participant.getFirstName()).openParticipantFolder(participant.getFirstName());
FolderPage directory = folder.openReturnBox().uploadFile(coachImageFile).assertOnFile(coachImageFile.getName());
// The participant come in
LoginPage participantLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
participantLoginPage.loginAs(participant.getLogin(), participant.getPassword()).resume();
// The participant find the course
NavigationPage participantNavBar = new NavigationPage(participantBrowser);
participantNavBar.assertOnNavigationPage().openMyCourses().select(title);
// And opens the participant folder
CoursePageFragment participantCourse = CoursePageFragment.getCourse(participantBrowser);
participantCourse.clickTree().selectWithTitle(participantFolderTitle);
ParticipantFolderPage participantFolder = new ParticipantFolderPage(participantBrowser);
participantFolder.openReturnBox().assertOnFile(coachImageFile.getName()).selectRootDirectory();
// Participant upload a file in its drop box
URL participantImageUrl = JunitTestHelper.class.getResource("file_resources/IMG_1484.jpg");
File participantImageFile = new File(participantImageUrl.toURI());
participantFolder.openDropBox().uploadFile(participantImageFile).assertOnFile(participantImageFile.getName());
// Author check the image in the participant drop box
directory.selectRootDirectory();
folder.openDropBox().assertOnFile(participantImageFile.getName());
}
use of org.olat.selenium.page.course.CoursePageFragment in project OpenOLAT by OpenOLAT.
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());
}
Aggregations