use of org.olat.selenium.page.course.CourseEditorPageFragment in project openolat by klemens.
the class PortfolioV2Test method collectEfficiencyStatement.
/**
* Create a course with an assessment course element, setup
* efficiency statement, add a user and assess her.
* The user log in, search its efficiency statement, pick it
* as a media for is portfolio and goes in the media center
* to search it and select it.
*
* @param authorLoginPage
* @param ryomouBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void collectEfficiencyStatement(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver ryomouBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
// create a course
String courseTitle = "Course-Assessment-" + UUID.randomUUID();
navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
// create a course element of type Test with the test that we create above
String assessmentNodeTitle = "Efficiency PF";
CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit().createNode("ms").nodeTitle(assessmentNodeTitle);
// configure assessment
AssessmentCEConfigurationPage assessmentConfig = new AssessmentCEConfigurationPage(browser);
assessmentConfig.selectConfiguration().setScoreAuto(1.0f, 6.0f, 4.0f);
// 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(ryomou, true).nextUsers().nextOverview().nextPermissions().finish();
// efficiency statement is default on
// go to the assessment to to set the points
members.clickToolbarBack().assessmentTool().users().assertOnUsers(ryomou).selectUser(ryomou).selectCourseNode(assessmentNodeTitle).setAssessmentScore(4.5f).assertUserPassedCourseNode(assessmentNodeTitle);
// Ryomou login
LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl);
ryomouLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
// see its beautiful efficiency statement
String mediaTitle = "My efficiency";
String mediaDesc = "My efficiency statement " + UUID.randomUUID();
UserToolsPage ryomouUserTools = new UserToolsPage(ryomouBrowser);
ryomouUserTools.openUserToolsMenu().openMyEfficiencyStatement().assertOnEfficiencyStatmentPage().assertOnStatement(courseTitle, true).addAsMediaInList(courseTitle).fillEfficiencyStatementMedia(mediaTitle, mediaDesc);
MediaCenterPage mediaCenter = ryomouUserTools.openUserToolsMenu().openPortfolioV2().openMediaCenter();
mediaCenter.assertOnMedia(mediaTitle).selectMedia(mediaTitle).assertOnMediaDetails(mediaTitle);
}
use of org.olat.selenium.page.course.CourseEditorPageFragment in project openolat by klemens.
the class AssessmentTest method qti12Test.
/**
* An author upload a test, create a course with a test course
* element, publish the course and do and pass the test.
*
* @param authorLoginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void qti12Test(@InitialPage LoginPage authorLoginPage) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
// upload a test
String qtiTestTitle = "QTI-Test-1.2-" + UUID.randomUUID();
URL qtiTestUrl = JunitTestHelper.class.getResource("file_resources/e4_test.zip");
File qtiTestFile = new File(qtiTestUrl.toURI());
navBar.openAuthoringEnvironment().uploadResource(qtiTestTitle, qtiTestFile);
// create a course
String courseTitle = "Course-With-QTI-Test-1.2-" + UUID.randomUUID();
navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
// create a course element of type Test with the test that we create above
String testNodeTitle = "Test-QTI-1.2";
CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
courseEditor.createNode("iqtest").nodeTitle(testNodeTitle).selectTabLearnContent().chooseTest(qtiTestTitle);
// publish the course
courseEditor.publish().quickPublish();
// open the course and see the test start page
courseEditor.clickToolbarBack().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());
// start the test
QTI12Page testPage = QTI12Page.getQTI12Page(browser);
testPage.start().selectItem("Single choice").answerSingleChoice("Correct answer").saveAnswer().selectItem("Multiple choice").answerMultipleChoice("Correct answer", "The answer is correct").saveAnswer().selectItem("Kprim").answerKPrim(true, false, true, false).saveAnswer().selectItem("Fill-in").answerFillin("not").saveAnswer();
testPage.endTest();
// check results page
By resultsBy = By.id("o_qti_results");
OOGraphene.waitElement(resultsBy, browser);
WebElement resultsEl = browser.findElement(resultsBy);
Assert.assertTrue(resultsEl.getText().contains(author.getFirstName()));
// close the test
testPage.closeTest();
// all answers are correct -> passed
WebElement passedEl = browser.findElement(By.cssSelector("tr.o_state.o_passed"));
Assert.assertTrue(passedEl.isDisplayed());
}
use of org.olat.selenium.page.course.CourseEditorPageFragment in project openolat by klemens.
the class AssessmentTest method taskWithIndividuScoreAndRevision.
/**
* An author create a course for a task with the some custom
* settings, all steps are selected, grading with score and
* passed automatically calculated, 2 tasks, 1 solution...</br>
* It had 2 participants. One of them goes through the workflow,
* selects a task, submits 2 documents, one with the embedded editor,
* one with the upload mechanism.</br>
* The author reviews the documents, uploads a correction and
* want a revision.</br>
* The assessed participant upload a revised document.</br>
* The author sees it and close the revisions process, use
* the assessment tool to set the score.</br>
* The participant checks if she successfully passed the task.
*
* @param authorLoginPage
* @param ryomouBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void taskWithIndividuScoreAndRevision(@InitialPage LoginPage authorLoginPage, @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");
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
// create a course
String courseTitle = "Course-with-individual-task-" + UUID.randomUUID();
navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
// create a course element of type Test with the test that we create above
String gtaNodeTitle = "Individual task 1";
CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
courseEditor.createNode("ita").nodeTitle(gtaNodeTitle);
GroupTaskConfigurationPage gtaConfig = new GroupTaskConfigurationPage(browser);
gtaConfig.selectAssignment();
URL task1Url = JunitTestHelper.class.getResource("file_resources/task_1_a.txt");
File task1File = new File(task1Url.toURI());
gtaConfig.uploadTask("Individual Task 1 alpha", task1File);
URL task2Url = JunitTestHelper.class.getResource("file_resources/task_1_b.txt");
File task2File = new File(task2Url.toURI());
gtaConfig.uploadTask("Individual Task 2 beta", 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);
gtaConfig.selectAssessment().setAssessmentOptions(0.0f, 6.0f, 4.0f).saveAssessmentOptions();
courseEditor.publish().quickPublish(UserAccess.membersOnly);
MembersPage membersPage = courseEditor.clickToolbarBack().members();
membersPage.importMembers().setMembers(kanu, ryomou).nextUsers().nextOverview().nextPermissions().finish();
// 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(1).assertTask("Individual Task 2 beta").assertSubmissionAvailable();
URL submit1Url = JunitTestHelper.class.getResource("file_resources/submit_2.txt");
File submit1File = new File(submit1Url.toURI());
String submittedFilename = "personal_solution.html";
String submittedText = "This is my solution";
ryomouTask.submitFile(submit1File).submitText(submittedFilename, submittedText).submitDocuments();
// back to author
coursePage.clickTree().selectWithTitle(gtaNodeTitle);
GroupTaskToCoachPage participantToCoach = new GroupTaskToCoachPage(browser);
URL correctionUrl = JunitTestHelper.class.getResource("file_resources/correction_1.txt");
File correctionFile = new File(correctionUrl.toURI());
participantToCoach.selectIdentityToCoach(ryomou).assertSubmittedDocument("personal_solution.html").assertSubmittedDocument("submit_2.txt").uploadCorrection(correctionFile).needRevision();
// participant add a revised document
URL revisionUrl = JunitTestHelper.class.getResource("file_resources/submit_3.txt");
File revisionFile = new File(revisionUrl.toURI());
ryomouTestCourse.clickTree().selectWithTitle(gtaNodeTitle);
ryomouTask.submitRevisedFile(revisionFile).submitRevision();
// back to author
coursePage.clickTree().selectWithTitle(gtaNodeTitle);
participantToCoach.selectIdentityToCoach(ryomou).assertRevision("submit_3.txt").closeRevisions().openIndividualAssessment().individualAssessment(null, 5.5f).assertPassed();
// participant checks she passed the task
ryomouTestCourse.clickTree().selectWithTitle(gtaNodeTitle);
ryomouTask.assertPassed();
}
use of org.olat.selenium.page.course.CourseEditorPageFragment 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.CourseEditorPageFragment in project openolat by klemens.
the class CourseElementTest method createCourseWithPodcast_externalFeed.
/**
* Create a course with a course element of type podcast. Create
* a podcast, publish the course, go the the course and configure
* the podcast to read an external feed.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void createCourseWithPodcast_externalFeed(@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-Podcast-" + UUID.randomUUID();
navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
String podcastNodeTitle = "Podcats-1";
String podcastTitle = "Podcast - " + UUID.randomUUID();
// create a course element of type podcast
CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
courseEditor.createNode("podcast").nodeTitle(podcastNodeTitle).selectTabLearnContent().createFeed(podcastTitle);
// publish the course
courseEditor.publish().quickPublish();
// open the course and see the podcast
CoursePageFragment course = courseEditor.clickToolbarBack();
course.clickTree().selectWithTitle(podcastNodeTitle);
// check that the title of the podcast is correct
WebElement podcastH2 = browser.findElement(By.cssSelector("div.o_podcast_info>h2>i.o_FileResource-PODCAST_icon"));
Assert.assertNotNull(podcastH2);
// Assert.assertEquals(podcastTitle, podcastH2.getText().trim());
FeedPage feed = FeedPage.getFeedPage(browser);
feed.newExternalPodcast(podcastTitle, "http://podcasts.srf.ch/rock_special_mpx.xml");
// check only that the "episodes" title is visible
/*
By episodeTitleby = By.cssSelector("div.o_podcast_episodes>h4.o_title");
OOGraphene.waitElement(episodeTitleby, 20, browser);
WebElement episodeH4 = browser.findElement(episodeTitleby);
Assert.assertNotNull(episodeH4);
*/
}
Aggregations