use of org.olat.selenium.page.course.CourseEditorPageFragment in project OpenOLAT by OpenOLAT.
the class ImsQTI21Test method qti21Course_lmsHidden_results.
/**
* Upload a test in QTI 2.1 format, create a course, bind
* the test in a course element, customize the options
* with full window mode, show scores and assessment results.
* Then run it and check if the assessment results appears after
* closing the test and on the start page of the test course element.
*
* @param authorLoginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void qti21Course_lmsHidden_results(@InitialPage LoginPage authorLoginPage) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
// upload a test
String qtiTestTitle = "Simple QTI 2.1 " + UUID.randomUUID();
URL qtiTestUrl = JunitTestHelper.class.getResource("file_resources/qti21/simple_QTI_21_test.zip");
File qtiTestFile = new File(qtiTestUrl.toURI());
navBar.openAuthoringEnvironment().uploadResource(qtiTestTitle, qtiTestFile);
// create a course
String courseTitle = "Course QTI 2.1 " + UUID.randomUUID();
navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
String testNodeTitle = "QTI21Test-1";
// create a course element of type CP with the CP that we create above
CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
courseEditor.createNode("iqtest").nodeTitle(testNodeTitle).selectTabLearnContent().chooseTest(qtiTestTitle);
QTI21ConfigurationCEPage configPage = new QTI21ConfigurationCEPage(browser);
configPage.selectLayoutConfiguration().overrideConfiguration().fullWindow().saveLayoutConfiguration();
configPage.selectConfiguration().showScoreOnHomepage(true).showResultsOnHomepage(Boolean.TRUE, QTI21AssessmentResultsOptions.allOptions()).saveConfiguration();
// publish the course
courseEditor.publish().quickPublish();
// open the course and see the CP
CoursePageFragment course = courseEditor.clickToolbarBack();
course.clickTree().selectWithTitle(testNodeTitle);
// check that the title of the start page of test is correct
WebElement testH2 = browser.findElement(By.cssSelector("div.o_course_run h2"));
Assert.assertEquals(testNodeTitle, testH2.getText().trim());
QTI21Page qtiPage = QTI21Page.getQTI12Page(browser);
qtiPage.start().answerSingleChoiceWithParagraph("Right").saveAnswer().endTest().assertOnAssessmentResults().closeAssessmentResults().assertOnCourseAttempts(1).assertOnCourseAssessmentTestScore(1).assertOnAssessmentResults();
}
use of org.olat.selenium.page.course.CourseEditorPageFragment in project OpenOLAT by OpenOLAT.
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.course.CourseEditorPageFragment in project OpenOLAT by OpenOLAT.
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 OpenOLAT.
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.CourseEditorPageFragment in project OpenOLAT by OpenOLAT.
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();
}
Aggregations