use of org.olat.selenium.page.repository.AuthoringEnvPage 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.repository.AuthoringEnvPage 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.repository.AuthoringEnvPage 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());
}
use of org.olat.selenium.page.repository.AuthoringEnvPage in project openolat by klemens.
the class CourseTest method courseReminders.
/**
* An author create a course, set a start and end date for life-cycle.
* It add a participant to the course. It creates a reminder
* with a rule to catch only participant, an other to send
* the reminder after the start of the course. It sends the reminder
* manually, checks the reminders send, checks the log.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void courseReminders(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
// configure at least a license
loginPage.loginAs("administrator", "openolat").resume();
new NavigationPage(browser).openAdministration().openLicenses().enableForResources("all rights reserved");
new UserToolsPage(browser).logout();
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
loginPage.loginAs(author.getLogin(), author.getPassword());
UserVO kanu = new UserRestClient(deploymentUrl).createRandomUser("Kanu");
// go to authoring
AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(Calendar.DATE, -10);
Date validFrom = cal.getTime();
cal.add(Calendar.DATE, 20);
Date validTo = cal.getTime();
String title = "Remind-me-" + UUID.randomUUID();
// create course
authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab().setLicense().setLifecycle(validFrom, validTo, Locale.GERMAN).save().clickToolbarBack();
// open course editor, create a node, set access
CoursePageFragment course = new CoursePageFragment(browser);
course.openToolsMenu().edit().createNode("info").autoPublish().accessConfiguration().setUserAccess(UserAccess.registred).clickToolbarBack();
// add a participant
course.members().quickAdd(kanu);
// go to reminders
RemindersPage reminders = course.reminders().assertOnRemindersList();
String reminderTitle = "REM-" + UUID.randomUUID();
reminders.addReminder().setDescription(reminderTitle).setSubject(reminderTitle).setTimeBasedRule(1, "RepositoryEntryLifecycleAfterValidFromRuleSPI", 5, "day").addRule(1).setRoleBasedRule(2, "RepositoryEntryRoleRuleSPI", "participant").saveReminder().assertOnRemindersList().assertOnReminderInList(reminderTitle);
// send the reminders
reminders.openActionMenu(reminderTitle).sendReminders();
// check the reminder is send to user
reminders.openActionMenu(reminderTitle).showSentReminders().assertSentRemindersList(kanu, true).assertSentRemindersList(author, false);
// open reminders log
reminders.clickToolbarBack().openLog().assertLogList(kanu, reminderTitle, true).assertLogList(author, reminderTitle, false);
}
use of org.olat.selenium.page.repository.AuthoringEnvPage in project openolat by klemens.
the class CourseTest method coursePassword.
/**
* An author creates a course with a structure element. The structure
* element is password protected. Under it, there is an info node. The
* course is published and a first user search the course, go to the
* structure element, give the password and see the info node. A second
* user grabs the rest url of the structure node, use it, give the password
* and go to the info node.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void coursePassword(@InitialPage LoginPage loginPage, @Drone @Participant WebDriver kanuBrowser, @Drone @User WebDriver ryomouBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO kanu = new UserRestClient(deploymentUrl).createRandomUser("Kanu");
UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
loginPage.loginAs(author.getLogin(), author.getPassword());
// go to authoring
AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
String title = "Password-me-" + UUID.randomUUID();
// create course
authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab().clickToolbarBack();
String infoTitle = "Info - " + UUID.randomUUID();
String structureTitle = "St - " + UUID.randomUUID();
// open course editor, create a structure node
CoursePageFragment course = new CoursePageFragment(browser);
CourseEditorPageFragment editor = course.openToolsMenu().edit();
editor.createNode("st").nodeTitle(structureTitle);
String courseInfoUrl = editor.getRestUrl();
editor.createNode("info").nodeTitle(infoTitle).moveUnder(structureTitle).selectNode(structureTitle).selectTabPassword().setPassword("super secret").autoPublish().accessConfiguration().setUserAccess(UserAccess.registred).clickToolbarBack();
MenuTreePageFragment courseTree = course.clickTree().selectWithTitle(structureTitle.substring(0, 20));
course.assertOnPassword().enterPassword("super secret");
courseTree.selectWithTitle(infoTitle.substring(0, 20));
course.assertOnTitle(infoTitle);
// 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(title).select(title).start();
// go to the structure, give the password
CoursePageFragment kanuCourse = new CoursePageFragment(kanuBrowser);
MenuTreePageFragment kanuTree = kanuCourse.clickTree().selectWithTitle(structureTitle.substring(0, 20));
kanuCourse.assertOnPassword().enterPassword("super secret");
kanuTree.selectWithTitle(infoTitle.substring(0, 20));
kanuCourse.assertOnTitle(infoTitle);
// Second user use the rest url
LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, new URL(courseInfoUrl));
ryomouLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
CoursePageFragment ryomouCourse = new CoursePageFragment(ryomouBrowser);
ryomouCourse.assertOnPassword().enterPassword("super secret");
// find the secret info course element
ryomouCourse.clickTree().selectWithTitle(structureTitle.substring(0, 20)).selectWithTitle(infoTitle.substring(0, 20));
ryomouCourse.assertOnTitle(infoTitle);
}
Aggregations