use of org.olat.selenium.page.course.CoursePageFragment in project openolat by klemens.
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 klemens.
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 klemens.
the class CourseElementTest method createCourseWithInfoMessages.
/**
* Login, create a course, select "Messages Course", insert an info message
* course element, publish the course, add messages, count if the messages
* are there, show older messages, count the messages, show current messages,
* count the messages, edit a message and delete an other, count the messages.
*
* @param authorLoginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void createCourseWithInfoMessages(@InitialPage LoginPage authorLoginPage) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
// go to authoring
AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
String title = "Course Msg " + UUID.randomUUID().toString();
// create course
authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab().clickToolbarBack();
String infoNodeTitle = "Infos - News";
// open course editor
CoursePageFragment course = CoursePageFragment.getCourse(browser);
CourseEditorPageFragment editor = course.assertOnCoursePage().assertOnTitle(title).openToolsMenu().edit().createNode("info").nodeTitle(infoNodeTitle);
// configure the info messages
InfoMessageCEPage infoMsgConfig = new InfoMessageCEPage(browser);
infoMsgConfig.selectConfiguration().configure(3);
// publish
editor.publish().quickPublish(UserAccess.registred);
editor.clickToolbarBack();
course.clickTree().selectWithTitle(infoNodeTitle);
// set a message
infoMsgConfig.createMessage().setMessage("Information 0", "A very important info").next().finish().assertOnMessageTitle("Information 0");
for (int i = 1; i <= 3; i++) {
infoMsgConfig.quickMessage("Information " + i, "More informations");
}
int numOfMessages = infoMsgConfig.countMessages();
Assert.assertEquals(3, numOfMessages);
// count old messages
int numOfOldMessages = infoMsgConfig.oldMessages().countMessages();
Assert.assertEquals(4, numOfOldMessages);
// new messages
infoMsgConfig.newMessages();
int numOfNewMessages = infoMsgConfig.countMessages();
Assert.assertEquals(3, numOfNewMessages);
// edit
infoMsgConfig.oldMessages();
infoMsgConfig.editMessage("Information 2").setMessage("The latest information", "A very important info").save().assertOnMessageTitle("The latest information");
// delete
infoMsgConfig.deleteMessage("Information 3").confirmDelete();
int numOfSurvivingMessages = infoMsgConfig.countMessages();
Assert.assertEquals(3, numOfSurvivingMessages);
}
use of org.olat.selenium.page.course.CoursePageFragment in project openolat by klemens.
the class CourseElementTest method createCourseWithQTITest.
@Test
@RunAsClient
public void createCourseWithQTITest(@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-QTI-Test-1.2-" + UUID.randomUUID().toString();
navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
String testNodeTitle = "QTITest-1";
String testTitle = "Test - " + 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("iqtest").nodeTitle(testNodeTitle).selectTabLearnContent().createQTI12Test(testTitle);
// publish the course
courseEditor.publish().quickPublish();
// open the course and see the CP
CoursePageFragment course = courseEditor.clickToolbarBack();
course.clickTree().selectWithTitle(testNodeTitle);
// check that the title of the start page of test is correct
WebElement testH2 = browser.findElement(By.cssSelector("div.o_course_run h2"));
Assert.assertEquals(testNodeTitle, testH2.getText().trim());
}
use of org.olat.selenium.page.course.CoursePageFragment in project openolat by klemens.
the class CourseElementTest method createCourseWithMemberList.
/**
* An author create a course with a member list course element.
* It add two participants and a coach. It publish the course and
* check that it sees the authors, coaches and participants.<br>
* After that, it edits the course and change the settins to only
* show the participants. It checks that only the participants are
* visible.<br>
* At least, it changes the settings a second time to only show
* the course coaches.
*
* @param authorLoginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void createCourseWithMemberList(@InitialPage LoginPage authorLoginPage) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO coach = new UserRestClient(deploymentUrl).createRandomUser("Rei");
UserVO participant1 = new UserRestClient(deploymentUrl).createRandomUser("Kanu");
UserVO participant2 = 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();
// add 2 participants
CoursePageFragment course = new CoursePageFragment(browser);
MembersPage members = course.members();
members.importMembers().setMembers(participant1, participant2).nextUsers().nextOverview().nextPermissions().finish();
// add a coach
course.members().addMember().searchMember(coach, true).nextUsers().nextOverview().selectRepositoryEntryRole(false, true, false).nextPermissions().finish();
members.clickToolbarBack();
String memberListTitle = "MemberList";
// open course editor
CourseEditorPageFragment editor = course.assertOnCoursePage().assertOnTitle(title).openToolsMenu().edit().createNode("cmembers").nodeTitle(memberListTitle);
// publish
editor.publish().quickPublish(UserAccess.registred);
editor.clickToolbarBack();
course.clickTree().selectWithTitle(memberListTitle);
// check the default configuration with authors, coaches and participants
MemberListPage memberList = new MemberListPage(browser);
memberList.assertOnOwner(author.getFirstName()).assertOnCoach(coach.getFirstName()).assertOnParticipant(participant1.getFirstName()).assertOnParticipant(participant2.getFirstName());
// the author is not satisfied with the configuration
editor = course.openToolsMenu().edit().selectNode(memberListTitle);
MemberListConfigurationPage memberListConfig = new MemberListConfigurationPage(browser);
memberListConfig.selectSettings().setOwners(Boolean.FALSE).setCoaches(Boolean.FALSE).save();
// go check the results
course = editor.autoPublish();
course.clickTree().selectWithTitle(memberListTitle);
memberList.assertOnMembers().assertOnNotOwner(author.getFirstName()).assertOnNotCoach(coach.getFirstName()).assertOnParticipant(participant1.getFirstName()).assertOnParticipant(participant2.getFirstName());
// perhaps only the coaches
editor = course.openToolsMenu().edit().selectNode(memberListTitle);
memberListConfig = new MemberListConfigurationPage(browser);
memberListConfig.selectSettings().setCoaches(Boolean.TRUE).setCourseCoachesOnly().setParticipants(Boolean.FALSE).save();
// go check that we see only the coaches results
course = editor.autoPublish();
course.clickTree().selectWithTitle(memberListTitle);
memberList.assertOnMembers().assertOnNotOwner(author.getFirstName()).assertOnCoach(coach.getFirstName()).assertOnNotParticipant(participant1.getFirstName()).assertOnNotParticipant(participant2.getFirstName());
}
Aggregations