use of org.olat.selenium.page.NavigationPage 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.NavigationPage 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.NavigationPage in project OpenOLAT by OpenOLAT.
the class AssessmentTest method bulkAssessment.
/**
* Create an assessment course element, add two users to the course
* and assesses them with the bulk assessment tool. The 2 users
* log in and check their results.
*
* @param loginPage
* @param kanuBrowser
* @param reiBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void bulkAssessment(@InitialPage LoginPage loginPage, @Drone @User WebDriver ryomouBrowser, @Drone @Participant WebDriver kanuBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
UserVO kanu = new UserRestClient(deploymentUrl).createRandomUser("Kanu");
loginPage.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 = "Assessment CE";
CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit().createNode("ms").nodeTitle(assessmentNodeTitle);
// configure assessment
AssessmentCEConfigurationPage assessmentConfig = new AssessmentCEConfigurationPage(browser);
assessmentConfig.selectConfiguration().setScoreAuto(0.1f, 10.0f, 5.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.importMembers().setMembers(ryomou, kanu).nextUsers().nextOverview().nextPermissions().finish();
BulkAssessmentData[] data = new BulkAssessmentData[] { new BulkAssessmentData(ryomou, 8.0f, null, "Well done"), new BulkAssessmentData(kanu, 4.0f, null, "Need more work") };
members.clickToolbarBack().assessmentTool().bulk().data(data).nextData().nextColumns().nextValidation().finish();
// Ryomou login
LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl);
ryomouLoginPage.loginAs(ryomou).resume();
NavigationPage ryomouNavBar = new NavigationPage(ryomouBrowser);
ryomouNavBar.openMyCourses().select(courseTitle);
// go to the group task
CoursePageFragment ryomouCourse = new CoursePageFragment(ryomouBrowser);
ryomouCourse.clickTree().selectWithTitle(assessmentNodeTitle);
// Second login
LoginPage kanuLoginPage = LoginPage.getLoginPage(kanuBrowser, deploymentUrl);
kanuLoginPage.loginAs(kanu).resume();
NavigationPage kanuNavBar = new NavigationPage(kanuBrowser);
kanuNavBar.openMyCourses().select(courseTitle);
// go to the group task
CoursePageFragment kanuCourse = new CoursePageFragment(kanuBrowser);
kanuCourse.clickTree().selectWithTitle(assessmentNodeTitle);
// Ryomou -> passed
WebElement passedEl = ryomouBrowser.findElement(By.cssSelector("tr.o_state.o_passed"));
Assert.assertTrue(passedEl.isDisplayed());
// Kanu -> failed
WebElement failedEl = kanuBrowser.findElement(By.cssSelector("tr.o_state.o_failed"));
Assert.assertTrue(failedEl.isDisplayed());
}
use of org.olat.selenium.page.NavigationPage in project OpenOLAT by OpenOLAT.
the class AssessmentTest method certificatesGeneratedByTest.
/**
* An author create a course, set up the root node to make efficiency statement,
* add a test, publish it and add a participant. It set the certificate.<br>
*
* The participant logs in, make the test and look at its wonderful certificate
* and the details of its performance.
*
* @param authorLoginPage
* @param reiBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void certificatesGeneratedByTest(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver reiBrowser) throws IOException, URISyntaxException {
// create an author and a participant
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
// deploy the test
URL testUrl = ArquillianDeployments.class.getResource("file_resources/e4_test.zip");
String testTitle = "E4Test-" + UUID.randomUUID();
new RepositoryRestClient(deploymentUrl, author).deployResource(new File(testUrl.toURI()), "-", testTitle);
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
// create a course
String courseTitle = "Certif-" + 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";
CoursePageFragment courseRuntime = CoursePageFragment.getCourse(browser);
courseRuntime.edit().createNode("iqtest").nodeTitle(testNodeTitle).selectTabLearnContent().chooseTest(testTitle).selectRoot().selectTabScore().enableRootScoreByNodes().autoPublish().accessConfiguration().setUserAccess(UserAccess.registred).clickToolbarBack();
// add a participant to the course
MembersPage members = courseRuntime.members();
members.addMember().searchMember(rei, true).nextUsers().nextOverview().nextPermissions().finish();
// return to course
courseRuntime = members.clickToolbarBack().efficiencyStatementConfiguration().enableCertificates(true).enableRecertification().save().clickToolbarBack();
// Participant log in
LoginPage reiLoginPage = LoginPage.getLoginPage(reiBrowser, deploymentUrl);
reiLoginPage.loginAs(rei.getLogin(), rei.getPassword()).resume();
// open the course
NavigationPage reiNavBar = new NavigationPage(reiBrowser);
reiNavBar.openMyCourses().select(courseTitle);
// go to the test
CoursePageFragment reiTestCourse = new CoursePageFragment(reiBrowser);
reiTestCourse.clickTree().selectWithTitle(testNodeTitle);
// pass the test
QTI12Page.getQTI12Page(reiBrowser).passE4(rei);
// open the efficiency statements
UserToolsPage reiUserTools = new UserToolsPage(reiBrowser);
reiUserTools.openUserToolsMenu().openMyEfficiencyStatement().assertOnEfficiencyStatmentPage().assertOnCertificateAndStatements(courseTitle).selectStatement(courseTitle).selectStatementSegment().assertOnCourseDetails(testNodeTitle, true);
}
use of org.olat.selenium.page.NavigationPage in project OpenOLAT by OpenOLAT.
the class CourseElementTest method createCourseWithDialog.
/**
* An author create a course with a dialog course element. It
* add a participant to the course, a file to the dialog in
* the course element configuration and after publishing the course
* in the view of the dialog. It opens the forum of one of the files,
* create a new thread.<br>
* The participant log in, open the course and the dialog element. It
* reads the thread and make a reply. The author answers to the reply.
*
* @param loginPage
*/
@Test
@RunAsClient
public void createCourseWithDialog(@InitialPage LoginPage authorLoginPage, @Drone @Participant WebDriver participantBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
UserVO participant = new UserRestClient(deploymentUrl).createRandomUser("Rei");
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
// go to authoring
AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
String title = "Course dialog " + UUID.randomUUID();
// create course
authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab().clickToolbarBack();
// add a participant
MembersPage members = new CoursePageFragment(browser).members();
members.addMember().searchMember(participant, true).nextUsers().nextOverview().selectRepositoryEntryRole(false, false, true).nextPermissions().finish();
members.clickToolbarBack();
String dialogNodeTitle = "Dialog";
// open course editor
CoursePageFragment course = CoursePageFragment.getCourse(browser);
CourseEditorPageFragment editor = course.assertOnCoursePage().assertOnTitle(title).openToolsMenu().edit().createNode("dialog").nodeTitle(dialogNodeTitle);
// upload a file in the configuration
URL imageUrl = JunitTestHelper.class.getResource("file_resources/IMG_1484.jpg");
File imageFile = new File(imageUrl.toURI());
DialogConfigurationPage dialogConfig = new DialogConfigurationPage(browser);
dialogConfig.selectConfiguration().uploadFile(imageFile);
// publish and go to the course element
editor.publish().quickPublish(UserAccess.membersOnly);
editor.clickToolbarBack();
course.clickTree().selectWithTitle(dialogNodeTitle);
// upload a second file
URL imageRunUrl = JunitTestHelper.class.getResource("file_resources/IMG_1483.png");
File imageRunFile = new File(imageRunUrl.toURI());
DialogPage dialog = new DialogPage(browser);
dialog.assertOnFile(imageFile.getName()).uploadFile(imageRunFile).assertOnFile(imageRunFile.getName()).openForum(imageRunFile.getName()).createThread("JPEG vs PNG", "Which is the best format", null);
// The participant come in
LoginPage participantLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
participantLoginPage.loginAs(participant.getLogin(), participant.getPassword()).resume();
// The participant find the course
NavigationPage participantNavBar = new NavigationPage(participantBrowser);
participantNavBar.assertOnNavigationPage().openMyCourses().select(title);
// And opens the dialog course element
CoursePageFragment participantCourse = CoursePageFragment.getCourse(participantBrowser);
participantCourse.clickTree().selectWithTitle(dialogNodeTitle);
DialogPage participantDialog = new DialogPage(participantBrowser);
participantDialog.assertOnFile(imageRunFile.getName()).openForum(imageRunFile.getName()).openThread("JPEG vs PNG").replyToMessage("JPEG vs PNG", "PNG for sure", "Not a loosy format");
// The author reload the messages
dialog.back().openForum(imageRunFile.getName()).openThread("JPEG vs PNG").assertMessageBody("Not a loosy format").replyToMessage("PNG for sure", "JPEG smaller", "JPEG is smaller");
// The participant check the reply
participantDialog.back().openForum(imageRunFile.getName()).openThread("JPEG vs PNG").assertMessageBody("JPEG is smaller");
}
Aggregations