use of org.olat.selenium.page.course.CoursePageFragment in project OpenOLAT by OpenOLAT.
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.course.CoursePageFragment in project OpenOLAT by OpenOLAT.
the class CourseTest method courseRename.
/**
* Test that renaming the root node is reflected after
* publishing.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void courseRename(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
loginPage.loginAs(author.getLogin(), author.getPassword());
// create a course
String courseTitle = "Course to rename-" + UUID.randomUUID().toString();
navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
// open course editor
CoursePageFragment course = CoursePageFragment.getCourse(browser);
CourseEditorPageFragment editor = course.assertOnCoursePage().assertOnTitle(courseTitle).openToolsMenu().edit();
// create a course element of type info messages
course = editor.assertOnEditor().createNode("info").autoPublish();
// check that the root node has the name of the repository entry
course.assertOnTitle(courseTitle);
// rename the root node
String newCourseName = "Renamed course";
course = course.edit().selectRoot().nodeTitle(newCourseName).autoPublish();
// assert the changed name
course.assertOnTitle(newCourseName);
}
use of org.olat.selenium.page.course.CoursePageFragment in project OpenOLAT by OpenOLAT.
the class CourseTest method courseBooking.
/**
* An author creates a course, make it visible for
* members and add an access control by password.
* The user search for the course, books it and give
* the password.<br/>
* The author checks in the list of orders if the booking
* of the user is there and after it checks if the user is
* in the member list too.
*
* @param loginPage
* @param ryomouBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void courseBooking(@InitialPage LoginPage loginPage, @Drone @User WebDriver ryomouBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
loginPage.loginAs(author.getLogin(), author.getPassword());
UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
// go to authoring
AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
String title = "Create-Selen-" + UUID.randomUUID().toString();
// create course
authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab();
// open course editor
CoursePageFragment course = new CoursePageFragment(browser);
RepositoryAccessPage courseAccess = course.openToolsMenu().edit().createNode("info").autoPublish().accessConfiguration().setUserAccess(UserAccess.registred);
// add booking by secret token
courseAccess.boooking().openAddDropMenu().addTokenMethod().configureTokenMethod("secret", "The password is secret");
courseAccess.clickToolbarBack();
// a user search the course
LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl);
ryomouLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
NavigationPage ryomouNavBar = new NavigationPage(ryomouBrowser);
ryomouNavBar.openMyCourses().openSearch().extendedSearch(title).book(title);
// book the course
BookingPage booking = new BookingPage(ryomouBrowser);
booking.bookToken("secret");
// check the course
CoursePageFragment bookedCourse = CoursePageFragment.getCourse(ryomouBrowser);
bookedCourse.assertOnTitle(title);
// Author go in the list of bookings of the course
BookingPage bookingList = course.openToolsMenu().bookingTool();
bookingList.assertFirstNameInListIsOk(ryomou);
// Author go to members list
course.members().assertFirstNameInList(ryomou);
}
use of org.olat.selenium.page.course.CoursePageFragment in project OpenOLAT by OpenOLAT.
the class CourseTest method confirmMembershipForCourse.
/**
* First, an administrator make in administration part
* the confirmation of group's membership mandatory if
* the group is created by an author.<br>
*
* An author create a course and a group and add two
* participants. The first user jump to the course
* with a rest url, log in, confirm its membership
* and see the course.<br>
* The second participant log-in, confirm its membership,
* go the "My courses" and visit the course.
*
* @param loginPage
* @param authorBrowser
* @param participantBrowser
* @param reiBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void confirmMembershipForCourse(@InitialPage LoginPage loginPage, @Drone @Author WebDriver authorBrowser, @Drone @Participant WebDriver participantBrowser, @Drone @Student WebDriver reiBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
UserVO participant = new UserRestClient(deploymentUrl).createRandomUser();
// admin make the confirmation of membership mandatory
// for groups created by standard users.
loginPage.loginAs("administrator", "openolat").resume();
AdministrationPage administration = new NavigationPage(browser).openAdministration().openGroupSettings().setGroupConfirmationForAuthor(true);
// author create a course
String courseTitle = "Membership " + UUID.randomUUID();
LoginPage.getLoginPage(authorBrowser, deploymentUrl).loginAs(author).resume();
NavigationPage authorNavBar = new NavigationPage(authorBrowser);
authorNavBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
String groupName = "Groupship " + UUID.randomUUID();
MembersPage members = CoursePageFragment.getCourse(authorBrowser).members();
// create a group
members.selectBusinessGroups().createBusinessGroup(groupName, "-", 1, false, false);
// return to course
authorNavBar.openCourse(courseTitle);
// add the 2 participants to the group
members.selectMembers().addMember().searchMember(rei, true).nextUsers().nextOverview().selectGroupAsParticipant(groupName).nextPermissions().finish();
members.addMember().searchMember(participant, true).nextUsers().nextOverview().selectGroupAsParticipant(groupName).nextPermissions().finish();
members.clickToolbarBack();
// set the course for members only
CoursePageFragment.getCourse(authorBrowser).accessConfiguration().setUserAccess(UserAccess.registred);
String currentUrl = authorBrowser.getCurrentUrl();
int index = currentUrl.indexOf("/Access");
Assert.assertTrue(index > 0);
String courseUrl = currentUrl.substring(0, index);
// rest url -> login -> accept membership
reiBrowser.get(courseUrl);
new LoginPage(reiBrowser).loginAs(rei.getLogin(), rei.getPassword()).assertOnMembershipConfirmation().confirmMembership();
new CoursePageFragment(reiBrowser).assertOnCoursePage().assertOnTitle(courseTitle);
// participant login -> accept membership -> my courses -> course
LoginPage participantLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
participantLoginPage.loginAs(participant.getLogin(), participant.getPassword()).assertOnMembershipConfirmation().confirmMembership();
NavigationPage participantNavBar = new NavigationPage(participantBrowser);
participantNavBar.openMyCourses().select(courseTitle);
new CoursePageFragment(participantBrowser).assertOnCoursePage().assertOnTitle(courseTitle);
// reset the settings
administration.setGroupConfirmationForAuthor(false);
}
use of org.olat.selenium.page.course.CoursePageFragment in project OpenOLAT by OpenOLAT.
the class CourseTest method concurrentEditCourse.
/**
* An author create a course, add a second user as co-author
* of the course, and edit the course.<br>
* The co-author select the course and try to edit it, unsuccessfully.
* It try to edit the course directly from the author list without
* success.<br>
* The author closes the editor and the co-author is allowed to edit.
* The author cannot edit i anymore...
*
* @param loginPage Login page of the author
* @param coAuthorBrowser the browser for the coauthor
*/
@Test
@RunAsClient
public void concurrentEditCourse(@InitialPage LoginPage loginPage, @Drone @Participant WebDriver coAuthorBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO coAuthor = new UserRestClient(deploymentUrl).createAuthor("Rei");
loginPage.loginAs(author.getLogin(), author.getPassword()).resume();
// go to authoring
AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
String title = "Coedit-" + UUID.randomUUID();
// create course
authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab().clickToolbarBack();
// add a second owner
MembersPage members = new CoursePageFragment(browser).members();
members.addMember().searchMember(coAuthor, true).nextUsers().nextOverview().selectRepositoryEntryRole(true, false, false).nextPermissions().finish();
// open the editor
CoursePageFragment coursePage = members.clickToolbarBack();
CourseEditorPageFragment editor = coursePage.edit();
// the second author come in
LoginPage coAuthroLoginPage = LoginPage.getLoginPage(coAuthorBrowser, deploymentUrl);
coAuthroLoginPage.loginAs(coAuthor.getLogin(), coAuthor.getPassword()).resume();
// go to authoring
NavigationPage coAuthorNavBar = new NavigationPage(coAuthorBrowser);
coAuthorNavBar.assertOnNavigationPage().openAuthoringEnvironment().selectResource(title);
// try to edit
CoursePageFragment coAuthorCourse = new CoursePageFragment(coAuthorBrowser);
coAuthorCourse.tryToEdit().assertOnWarning();
// retry in list
coAuthorNavBar.openAuthoringEnvironment().editResource(title);
new CourseEditorPageFragment(coAuthorBrowser).assertOnWarning();
// author close the course editor
editor.clickToolbarBack();
coursePage.assertOnCoursePage();
// co-author edit the course
CourseEditorPageFragment coAuthorEditor = coAuthorCourse.edit().assertOnEditor();
// author try
coursePage.tryToEdit().assertOnWarning();
// co-author close the editor
coAuthorEditor.clickToolbarBack().assertOnCoursePage();
// author reopens the editor
coursePage.edit().assertOnEditor();
}
Aggregations