use of org.olat.user.restapi.UserVO 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.user.restapi.UserVO in project OpenOLAT by OpenOLAT.
the class CourseElementTest method courseWithSCORM_fullAuto.
/**
* This test an edge case where a course start automatically its first
* course element, which is a structure node which start itself its first
* element, which is a SCORM which launch itself automatically.
*
* @param loginPage
*/
@Test
@RunAsClient
public void courseWithSCORM_fullAuto(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
loginPage.loginAs(author.getLogin(), author.getPassword());
URL zipUrl = JunitTestHelper.class.getResource("file_resources/scorm/SCORM_course_full_auto.zip");
File zipFile = new File(zipUrl.toURI());
// go the authoring environment to import our course
String zipTitle = "SCORM - " + UUID.randomUUID();
navBar.openAuthoringEnvironment().uploadResource(zipTitle, zipFile);
// publish the course
new RepositoryEditDescriptionPage(browser).clickToolbarBack();
CoursePageFragment.getCourse(browser).edit().autoPublish();
// scorm is auto started -> back
ScormPage.getScormPage(browser).back();
// log out
new UserToolsPage(browser).logout();
// log in and resume test
loginPage.loginAs(author.getLogin(), author.getPassword()).resume();
// direct jump in SCORM content
ScormPage.getScormPage(browser).passVerySimpleScorm().back().assertOnScormPassed().assertOnScormScore(33);
}
use of org.olat.user.restapi.UserVO in project OpenOLAT by OpenOLAT.
the class CourseElementTest method createCourseWithCP.
/**
* Create a course, create a CP, go the the course editor,
* create a course element of type CP, select the CP which just created,
* close the course editor and check the presence of the CP with the
* default title of the first page.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void createCourseWithCP(@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-CP-" + UUID.randomUUID();
navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
// go the authoring environment to create a CP
String cpTitle = "CP for a course - " + UUID.randomUUID();
navBar.openAuthoringEnvironment().createCP(cpTitle).assertOnGeneralTab();
navBar.openCourse(courseTitle);
String cpNodeTitle = "CP-1";
// create a course element of type CP with the CP that we create above
CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
courseEditor.createNode("cp").nodeTitle(cpNodeTitle).selectTabLearnContent().chooseCP(cpTitle);
// publish the course
courseEditor.publish().quickPublish();
// open the course and see the CP
CoursePageFragment course = courseEditor.clickToolbarBack();
course.clickTree().selectWithTitle(cpNodeTitle);
// check that the default title of CP (Lorem Ipsum) is visible in the iframe
WebElement cpIframe = browser.findElement(By.cssSelector("div.o_iframedisplay>iframe"));
browser.switchTo().frame(cpIframe);
browser.findElement(By.xpath("//h2[text()='Lorem Ipsum']"));
}
use of org.olat.user.restapi.UserVO 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");
}
use of org.olat.user.restapi.UserVO in project OpenOLAT by OpenOLAT.
the class CourseElementTest method createCourseWithInfoMessages.
/**
* Login, create a course, select "Messages Course", insert an info message
* course element, publish the course, add messages, count if the messages
* are there, show older messages, count the messages, show current messages,
* count the messages, edit a message and delete an other, count the messages.
*
* @param authorLoginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void createCourseWithInfoMessages(@InitialPage LoginPage authorLoginPage) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
// go to authoring
AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
String title = "Course Msg " + UUID.randomUUID().toString();
// create course
authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab().clickToolbarBack();
String infoNodeTitle = "Infos - News";
// open course editor
CoursePageFragment course = CoursePageFragment.getCourse(browser);
CourseEditorPageFragment editor = course.assertOnCoursePage().assertOnTitle(title).openToolsMenu().edit().createNode("info").nodeTitle(infoNodeTitle);
// configure the info messages
InfoMessageCEPage infoMsgConfig = new InfoMessageCEPage(browser);
infoMsgConfig.selectConfiguration().configure(3);
// publish
editor.publish().quickPublish(UserAccess.registred);
editor.clickToolbarBack();
course.clickTree().selectWithTitle(infoNodeTitle);
// set a message
infoMsgConfig.createMessage().setMessage("Information 0", "A very important info").next().finish().assertOnMessageTitle("Information 0");
for (int i = 1; i <= 3; i++) {
infoMsgConfig.quickMessage("Information " + i, "More informations");
}
int numOfMessages = infoMsgConfig.countMessages();
Assert.assertEquals(3, numOfMessages);
// count old messages
int numOfOldMessages = infoMsgConfig.oldMessages().countMessages();
Assert.assertEquals(4, numOfOldMessages);
// new messages
infoMsgConfig.newMessages();
int numOfNewMessages = infoMsgConfig.countMessages();
Assert.assertEquals(3, numOfNewMessages);
// edit
infoMsgConfig.oldMessages();
infoMsgConfig.editMessage("Information 2").setMessage("The latest information", "A very important info").save().assertOnMessageTitle("The latest information");
// delete
infoMsgConfig.deleteMessage("Information 3").confirmDelete();
int numOfSurvivingMessages = infoMsgConfig.countMessages();
Assert.assertEquals(3, numOfSurvivingMessages);
}
Aggregations