Search in sources :

Example 1 with RemindersPage

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);
}
Also used : UserToolsPage(org.olat.selenium.page.user.UserToolsPage) RemindersPage(org.olat.selenium.page.course.RemindersPage) NavigationPage(org.olat.selenium.page.NavigationPage) UserVO(org.olat.user.restapi.UserVO) AuthoringEnvPage(org.olat.selenium.page.repository.AuthoringEnvPage) Calendar(java.util.Calendar) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) Date(java.util.Date) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 2 with RemindersPage

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);
}
Also used : UserToolsPage(org.olat.selenium.page.user.UserToolsPage) RemindersPage(org.olat.selenium.page.course.RemindersPage) NavigationPage(org.olat.selenium.page.NavigationPage) UserVO(org.olat.user.restapi.UserVO) AuthoringEnvPage(org.olat.selenium.page.repository.AuthoringEnvPage) Calendar(java.util.Calendar) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) Date(java.util.Date) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Aggregations

Calendar (java.util.Calendar)2 Date (java.util.Date)2 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)2 Test (org.junit.Test)2 NavigationPage (org.olat.selenium.page.NavigationPage)2 CoursePageFragment (org.olat.selenium.page.course.CoursePageFragment)2 RemindersPage (org.olat.selenium.page.course.RemindersPage)2 AuthoringEnvPage (org.olat.selenium.page.repository.AuthoringEnvPage)2 UserToolsPage (org.olat.selenium.page.user.UserToolsPage)2 UserRestClient (org.olat.test.rest.UserRestClient)2 UserVO (org.olat.user.restapi.UserVO)2