use of org.olat.selenium.page.course.RemindersPage 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.RemindersPage 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);
}
Aggregations