use of org.olat.selenium.page.course.CoursePageFragment in project openolat by klemens.
the class AssessmentTest method qti12CourseWithAssessment.
/**
* An author upload a test, create a course with a test course
* element, publish the course, assign the course to a student.
* The student come to pass the test, logout after passing it.
* The author check if the test of the student is passed in the
* assessment tool.
*
* @param authorLoginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void qti12CourseWithAssessment(@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");
// 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 CP with the CP 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(UserAccess.membersOnly);
// open the course and see the test start page
CoursePageFragment courseRuntime = courseEditor.clickToolbarBack();
courseRuntime.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());
// add Ryomou as a course member
courseRuntime.members().addMember().searchMember(ryomou, true).nextUsers().nextOverview().nextPermissions().finish();
// Ryomou open the course
LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl);
ryomouLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
// open the course
NavigationPage ryomouNavBar = new NavigationPage(ryomouBrowser);
ryomouNavBar.openMyCourses().select(courseTitle);
// go to the test
CoursePageFragment ryomouTestCourse = new CoursePageFragment(ryomouBrowser);
ryomouTestCourse.clickTree().selectWithTitle(testNodeTitle);
// start the test
QTI12Page testPage = QTI12Page.getQTI12Page(ryomouBrowser);
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, ryomouBrowser);
WebElement resultsEl = ryomouBrowser.findElement(resultsBy);
Assert.assertTrue(resultsEl.getText().contains(ryomou.getFirstName()));
// close the test
testPage.closeTest();
// all answers are correct -> passed
WebElement passedEl = ryomouBrowser.findElement(By.cssSelector("tr.o_state.o_passed"));
Assert.assertTrue(passedEl.isDisplayed());
// log out
UserToolsPage roymouUserTools = new UserToolsPage(ryomouBrowser);
roymouUserTools.logout();
// author take the lead and check the assessment tool
navBar.openMyCourses().select(courseTitle);
// open the assessment tool
AssessmentToolPage assessmentTool = new CoursePageFragment(browser).assessmentTool();
assessmentTool.users().assertOnUsers(ryomou).selectUser(ryomou).assertPassed(ryomou);
}
use of org.olat.selenium.page.course.CoursePageFragment in project openolat by klemens.
the class ImsQTI21Test method qti21Course_suspend.
/**
* 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, allow suspending the test,
* show scores and assessment results.<br>
* Then run it and at the middle of the test, suspend it, log out.
* Return with resume to the course and resume the test, finish 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_suspend(@InitialPage LoginPage authorLoginPage) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
// upload a test
String qtiTestTitle = "No skipping QTI 2.1 " + UUID.randomUUID();
URL qtiTestUrl = JunitTestHelper.class.getResource("file_resources/qti21/test_4_no_skipping.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().selectLayoutConfiguration().overrideConfiguration().enableSuspend().saveLayoutConfiguration();
// 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("Correct").saveAnswer().answerMultipleChoice("Correct").saveAnswer().suspendTest();
// log out
new UserToolsPage(browser).logout();
// return
authorLoginPage.loginAs(author.getLogin(), author.getPassword()).resume();
// resume the course, resume the test
qtiPage = QTI21Page.getQTI12Page(browser);
qtiPage.start().assertOnAssessmentItem("Kprim").answerCorrectKPrim("True", "Right").answerIncorrectKPrim("False", "Wrong").saveAnswer().answerGapText("43", "_RESPONSE_1").saveAnswer().endTest().assertOnAssessmentResults().assertOnAssessmentTestMaxScore(4).assertOnAssessmentTestScore(4).assertOnAssessmentTestPassed().closeAssessmentResults();
// check the result on the start page
qtiPage.assertOnCourseAssessmentTestScore(4).assertOnCourseAttempts(1);
}
use of org.olat.selenium.page.course.CoursePageFragment in project openolat by klemens.
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.CoursePageFragment in project openolat by klemens.
the class LecturesTest method lecturesRollCall.
/**
* An author create a course to use the absence management
* without authorized absence.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void lecturesRollCall(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
// configure the lectures module
loginPage.loginAs("administrator", "openolat").resume();
new NavigationPage(browser).openAdministration().openLecturesSettings().configure(true, true, false, false, false).save();
// start
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO participant1 = new UserRestClient(deploymentUrl).createRandomUser("Kanu");
UserVO participant2 = new UserRestClient(deploymentUrl).createRandomUser("Rymou");
LoginPage authorLoginPage = LoginPage.getLoginPage(browser, deploymentUrl);
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
// go to authoring
AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
String title = "Lecture " + UUID.randomUUID();
// create course
authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab().clickToolbarBack();
CoursePageFragment course = new CoursePageFragment(browser);
// add a coach
course.members().quickAdd(author, true, true);
// add the participants
course.members().quickImport(participant1, participant2);
// enable the lectures
LectureRepositoryAdminPage lecturesAdmin = course.lecturesAdministration();
lecturesAdmin.settings().enableLectures().overrideDefaultSettings().saveSettings();
// add a lecture
LectureRepositoryAdminListPage lectureList = lecturesAdmin.lectureList();
String lectureTitle = "2.Lecture";
lectureList.newLectureBlock().setTitle(lectureTitle).setTeacher(author).setDateOneHourBefore().save();
// go to the lectures list as "teacher"
LecturesRepositoryPage teachersLectures = lecturesAdmin.clickToolbarRootCrumb().lectures();
teachersLectures.openRollCall(lectureTitle).setAbsence(participant1, "1").setAbsence(participant1, "2").setAbsence(participant1, "3").closeRollCall().confirmCloseRollCall().assertOnClosedTable();
// go to the lecture administration in the course
lecturesAdmin = teachersLectures.clickToolbarRootCrumb().lecturesAdministration();
// edit the first admission to see some result
LectureRepositoryParticipantsPage participantsAdmin = lecturesAdmin.participantList().editParticipant(participant1).firstAdmissionBack().saveParticipant().editParticipant(participant2).firstAdmissionBack().saveParticipant();
// check
participantsAdmin.assertOnParticipantLectureBlockAbsent(participant1, 3).assertOnParticipantLectureBlockAbsent(participant2, 0);
}
use of org.olat.selenium.page.course.CoursePageFragment in project openolat by klemens.
the class LecturesTest method lecturesRollCall_defaultAuthorizedAbsence.
/**
* An author create a course, enable the absence management,
* create a lecture block, add a coach and two participants.<br>
* The coach login in, see the interceptor to start the roll call.
* It starts the roll call, set an absence and close.<br>
* The participant with an absence log in, use the lectures user's
* tool to see that it has an absence.<br>
* The absence management has the following settings: holding partial
* lecture is disable, cancel status of lectures is disabled, authorized
* absence are enabled with them as default authorized, teachers can
* authorized absences.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void lecturesRollCall_defaultAuthorizedAbsence(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
// configure the lectures module
loginPage.loginAs("administrator", "openolat").resume();
new NavigationPage(browser).openAdministration().openLecturesSettings().configure(false, false, true, true, true).save();
// start the test with authorized absence on
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO participant1 = new UserRestClient(deploymentUrl).createRandomUser("Kanu");
UserVO participant2 = new UserRestClient(deploymentUrl).createRandomUser("Rymou");
LoginPage.getLoginPage(browser, deploymentUrl).loginAs(author.getLogin(), author.getPassword());
// go to authoring
AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
String title = "Lecture " + UUID.randomUUID();
// create course
authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab().clickToolbarBack();
// set access
CoursePageFragment course = new CoursePageFragment(browser);
course.accessConfiguration().setUserAccess(UserAccess.registred).clickToolbarBack();
// add a coach
course.members().addMember().searchMember(author, true).nextUsers().nextOverview().selectRepositoryEntryRole(false, true, false).nextPermissions().finish();
// add the participants
course.members().importMembers().setMembers(participant1, participant2).nextUsers().nextOverview().nextPermissions().finish();
// enable the lectures
LectureRepositoryAdminPage lecturesAdmin = course.lecturesAdministration();
lecturesAdmin.settings().enableLectures().overrideDefaultSettings().saveSettings();
LectureRepositoryAdminListPage lectureList = lecturesAdmin.lectureList();
Calendar cal = Calendar.getInstance();
int today = cal.get(Calendar.DATE);
int hour = cal.get(Calendar.HOUR_OF_DAY);
String lectureTitle = "1. Lecture";
lectureList.newLectureBlock().setTitle(lectureTitle).setTeacher(author).setDate(today, hour, 0, hour, 59).save();
// coach at work
LoginPage coachLoginPage = LoginPage.getLoginPage(browser, deploymentUrl);
coachLoginPage.loginAs(author);
new RollCallInterceptorPage(browser).start().setAbsence(participant1, "1").closeRollCall().confirmCloseRollCall().assertOnClosedTable();
// participant check it roll call
LoginPage participantLoginPage = LoginPage.getLoginPage(browser, deploymentUrl);
participantLoginPage.loginAs(participant1).resume();
UserToolsPage participantUserTools = new UserToolsPage(browser);
participantUserTools.openUserToolsMenu().openLectures().assertOnParticipantLecturesList().selectCourseAsParticipant(title).assertOnParticipantLectureBlocks().assertOnParticipantLectureBlockAuthorised(author, lectureTitle, title);
}
Aggregations