use of org.olat.selenium.page.NavigationPage in project openolat by klemens.
the class BusinessGroupTest method enrollmentWithWaitingList.
/**
* An author create a course, with an enrollment course element. It
* configure it and create a group with max. participant set to 1 and
* enables the waiting list.<br>
*
* Three users goes to the course and try to enroll. One will become
* a participant, the 2 others land in the waiting list.
*
* @param authorLoginPage
* @param ryomouBrowser
* @param reiBrowser
* @param kanuBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void enrollmentWithWaitingList(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver ryomouBrowser, @Drone @Participant WebDriver reiBrowser, @Drone @Student WebDriver kanuBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
UserVO kanu = new UserRestClient(deploymentUrl).createRandomUser("kanu");
UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
// create a course
String courseTitle = "Enrolment-1-" + UUID.randomUUID();
navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
// create a course element of type Enrolment
String enNodeTitle = "Enrolment-1";
CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
courseEditor.createNode("en").nodeTitle(enNodeTitle);
// configure enrolment with a group that we create
String groupName = "Enrolment group - 1 " + UUID.randomUUID();
EnrollmentConfigurationPage enrolmentConfig = new EnrollmentConfigurationPage(browser);
enrolmentConfig.selectConfiguration().createBusinessGroup(groupName, "-", 1, true, false);
// publish the course
courseEditor.publish().quickPublish(UserAccess.registred);
courseEditor.clickToolbarBack();
GroupPage authorGroup = navBar.openGroups(browser).selectGroup(groupName).openAdministration().openAdminMembers().setVisibility(true, true, true).openMembers().assertParticipantList();
// Rei open the course
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());
}
// author check the lists
authorGroup.openMembers();
// must a participant and 2 in waiting list
int participants = 0;
int waitingList = 0;
for (Enrollment enrollment : participantDrivers) {
if (authorGroup.isInMembersParticipantList(enrollment.getUser()))
participants++;
if (authorGroup.isInMembersInWaitingList(enrollment.getUser()))
waitingList++;
}
Assert.assertEquals(1, participants);
Assert.assertEquals(2, waitingList);
}
use of org.olat.selenium.page.NavigationPage in project openolat by klemens.
the class BusinessGroupTest method enrollmentWithMultiEnrollment.
/**
* An author create a course, with an enrollment course element. It
* configure it and create 3 groups and set the maximum enrollment counter to 2<br>
*
* One user goes to the course and enrolls in 2 of the groups. It shouldent be possible
* enroll in the third<br>
*
* @param authorLoginPage
* @param ryomouBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void enrollmentWithMultiEnrollment(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver ryomouBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
// create a course
String courseTitle = "Enrolment-3-" + UUID.randomUUID();
navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
// create a course element of type Enrolment
String enNodeTitle = "Enrolment-3";
CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
courseEditor.createNode("en").nodeTitle(enNodeTitle);
// configure enrolment with a group that we create
List<String> groups = new ArrayList<String>();
groups.add("Enrolment group - 3 " + UUID.randomUUID());
groups.add("Enrolment group - 3 " + UUID.randomUUID());
groups.add("Enrolment group - 3 " + UUID.randomUUID());
EnrollmentConfigurationPage enrolmentConfig = new EnrollmentConfigurationPage(browser);
enrolmentConfig.selectConfiguration().createBusinessGroup(groups.get(0), "-", 4, false, false).createBusinessGroup(groups.get(1), "-", 4, false, false).createBusinessGroup(groups.get(2), "-", 4, false, false).selectMultipleEnrollments(2);
// publish the course
courseEditor.publish().quickPublish(UserAccess.registred);
courseEditor.clickToolbarBack();
for (String groupName : groups) {
navBar.openGroups(browser).selectGroup(groupName).openAdministration().openAdminMembers().setVisibility(true, true, false).openMembers();
}
// Ryomou open the course
LoginPage.getLoginPage(ryomouBrowser, deploymentUrl).loginAs(ryomou).resume();
NavigationPage participantNavBar = new NavigationPage(ryomouBrowser);
participantNavBar.openMyCourses().openSearch().extendedSearch(courseTitle).select(courseTitle).start();
OOGraphene.waitBusy(ryomouBrowser);
// go to the enrollment
CoursePageFragment participantCourse = new CoursePageFragment(ryomouBrowser);
participantCourse.clickTree().selectWithTitle(enNodeTitle);
EnrollmentPage enrollmentPage = new EnrollmentPage(ryomouBrowser);
enrollmentPage.assertOnEnrolmentPage().multiEnroll(2);
// assert that that no more enrollment is allowed
enrollmentPage.assertNoEnrollmentAllowed();
}
use of org.olat.selenium.page.NavigationPage in project openolat by klemens.
the class BusinessGroupTest method enrollmentWithUnlimitedBusinessGroups.
/**
* Variant from the above test where the business group is not
* limited in size. This was a bug while development of the 10.3
* release.
*
* @param authorLoginPage
* @param ryomouBrowser
* @param reiBrowser
* @param kanuBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void enrollmentWithUnlimitedBusinessGroups(@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-3-" + 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 - 3";
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
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(3, participants);
Assert.assertEquals(0, errors);
}
use of org.olat.selenium.page.NavigationPage in project openolat by klemens.
the class BusinessGroupTest method groupChat.
/**
* An author create a group, set the visibility to true for owners
* and participants, enable the tools and add 2 users to it. The 2
* users joins the chat. All three send some messages and read them.
*
* @param loginPage
* @param kanuBrowser
* @param ryomouBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void groupChat(@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()).resume();
// go to groups
String groupName = "Group-Chat-1-" + UUID.randomUUID();
GroupPage group = navBar.openGroups(browser).createGroup(groupName, "A very little group to chat");
group.openAdministration().openAdminTools().enableTools().openAdminMembers().setVisibility(true, true, false);
// add Kanu to the group
group.openAdminMembers().addMember().searchMember(kanu, true).nextUsers().nextOverview().nextPermissions().finish();
// add Ryomou
group.addMember().searchMember(ryomou, true).nextUsers().nextOverview().nextPermissions().finish();
// Kanu open the group
LoginPage kanuLoginPage = LoginPage.getLoginPage(kanuBrowser, deploymentUrl);
kanuLoginPage.loginAs(kanu.getLogin(), kanu.getPassword()).resume();
NavigationPage kanuNavBar = new NavigationPage(kanuBrowser);
GroupPage kanuGroup = kanuNavBar.openGroups(kanuBrowser).selectGroup(groupName);
// Ryomou open the group
LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl);
ryomouLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
NavigationPage ryomouNavBar = new NavigationPage(ryomouBrowser);
IMPage ryomouIM = ryomouNavBar.openGroups(ryomouBrowser).selectGroup(groupName).openChat().openGroupChat();
// Author send a message to Kanu
String msg1 = "Hello Kanu " + UUID.randomUUID();
IMPage authorIM = group.openChat().openGroupChat().sendMessage(msg1).assertOnMessage(msg1);
String msg2 = "Hello dear author " + UUID.randomUUID();
// Kanu opens her chat window
IMPage kanuIM = kanuGroup.openChat().openGroupChat().assertOnMessage(msg1).sendMessage(msg2);
String msg3 = "Hello Kanu and author " + UUID.randomUUID();
// Ryomou reads her messages
ryomouIM.sendMessage(msg3).assertOnMessage(msg1).assertOnMessage(msg2);
// Kanu reads her message
kanuIM.assertOnMessage(msg3);
// Author reads too
authorIM.assertOnMessage(msg2).assertOnMessage(msg3);
}
use of org.olat.selenium.page.NavigationPage in project openolat by klemens.
the class CourseElementTest method createCourseWithLTI.
/**
* An author setup a course with a LTI course element with score enabled.
* A participant take the course and see the LTI content. The back channel
* need the url of the OpenOLAT instance which is currently difficult
* for a selenium test. The grading is not tested until a LTI server
* can be installed on localhost.
*
* @param authorLoginPage
* @param participantBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void createCourseWithLTI(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO participant = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
// create a course
String courseTitle = "Course-LTI-" + UUID.randomUUID();
navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
// create a course element of type Test with the test that we create above
String ltiTitle = "LTI";
CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit().createNode("lti").nodeTitle(ltiTitle);
// configure assessment
LTIConfigurationPage ltiConfig = new LTIConfigurationPage(browser);
ltiConfig.selectConfiguration().setLtiPage("http://lti.frentix.com/tool.php", "123456", "secret").enableScore(10.0d, 5.0d).save();
// set the score / passed calculation in root node and publish
courseEditor.selectRoot().selectTabScore().enableRootScoreByNodes().autoPublish().accessConfiguration().setUserAccess(UserAccess.registred);
// go to members management
CoursePageFragment courseRuntime = courseEditor.clickToolbarBack();
MembersPage members = courseRuntime.members();
members.addMember().searchMember(participant, true).nextUsers().nextOverview().nextPermissions().finish();
// Participant login
LoginPage participantLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
participantLoginPage.loginAs(participant.getLogin(), participant.getPassword()).resume();
NavigationPage participantNavBar = new NavigationPage(participantBrowser);
participantNavBar.openMyCourses().openSearch().extendedSearch(courseTitle).select(courseTitle);
CoursePageFragment participantCourse = new CoursePageFragment(participantBrowser);
participantCourse.clickTree().selectWithTitle(ltiTitle);
LTIPage lti = new LTIPage(participantBrowser);
lti.start().outcomeToolProvider();
// .sendGrade(0.8d);
}
Aggregations