use of org.olat.selenium.page.course.CourseEditorPageFragment in project openolat by klemens.
the class CourseTest method createCourse.
/**
* An author create a course, jump to it, open the editor
* add an info messages course element, publish the course
* and view it.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void createCourse(@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-Selen-" + UUID.randomUUID();
// create course
RepositoryEditDescriptionPage editDescription = authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab();
// from description editor, back to the course
editDescription.clickToolbarBack();
// open course editor
CoursePageFragment course = CoursePageFragment.getCourse(browser);
CourseEditorPageFragment editor = course.assertOnCoursePage().assertOnTitle(title).openToolsMenu().edit();
// create a course element of type info messages
PublisherPageFragment publisher = editor.assertOnEditor().createNode("info").publish();
// publish
publisher.assertOnPublisher().nextSelectNodes().selectAccess(UserAccess.guest).nextAccess().selectCatalog(false).nextCatalog().finish();
// back to the course
CoursePageFragment publishedCourse = editor.clickToolbarBack();
// review the course
publishedCourse.assertOnCoursePage().clickTree();
}
use of org.olat.selenium.page.course.CourseEditorPageFragment in project openolat by klemens.
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();
}
use of org.olat.selenium.page.course.CourseEditorPageFragment in project openolat by klemens.
the class CourseTest method createCourseWithCalendar.
/**
* Create a course with a calendar element, add a recurring event
* all day, modify an occurence to an event between 13h and 15h.
* Remove an other single occurence and at the end, remove all remaining
* events by removing the original event and confirm that
* all must be deleted.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void createCourseWithCalendar(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
loginPage.loginAs(author.getLogin(), author.getPassword());
// create a course
String courseTitle = "Course-With-iCal-" + UUID.randomUUID();
navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
navBar.openCourse(courseTitle);
String calendarNodeTitle = "iCal-1";
// create a course element of type calendar
CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
courseEditor.createNode("cal").nodeTitle(calendarNodeTitle);
// publish the course
courseEditor.publish().quickPublish();
// open the course and see the calendar
CoursePageFragment course = courseEditor.clickToolbarBack();
course.clickTree().selectWithTitle(calendarNodeTitle);
// create a recurring event
CalendarPage calendar = new CalendarPage(browser);
calendar.addEvent(3).setDescription("Eventhor", "Hammer", "Asgard").setAllDay(true).setRecurringEvent(KalendarEvent.WEEKLY, 28).save();
// modify an occurence
calendar.openDetailsOccurence("Eventhor", 17).edit().setAllDay(false).setBeginEnd(13, 15).save().confirmModifyOneOccurence();
// check
calendar.assertOnEvents("Eventhor", 4).assertOnEventsAt("Eventhor", 1, 13);
// modify all events
calendar.openDetailsOccurence("Eventhor", 3).edit().setDescription("Eventoki", null, null).save().confirmModifyAllOccurences();
// check
calendar.assertOnEvents("Eventoki", 3).assertOnEventsAt("Eventhor", 1, 13);
// delete an occurence
calendar.openDetailsOccurence("Eventoki", 10).edit().delete().confirmDeleteOneOccurence();
// check
calendar.assertOnEvents("Eventoki", 2).assertOnEventsAt("Eventhor", 1, 13);
// delete all
calendar.openDetailsOccurence("Eventoki", 3).edit().delete().confirmDeleteAllOccurences();
OOGraphene.waitingALittleBit();
calendar.assertZeroEvent();
}
use of org.olat.selenium.page.course.CourseEditorPageFragment in project openolat by klemens.
the class CourseTest method catalogRoundTrip.
/**
* Create a catalog, create a course, while publishing add the
* course to the catalog. Go to the catalog, find the course and
* open it.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void catalogRoundTrip(@Drone @Administrator WebDriver adminBrowser, @Drone @User WebDriver userBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO user = new UserRestClient(deploymentUrl).createRandomUser();
// administrator create the categories in the catalog
LoginPage adminLogin = LoginPage.getLoginPage(adminBrowser, deploymentUrl);
adminLogin.loginAs("administrator", "openolat").resume();
NavigationPage adminNavBar = new NavigationPage(adminBrowser);
String node1 = "First level " + UUID.randomUUID();
String node2_1 = "Second level first element " + UUID.randomUUID();
String node2_2 = "Second level second element " + UUID.randomUUID();
adminNavBar.openCatalogAdministration().addCatalogNode(node1, "First level of the catalog").selectNode(node1).addCatalogNode(node2_1, "First element of the second level").addCatalogNode(node2_2, "Second element of the second level");
// An author create a course and publish it under a category
// created above
LoginPage login = LoginPage.getLoginPage(browser, deploymentUrl);
login.loginAs(author.getLogin(), author.getPassword()).resume();
String courseTitle = "Catalog-Course-" + UUID.randomUUID();
navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
courseEditor.publish().nextSelectNodes().selectAccess(UserAccess.guest).nextAccess().selectCatalog(true).selectCategory(node1, node2_2).finish();
// User logs in, go to "My courses", navigate the catalog and start
// the course
LoginPage userLogin = LoginPage.getLoginPage(userBrowser, deploymentUrl);
userLogin.loginAs(user.getLogin(), user.getPassword()).resume();
NavigationPage userNavBar = new NavigationPage(userBrowser);
userNavBar.openMyCourses().openCatalog().selectCatalogEntry(node1).selectCatalogEntry(node2_2).select(// go to the details page
courseTitle).start();
By courseTitleBy = By.cssSelector("div.o_course_run h2");
WebElement courseTitleEl = userBrowser.findElement(courseTitleBy);
Assert.assertTrue(courseTitleEl.getText().contains(courseTitle));
}
use of org.olat.selenium.page.course.CourseEditorPageFragment in project openolat by klemens.
the class CourseTest method courseAccessRules.
/**
* An author creates a course with 4 course elements. A folder
* which is visible to group, a forum which is visible to coaches,
* an assessment and an info visible to the students which passed
* the assessment above.<br>
* a student come and checks what it can see, the author make it
* pass the assessment and the student sees the info.
*
* @param loginPage
* @param kanuBrowser
* @param reiBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void courseAccessRules(@InitialPage LoginPage loginPage, @Drone @Student WebDriver reiBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("rei");
loginPage.loginAs(author.getLogin(), author.getPassword());
// create a course
String courseTitle = "Course FO " + UUID.randomUUID();
navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
// go the authoring environment to create a forum
String bcTitle = "BC - " + UUID.randomUUID();
String foTitle = "FO - " + UUID.randomUUID();
String msTitle = "MS - " + UUID.randomUUID();
String infoTitle = "Info - " + UUID.randomUUID();
String groupName = "Students";
CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
// folder is group protected
courseEditor.createNode("bc").nodeTitle(bcTitle).selectTabVisibility().setGroupCondition().createBusinessGroup(groupName);
// forum is coach exclusive
courseEditor.createNode("fo").nodeTitle(foTitle).selectTabVisibility().setCoachExclusive().save();
// assessment is open
courseEditor.createNode("ms").nodeTitle(msTitle);
// configure assessment
AssessmentCEConfigurationPage assessmentConfig = new AssessmentCEConfigurationPage(browser);
assessmentConfig.selectConfiguration().setScoreAuto(0.0f, 6.0f, 4.0f);
// wiki is assessment dependent
courseEditor.createNode("info").nodeTitle(infoTitle).selectTabVisibility().setAssessmentCondition(1).save();
OOGraphene.scrollTop(browser);
courseEditor.publish().nextSelectNodes().selectAccess(UserAccess.membersOnly).nextAccess().selectCatalog(false).nextCatalog().finish();
courseEditor.clickToolbarBack();
// add a member to the group we create above
MembersPage members = CoursePageFragment.getCourse(browser).members();
members.addMember().searchMember(rei, true).nextUsers().nextOverview().selectGroupAsParticipant(groupName).nextPermissions().finish();
// participant search the course
LoginPage.getLoginPage(reiBrowser, deploymentUrl).loginAs(rei).resume();
NavigationPage reiNavBar = new NavigationPage(reiBrowser);
reiNavBar.openMyCourses().select(courseTitle);
MenuTreePageFragment reiTree = new MenuTreePageFragment(reiBrowser);
reiTree.assertWithTitle(bcTitle.substring(0, 20)).assertWithTitle(msTitle.substring(0, 20)).assertTitleNotExists(foTitle.substring(0, 20)).assertTitleNotExists(infoTitle.substring(0, 20));
// author set assessment to passed
AssessmentToolPage assessmentTool = members.clickToolbarBack().assessmentTool();
assessmentTool.users().assertOnUsers(rei).selectUser(rei).selectCourseNode(msTitle.substring(0, 20)).setAssessmentScore(5.5f).assertUserPassedCourseNode(msTitle.substring(0, 20));
// student can see info
reiTree.selectRoot().assertWithTitle(bcTitle.substring(0, 20)).assertWithTitle(msTitle.substring(0, 20)).assertTitleNotExists(foTitle.substring(0, 20)).assertWithTitle(infoTitle.substring(0, 20));
// author can see all
assessmentTool.clickToolbarRootCrumb().clickTree().assertWithTitle(bcTitle.substring(0, 20)).assertWithTitle(msTitle.substring(0, 20)).assertWithTitle(foTitle.substring(0, 20)).assertWithTitle(infoTitle.substring(0, 20));
}
Aggregations