use of org.olat.selenium.page.course.CoursePageFragment in project openolat by klemens.
the class CourseElementTest method forumWithGuest.
/**
* An administrator create a category in catalog. It creates a new course
* with a forum open to guests. it publish the course in the
* catalog.<br>
* The guest find the course, create a new thread. The administrator reply
* to the message, the guest to its reply.<br>
* The administrator checks the last message in its new messages, click
* back, use the list of users to see the messages of the guest. It clicks
* back to the threads list and checks the thread has 3 messages.
*
* @param loginPage
* @param guestBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void forumWithGuest(@InitialPage LoginPage loginPage, @Drone @User WebDriver guestBrowser) throws IOException, URISyntaxException {
loginPage.loginAs("administrator", "openolat").resume();
String node1 = "Forums " + UUID.randomUUID();
navBar.openCatalogAdministration().addCatalogNode(node1, "First level of the catalog");
// create a course
String courseTitle = "Guest FO " + UUID.randomUUID();
navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
// go the authoring environment to create a forum
String foTitle = "GFO - " + UUID.randomUUID();
CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
courseEditor.createNode("fo").nodeTitle(foTitle);
// configure for guest
ForumCEPage forumConfig = new ForumCEPage(browser);
forumConfig.selectConfiguration().allowGuest();
// publish the course
courseEditor.publish().nextSelectNodes().selectAccess(UserAccess.guest).nextAccess().selectCatalog(true).selectCategory(null, node1).nextCatalog().finish();
// back in course
courseEditor.clickToolbarBack();
// guest go to the catalog and find the course
LoginPage guestLogin = LoginPage.getLoginPage(guestBrowser, deploymentUrl);
guestLogin.asGuest();
NavigationPage guestNavBar = new NavigationPage(guestBrowser);
guestNavBar.openCatalog().selectCatalogEntry(node1).select(courseTitle).start();
// go to the forum
new CoursePageFragment(guestBrowser).clickTree().selectWithTitle(foTitle.substring(0, 20));
String guestAlias = "Guest-" + UUID.randomUUID();
ForumPage guestForum = ForumPage.getCourseForumPage(guestBrowser).createThread("Your favorite author", "Name your favorite author", guestAlias);
// admin go to the forum
new CoursePageFragment(browser).clickTree().selectWithTitle(foTitle.substring(0, 20));
// admin reply to the thread of guest
ForumPage adminForum = ForumPage.getCourseForumPage(browser).openThread("Your favorite author").assertOnGuestPseudonym(guestAlias).newMessages().assertOnGuestPseudonym(guestAlias).replyToMessage("Your favorite author", "Huxley is my favorite author", "My favorite author is Huxley");
// guest refresh the view and reply to admin
guestForum.flatView().assertMessageBody("Huxley").replyToMessage("Huxley is my favorite author", " I prefer Orwell", "Orwell is my favorite author");
// admin see its new messages, see the list of users, select the guest and its messages
// JMS message need to be delivered
OOGraphene.waitingALittleLonger();
adminForum.newMessages().assertMessageBody("Orwell").clickBack().userFilter().selectFilteredUser(guestAlias).assertMessageBody("Orwell").clickBack().clickBack().assertThreadListOnNumber("Your favorite author", 3);
}
use of org.olat.selenium.page.course.CoursePageFragment 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.course.CoursePageFragment 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);
}
use of org.olat.selenium.page.course.CoursePageFragment in project openolat by klemens.
the class CourseTest method createCourse_withWizard.
/**
* Create a course, use the course wizard, select all course
* elements and go further with the standard settings.
*
* Go from the description editor to the course, check
* that the course is automatically published and that
* the five course elements are there.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void createCourse_withWizard(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
loginPage.loginAs(author.getLogin(), author.getPassword());
// go to authoring
AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
String title = "Create-Course-Wizard-" + UUID.randomUUID().toString();
// create course
CourseWizardPage courseWizard = authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateFormAndStartWizard(title);
courseWizard.selectAllCourseElements().nextNodes().nextCatalog().finish();
// OOGraphene.closeErrorBox(browser);//STMP error
RepositoryEditDescriptionPage editDescription = new RepositoryEditDescriptionPage(browser);
// from description editor, back to details and launch the course
editDescription.assertOnGeneralTab();
// close mail error
OOGraphene.closeErrorBox(browser);
editDescription.clickToolbarBack();
// open course editor
CoursePageFragment course = CoursePageFragment.getCourse(browser);
course.assertOnCoursePage().assertOnTitle(title);
// assert the 5 nodes are there and click them
By nodeBy = By.cssSelector("span.o_tree_link.o_tree_l1.o_tree_level_label_leaf>a");
List<WebElement> nodes = browser.findElements(nodeBy);
Assert.assertEquals(5, nodes.size());
for (WebElement node : nodes) {
node.click();
OOGraphene.waitBusy(browser);
}
}
use of org.olat.selenium.page.course.CoursePageFragment in project openolat by klemens.
the class CourseTest method createCourseWithSpecialCharacters.
/**
* Check if we can create and open a course with this
* name: It's me, the "course".
* @see https://jira.openolat.org/browse/OO-1839
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void createCourseWithSpecialCharacters(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
loginPage.loginAs(author.getLogin(), author.getPassword());
// go to authoring
AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
String marker = Long.toString(System.currentTimeMillis());
String title = "It's me, the \"course\" number " + marker;
// create course
RepositoryEditDescriptionPage editDescription = authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab();
// from description editor, back to the course
editDescription.clickToolbarBack();
// close the course
navBar.closeTab();
// select the authoring
navBar.openAuthoringEnvironment().selectResource(marker);
new CoursePageFragment(browser).assertOnCoursePage();
}
Aggregations