use of org.olat.test.rest.UserRestClient 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.test.rest.UserRestClient in project openolat by klemens.
the class AssessmentTest method certificatesManuallyGenerated.
/**
* An author create a course, publish it and add a participant.
* It set the certificate, create one for the participant.<br>
* The participant logs in and look at its wonderful certificate.
*
* @param authorLoginPage
* @param reiBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void certificatesManuallyGenerated(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver reiBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
authorLoginPage.loginAs(author.getLogin(), author.getPassword());
UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
// create a course
String courseTitle = "Course-With-Certificates-" + UUID.randomUUID();
navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
// create a course element of type CP with the CP that we create above
CoursePageFragment courseRuntime = CoursePageFragment.getCourse(browser).edit().createNode("info").autoPublish();
// 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().clickToolbarBack().efficiencyStatementConfiguration().enableCertificates(false).enableRecertification().save().clickToolbarBack();
// create a certificate
courseRuntime.assessmentTool().users().selectUser(rei).generateCertificate();
// Participant log in
LoginPage reiLoginPage = LoginPage.getLoginPage(reiBrowser, deploymentUrl);
reiLoginPage.loginAs(rei.getLogin(), rei.getPassword()).resume();
// open the efficiency statements
UserToolsPage reiUserTools = new UserToolsPage(reiBrowser);
reiUserTools.openUserToolsMenu().openMyEfficiencyStatement().assertOnEfficiencyStatmentPage().assertOnCertificate(courseTitle);
}
use of org.olat.test.rest.UserRestClient 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.test.rest.UserRestClient in project openolat by klemens.
the class BusinessGroupTest method createGroupWithWaitingList.
/**
* An author creates a group, it opens the tab groups and then "My groups". It
* creates a group, enters a number of participants "1", enable the waiting
* list. In members visibility, it see coaches, participants and waiting
* list visible to members.<br>
* A participant and than a student come, book the group. The first enters
* the group, the second the waiting list.<br>
* The author go in the members list to check if it's in the coach list,
* the participant in the participants list and the student in the waiting
* list.
*
* Should show group starting page, with menu items Administration and Bookings visible
*
* @param loginPage
* @param participantBrowser
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void createGroupWithWaitingList(@InitialPage LoginPage loginPage, @Drone @Participant WebDriver participantBrowser, @Drone @Student WebDriver studentBrowser) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createRandomUser("Selena");
UserVO participant = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
UserVO student = new UserRestClient(deploymentUrl).createRandomUser("Asuka");
loginPage.loginAs(author.getLogin(), author.getPassword()).resume();
// go to groups
String groupName = "Group-1-" + UUID.randomUUID();
GroupPage group = navBar.openGroups(browser).createGroup(groupName, "A group with a waiting list").openAdministration().openEditDetails().setMaxNumberOfParticipants(1).setWaitingList().saveDetails();
// add booking ( token one )
String token = "secret";
String description = "The password is secret";
group.openBookingConfig().openAddDropMenu().addTokenMethod().configureTokenMethod(token, description).assertOnToken(token);
// members see members
group = GroupPage.getGroup(browser).openAdminMembers().setVisibility(true, true, true).openMembers();
// participant search published groups
LoginPage participantLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
// tools
participantLoginPage.loginAs(participant.getLogin(), participant.getPassword()).resume();
// groups
NavigationPage participantNavBar = new NavigationPage(participantBrowser);
participantNavBar.openGroups(participantBrowser).publishedGroups().bookGroup(groupName).bookToken(token);
// are we that we are in the right group?
GroupPage.getGroup(participantBrowser).assertOnInfosPage(groupName);
// student search published groups
LoginPage studentLoginPage = LoginPage.getLoginPage(studentBrowser, deploymentUrl);
// tools
studentLoginPage.loginAs(student.getLogin(), student.getPassword()).resume();
// groups
NavigationPage studentNavBar = new NavigationPage(studentBrowser);
studentNavBar.openGroups(studentBrowser).publishedGroups().bookGroup(groupName).bookToken(token);
// are we that we are in the right group?
GroupPage.getGroup(studentBrowser).assertOnWaitingList(groupName);
group = GroupPage.getGroup(browser).openMembers().assertMembersInOwnerList(author).assertMembersInParticipantList(participant).assertMembersInWaitingList(student);
}
use of org.olat.test.rest.UserRestClient in project openolat by klemens.
the class BusinessGroupTest method createDeleteBusinessGroup.
/**
* Create a group, search it and delete it.
*
* @param loginPage
* @throws IOException
* @throws URISyntaxException
*/
@Test
@RunAsClient
public void createDeleteBusinessGroup(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
UserVO author = new UserRestClient(deploymentUrl).createAuthor();
loginPage.loginAs(author.getLogin(), author.getPassword()).resume();
// go to groups
String groupName = "Delete-1-" + UUID.randomUUID();
navBar.openGroups(browser).createGroup(groupName, "A very little group to delete");
// return to group list and delete it
navBar.openGroups(browser).deleteGroup(groupName).assertDeleted(groupName);
}
Aggregations