use of org.olat.selenium.page.course.MembersPage in project openolat by klemens.
the class BusinessGroupTest method enrollment.
/**
* An author create a course and a business group in the members
* management. It has max. participants set to 1 and no waiting list.
* Than it returns in the course editor to create an enrollment
* course element. It configure it and select the group created before.<br>
*
* Three users goes to the course and try to enroll. One will become
* a participant, the 2 others get an error message.
*
* @param authorLoginPage
* @param ryomouBrowser
* @param reiBrowser
* @param kanuBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void enrollment(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver ryomouBrowser, @Drone @Participant WebDriver reiBrowser, @Drone @Student WebDriver kanuBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
UserVO kanu = new UserRestClient(deploymentUrl).createRandomUser("kanu");
UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
// create a course
String courseTitle = "Enrollment-2-" + UUID.randomUUID();
navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
// create a group in members management
String groupName = "Enroll - " + UUID.randomUUID();
CoursePageFragment authorCourse = CoursePageFragment.getCourse(browser);
MembersPage membersPage = authorCourse.members().selectBusinessGroups().createBusinessGroup(groupName, "-", 1, false, false);
// back to the members page
navBar.openCourse(courseTitle);
authorCourse = membersPage.clickToolbarBack();
// create an enrollment course element
String enNodeTitle = "Enroll - 2";
CourseEditorPageFragment courseEditor = authorCourse.edit().createNode("en").nodeTitle(enNodeTitle);
// select the group created above
EnrollmentConfigurationPage enrolmentConfig = new EnrollmentConfigurationPage(browser);
enrolmentConfig.selectConfiguration().selectBusinessGroups();
// publish the course
courseEditor.publish().quickPublish(UserAccess.registred);
GroupPage authorGroup = navBar.openGroups(browser).selectGroup(groupName).openAdministration().openAdminMembers().setVisibility(false, true, false).openMembers().assertParticipantList();
Enrollment[] participantDrivers = new Enrollment[] { new Enrollment(ryomou, ryomouBrowser), new Enrollment(rei, reiBrowser), new Enrollment(kanu, kanuBrowser) };
for (Enrollment enrollment : participantDrivers) {
WebDriver driver = enrollment.getDriver();
LoginPage.getLoginPage(driver, deploymentUrl).loginAs(enrollment.getUser()).resume();
NavigationPage participantNavBar = new NavigationPage(driver);
participantNavBar.openMyCourses().openSearch().extendedSearch(courseTitle).select(courseTitle).start();
// go to the enrollment
CoursePageFragment participantCourse = new CoursePageFragment(driver);
participantCourse.clickTree().selectWithTitle(enNodeTitle);
EnrollmentPage enrollmentPage = new EnrollmentPage(driver);
enrollmentPage.assertOnEnrolmentPage();
enrollment.setEnrollmentPage(enrollmentPage);
}
// enroll
for (Enrollment enrollment : participantDrivers) {
enrollment.getEnrollmentPage().enrollNoWait();
}
// wait
for (Enrollment enrollment : participantDrivers) {
OOGraphene.waitBusy(enrollment.getDriver());
}
int errors = 0;
for (Enrollment enrollment : participantDrivers) {
if (enrollment.getEnrollmentPage().hasError()) {
errors++;
}
}
// author check the lists
authorGroup.openMembers();
// must a participant and 2 in waiting list
int participants = 0;
for (Enrollment enrollment : participantDrivers) {
if (authorGroup.isInMembersParticipantList(enrollment.getUser())) {
participants++;
}
}
Assert.assertEquals(1, participants);
Assert.assertEquals(participantDrivers.length - 1, errors);
}
use of org.olat.selenium.page.course.MembersPage 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.MembersPage in project openolat by klemens.
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.MembersPage 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));
}
use of org.olat.selenium.page.course.MembersPage in project openolat by klemens.
the class AssessmentTest method taskWithGroupsAndStandardSettings.
/**
* An author create a course for a group task with the default
* settings, all steps are selected, grading with only passed,
* 3 groups, 2 tasks, 1 solution...</br>
* A group has 2 participants, the first select a task, the
* second submit 2 documents, one with the embedded editor,
* one with the upload mechanism.</br>
* The author reviews the documents, use the assessment tool
* for group within the course element to set passed to the
* group.</br>
* The 2 participants check if they successfully passed the task.
*
* @param authorLoginPage
* @param ryomouBrowser
* @param kanuBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void taskWithGroupsAndStandardSettings(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver ryomouBrowser, @Drone @Participant WebDriver kanuBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO kanu = new UserRestClient(deploymentUrl).createRandomUser("Kanu");
UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
// create a course
String courseTitle = "Course-with-group-task-" + UUID.randomUUID();
navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
// create a course element of type Test with the test that we create above
String gtaNodeTitle = "Group task 1";
CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
courseEditor.createNode("gta").nodeTitle(gtaNodeTitle);
GroupTaskConfigurationPage gtaConfig = new GroupTaskConfigurationPage(browser);
gtaConfig.selectWorkflow().openBusinessGroupChooser().createBusinessGroup("Group to task - 1").createBusinessGroup("Group to task - 2").createBusinessGroup("Group to task - 3").confirmBusinessGroupsSelection().saveWorkflow().selectAssignment();
URL task1Url = JunitTestHelper.class.getResource("file_resources/task_1_a.txt");
File task1File = new File(task1Url.toURI());
String taskName1 = "Task-1";
gtaConfig.uploadTask(taskName1, task1File);
URL task2Url = JunitTestHelper.class.getResource("file_resources/task_1_b.txt");
File task2File = new File(task2Url.toURI());
String taskName2 = "Task-2-b";
gtaConfig.uploadTask(taskName2, task2File).saveTasks().selectSolution();
URL solutionUrl = JunitTestHelper.class.getResource("file_resources/solution_1.txt");
File solutionFile = new File(solutionUrl.toURI());
gtaConfig.uploadSolution("The Best Solution", solutionFile);
courseEditor.publish().quickPublish(UserAccess.guest);
MembersPage membersPage = courseEditor.clickToolbarBack().members();
GroupPage groupPage = membersPage.selectBusinessGroups().selectBusinessGroup("Group to task - 1").openAdministration().openAdminMembers();
groupPage.addMember().searchMember(kanu, true).nextUsers().nextOverview().nextPermissions().finish();
groupPage.addMember().searchMember(ryomou, true).nextUsers().nextOverview().nextPermissions().finish();
groupPage.close();
// go to the course
CoursePageFragment coursePage = membersPage.clickToolbarBack();
coursePage.clickTree().selectWithTitle(gtaNodeTitle);
// Participant log in
LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl);
ryomouLoginPage.loginAs(ryomou).resume();
// open the course
NavigationPage ryomouNavBar = new NavigationPage(ryomouBrowser);
ryomouNavBar.openMyCourses().select(courseTitle);
// go to the group task
CoursePageFragment ryomouTestCourse = new CoursePageFragment(ryomouBrowser);
ryomouTestCourse.clickTree().selectWithTitle(gtaNodeTitle);
GroupTaskPage ryomouTask = new GroupTaskPage(ryomouBrowser);
ryomouTask.assertAssignmentAvailable().selectTask(taskName2).assertSubmissionAvailable();
// Participant 2 log in
LoginPage kanuLoginPage = LoginPage.getLoginPage(kanuBrowser, deploymentUrl);
kanuLoginPage.loginAs(kanu).resume();
// open the course
NavigationPage kanuNavBar = new NavigationPage(kanuBrowser);
kanuNavBar.openMyCourses().select(courseTitle);
// go to the group task
CoursePageFragment kanuTestCourse = new CoursePageFragment(kanuBrowser);
kanuTestCourse.clickTree().selectWithTitle(gtaNodeTitle);
URL submit1Url = JunitTestHelper.class.getResource("file_resources/submit_1.txt");
File submit1File = new File(submit1Url.toURI());
String submittedFilename = "my_solution.html";
String submittedText = "This is my solution";
GroupTaskPage kanuTask = new GroupTaskPage(kanuBrowser);
kanuTask.assertTask(taskName2).assertSubmissionAvailable().submitFile(submit1File).submitText(submittedFilename, submittedText).submitDocuments();
// back to author
coursePage.clickTree().selectWithTitle(gtaNodeTitle);
GroupTaskToCoachPage groupToCoach = new GroupTaskToCoachPage(browser);
groupToCoach.selectBusinessGroupToCoach("Group to task - 1").assertSubmittedDocument("my_solution.html").assertSubmittedDocument("submit_1.txt").reviewed().openGroupAssessment().groupAssessment(Boolean.TRUE, null);
// participant check if they passed
kanuTestCourse.clickTree().selectWithTitle(gtaNodeTitle);
kanuTask.assertPassed();
ryomouTestCourse.clickTree().selectWithTitle(gtaNodeTitle);
ryomouTask.assertPassed();
}
Aggregations