use of org.olat.selenium.page.course.AssessmentToolPage in project OpenOLAT by OpenOLAT.
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.AssessmentToolPage in project OpenOLAT by OpenOLAT.
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.AssessmentToolPage in project OpenOLAT by OpenOLAT.
the class AssessmentTest method scormCourseWithAssessment.
/**
* An author upload a SCORM resource, create a course and use the
* SCORM within. It publish the course, add a participant to the
* course. The participant log in, select the course above, run
* the SCORM and finish it.<br>
* At the end, the author go to the assessment tool and chec that
* the participant has successfully passed the test.
*
* @param authorLoginPage
* @param ryomouBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void scormCourseWithAssessment(@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 scormTitle = "SCORM - " + UUID.randomUUID();
URL scormUrl = JunitTestHelper.class.getResource("file_resources/very_simple_scorm.zip");
File scormFile = new File(scormUrl.toURI());
navBar.openAuthoringEnvironment().uploadResource(scormTitle, scormFile);
// create a course
String courseTitle = "Course-With-SCORM-" + UUID.randomUUID();
navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
// create a course element of type Scorm with the scorm that we create above
String scormNodeTitle = "SCORM";
CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
courseEditor.createNode("scorm").nodeTitle(scormNodeTitle).selectTabLearnContent().chooseScorm(scormTitle);
// publish the course
courseEditor.autoPublish().accessConfiguration().setUserAccess(UserAccess.registred).clickToolbarBack();
CoursePageFragment courseRuntime = new CoursePageFragment(browser);
// 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);
// open the course and see the test start page
CoursePageFragment ryomouCourse = new CoursePageFragment(ryomouBrowser);
ryomouCourse.clickTree().selectWithTitle(scormNodeTitle);
By scormH2By = By.cssSelector("div.o_course_run h2");
WebElement scormH2 = ryomouBrowser.findElement(scormH2By);
Assert.assertEquals(scormNodeTitle, scormH2.getText().trim());
// scorm
ScormPage scorm = ScormPage.getScormPage(ryomouBrowser);
scorm.start().passVerySimpleScorm().back();
WebElement scormH2Back = ryomouBrowser.findElement(scormH2By);
Assert.assertEquals(scormNodeTitle, scormH2Back.getText().trim());
// 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.AssessmentToolPage 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.AssessmentToolPage in project openolat by klemens.
the class AssessmentTest method assessmentMode_manual.
/**
* An author upload a test, create a course with a test course
* element, publish the course, add 2 students (Ryomou and Kanu)
* to the course, configure an assessment.<br />
* A first student log in before the assessment is started by the
* author, the second log-in after the begin of the assessment.
* Both pass the test. The Author ends the assessment. The two
* students wait the end of the assessment and go back to normal
* activities. The author checks the students pass the test in the
* assessment tool.
*
* @param authorLoginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void assessmentMode_manual(@InitialPage LoginPage authorLoginPage, @Drone @Student WebDriver ryomouBrowser, @Drone @Participant WebDriver kanuBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
UserVO kanu = new UserRestClient(deploymentUrl).createRandomUser("Kanu");
// 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();
// open the course and see the test start page
CoursePageFragment courseRuntime = courseEditor.clickToolbarBack();
courseRuntime.clickTree().selectWithTitle(testNodeTitle);
OOGraphene.closeBlueMessageWindow(browser);
// 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 and Kanu as a course member
courseRuntime.members().quickAdd(ryomou);
courseRuntime.members().quickAdd(kanu);
// Kanu log in
LoginPage kanuLoginPage = LoginPage.getLoginPage(kanuBrowser, deploymentUrl);
kanuLoginPage.loginAs(kanu.getLogin(), kanu.getPassword()).resume();
// prepare and start an assessment
Calendar cal = Calendar.getInstance();
Date begin = cal.getTime();
cal.add(Calendar.MINUTE, 5);
Date end = cal.getTime();
String assessmentName = "Assessment-" + UUID.randomUUID();
courseRuntime.assessmentConfiguration().createAssessmentMode().editAssessment(assessmentName, begin, end, true).save().start(assessmentName).confirmStart();
// Ryomou opens the course
LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl);
ryomouLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword());
// start the assessment
AssessmentModePage ryomouAssessment = new AssessmentModePage(ryomouBrowser).startAssessment(false);
// go to the test
CoursePageFragment ryomouTestCourse = new CoursePageFragment(ryomouBrowser);
ryomouTestCourse.clickTree().selectWithTitle(testNodeTitle);
// pass the test
QTI12Page.getQTI12Page(ryomouBrowser).passE4(ryomou);
// Kanu makes the test
AssessmentModePage kanuAssessment = new AssessmentModePage(kanuBrowser).startAssessment(true);
// go to the test
CoursePageFragment kanuTestCourse = new CoursePageFragment(kanuBrowser);
kanuTestCourse.clickTree().selectWithTitle(testNodeTitle);
// pass the test
QTI12Page.getQTI12Page(kanuBrowser).passE4(kanu);
// Author ends the test
courseRuntime.assessmentConfiguration().stop(assessmentName).confirmStop();
By continueBy = By.className("o_sel_assessment_continue");
OOGraphene.waitElement(continueBy, 10, ryomouBrowser);
OOGraphene.waitElement(continueBy, 10, kanuBrowser);
kanuAssessment.backToOpenOLAT();
ryomouAssessment.backToOpenOLAT();
// Author check if they pass the test
navBar.openMyCourses().select(courseTitle);
// open the assessment tool
AssessmentToolPage assessmentTool = new CoursePageFragment(browser).assessmentTool();
assessmentTool.users().assertOnUsers(ryomou).assertOnUsers(kanu).selectUser(ryomou).assertPassed(ryomou);
}
Aggregations