Search in sources :

Example 11 with CoursePageFragment

use of org.olat.selenium.page.course.CoursePageFragment in project OpenOLAT by OpenOLAT.

the class CourseTest method createCourseWithCalendar_alt.

/**
 * This is a variant of the test above based on the
 * feedback of our beta-testerin.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void createCourseWithCalendar_alt(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    loginPage.loginAs(author.getLogin(), author.getPassword());
    // create a course
    String courseTitle = "Course-iCal-" + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    navBar.openCourse(courseTitle);
    // activate the calendar options
    CoursePageFragment course = CoursePageFragment.getCourse(browser);
    course.options().calendar(Boolean.TRUE).save().clickToolbarBack();
    String calendarNodeTitle = "iCal-2";
    // create a course element of type calendar
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("cal").nodeTitle(calendarNodeTitle);
    // publish the course
    course = courseEditor.autoPublish();
    // open the course and see the CP
    course.clickTree().selectWithTitle(calendarNodeTitle);
    // create a recurring event
    CalendarPage calendar = new CalendarPage(browser);
    calendar.addEvent(2).setDescription("Repeat", "Loop", "Foreach").setAllDay(false).setBeginEnd(14, 18).setRecurringEvent(KalendarEvent.WEEKLY, 28).save().assertOnEvents("Repeat", 4);
    // pick an occurence which is not the first and modify it
    calendar.openDetailsOccurence("Repeat", 16).edit().setBeginEnd(15, 18).save().confirmModifyAllOccurences().assertOnEventsAt("Repeat", 4, 15);
    // delete futur event of the same event as above
    calendar.openDetailsOccurence("Repeat", 16).edit().delete().confirmDeleteFuturOccurences().assertOnEventsAt("Repeat", 2, 15);
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) CalendarPage(org.olat.selenium.page.core.CalendarPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 12 with CoursePageFragment

use of org.olat.selenium.page.course.CoursePageFragment in project OpenOLAT by OpenOLAT.

the class CourseTest method concurrentVisitAndPublish.

/**
 * An author create a course, a user see it.<br>
 * The author change the course and publish it. The user
 * must see a warning if the same node as been modified.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void concurrentVisitAndPublish(@InitialPage LoginPage loginPage, @Drone @User WebDriver ryomouBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    loginPage.loginAs(author.getLogin(), author.getPassword());
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    // create a course
    String courseTitle = "Course to publish-" + UUID.randomUUID().toString();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    // open course editor
    CoursePageFragment course = CoursePageFragment.getCourse(browser);
    CourseEditorPageFragment editor = course.assertOnCoursePage().assertOnTitle(courseTitle).openToolsMenu().edit();
    // create a course element of type info messages
    String firstNodeTitle = "First node";
    String secondNodeTitle = "Second node";
    editor.assertOnEditor().createNode("info").nodeTitle(firstNodeTitle).createNode("st").nodeTitle(secondNodeTitle).publish().quickPublish(UserAccess.registred);
    // The user opens the course
    LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl);
    ryomouLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
    NavigationPage ryomouNavBar = new NavigationPage(ryomouBrowser);
    ryomouNavBar.openMyCourses().openSearch().extendedSearch(courseTitle).select(courseTitle).start();
    CoursePageFragment ryomouCourse = new CoursePageFragment(ryomouBrowser);
    MenuTreePageFragment ryomouCourseTree = ryomouCourse.clickTree().selectWithTitle(firstNodeTitle);
    // The author make a change on node 2
    String changedNodeTitlev2 = "Changed 2 title";
    course = editor.selectNode(secondNodeTitle).nodeTitle(changedNodeTitlev2).autoPublish();
    // The user click the first node and the changed second node
    ryomouCourseTree.selectWithTitle(firstNodeTitle).selectWithTitle(changedNodeTitlev2);
    ryomouCourse.assertOnTitle(changedNodeTitlev2);
    // The author changed the second node
    String changedNodeTitlev3 = "Changed 3 title";
    course = course.edit().selectNode(changedNodeTitlev2).nodeTitle(changedNodeTitlev3).autoPublish();
    // The user wait the message
    ryomouCourse.assertOnRestart().clickRestart();
    ryomouCourseTree.selectWithTitle(changedNodeTitlev3);
    ryomouCourse.assertOnTitle(changedNodeTitlev3);
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) MenuTreePageFragment(org.olat.selenium.page.core.MenuTreePageFragment) LoginPage(org.olat.selenium.page.LoginPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 13 with CoursePageFragment

use of org.olat.selenium.page.course.CoursePageFragment in project OpenOLAT by OpenOLAT.

the class AssessmentTest method assessmentCourseElement.

/**
 * An author create a course with an assessment course element with
 * min., max., cut value and so on. It add an user to the course,
 * go to the assessment tool and set a score to the assessed user.<br>
 *
 * The user log in, go to the efficiency statements list and check
 * it become its statement.
 *
 * @param authorLoginPage
 * @param ryomouBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void assessmentCourseElement(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver ryomouBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    authorLoginPage.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.addMember().searchMember(ryomou, true).nextUsers().nextOverview().nextPermissions().finish();
    // efficiency statement is default on
    // go to the assessment to to set the points
    members.clickToolbarBack().assessmentTool().users().assertOnUsers(ryomou).selectUser(ryomou).selectCourseNode(assessmentNodeTitle).setAssessmentScore(8.0f).assertUserPassedCourseNode(assessmentNodeTitle);
    // Ryomou login
    LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl);
    ryomouLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
    // see its beautiful efficiency statement
    UserToolsPage ryomouUserTools = new UserToolsPage(ryomouBrowser);
    ryomouUserTools.openUserToolsMenu().openMyEfficiencyStatement().assertOnEfficiencyStatmentPage().assertOnStatement(courseTitle, true).selectStatement(courseTitle).assertOnCourseDetails(assessmentNodeTitle, true);
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserToolsPage(org.olat.selenium.page.user.UserToolsPage) UserVO(org.olat.user.restapi.UserVO) AssessmentCEConfigurationPage(org.olat.selenium.page.course.AssessmentCEConfigurationPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) MembersPage(org.olat.selenium.page.course.MembersPage) LoginPage(org.olat.selenium.page.LoginPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 14 with CoursePageFragment

use of org.olat.selenium.page.course.CoursePageFragment in project OpenOLAT by OpenOLAT.

the class AssessmentTest method taskWithGroupsAndStandardSettings.

/**
 * An author create a course for a group task with the default
 * settings, all steps are selected, grading with only passed,
 * 3 groups, 2 tasks, 1 solution...</br>
 * A group has 2 participants, the first select a task, the
 * second submit 2 documents, one with the embedded editor,
 * one with the upload mechanism.</br>
 * The author reviews the documents, use the assessment tool
 * for group within the course element to set passed to the
 * group.</br>
 * The 2 participants check if they successfully passed the task.
 *
 * @param authorLoginPage
 * @param ryomouBrowser
 * @param kanuBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void taskWithGroupsAndStandardSettings(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver ryomouBrowser, @Drone @Participant WebDriver kanuBrowser) 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-group-task-" + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    // create a course element of type Test with the test that we create above
    String gtaNodeTitle = "Group task 1";
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("gta").nodeTitle(gtaNodeTitle);
    GroupTaskConfigurationPage gtaConfig = new GroupTaskConfigurationPage(browser);
    gtaConfig.selectWorkflow().openBusinessGroupChooser().createBusinessGroup("Group to task - 1").createBusinessGroup("Group to task - 2").createBusinessGroup("Group to task - 3").confirmBusinessGroupsSelection().saveWorkflow().selectAssignment();
    URL task1Url = JunitTestHelper.class.getResource("file_resources/task_1_a.txt");
    File task1File = new File(task1Url.toURI());
    String taskName1 = "Task-1";
    gtaConfig.uploadTask(taskName1, task1File);
    URL task2Url = JunitTestHelper.class.getResource("file_resources/task_1_b.txt");
    File task2File = new File(task2Url.toURI());
    String taskName2 = "Task-2-b";
    gtaConfig.uploadTask(taskName2, 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);
    courseEditor.publish().quickPublish(UserAccess.guest);
    MembersPage membersPage = courseEditor.clickToolbarBack().members();
    GroupPage groupPage = membersPage.selectBusinessGroups().selectBusinessGroup("Group to task - 1").openAdministration().openAdminMembers();
    groupPage.addMember().searchMember(kanu, true).nextUsers().nextOverview().nextPermissions().finish();
    groupPage.addMember().searchMember(ryomou, true).nextUsers().nextOverview().nextPermissions().finish();
    groupPage.close();
    // 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(taskName2).assertSubmissionAvailable();
    // Participant 2 log in
    LoginPage kanuLoginPage = LoginPage.getLoginPage(kanuBrowser, deploymentUrl);
    kanuLoginPage.loginAs(kanu).resume();
    // open the course
    NavigationPage kanuNavBar = new NavigationPage(kanuBrowser);
    kanuNavBar.openMyCourses().select(courseTitle);
    // go to the group task
    CoursePageFragment kanuTestCourse = new CoursePageFragment(kanuBrowser);
    kanuTestCourse.clickTree().selectWithTitle(gtaNodeTitle);
    URL submit1Url = JunitTestHelper.class.getResource("file_resources/submit_1.txt");
    File submit1File = new File(submit1Url.toURI());
    String submittedFilename = "my_solution.html";
    String submittedText = "This is my solution";
    GroupTaskPage kanuTask = new GroupTaskPage(kanuBrowser);
    kanuTask.assertTask(taskName2).assertSubmissionAvailable().submitFile(submit1File).submitText(submittedFilename, submittedText).submitDocuments();
    // back to author
    coursePage.clickTree().selectWithTitle(gtaNodeTitle);
    GroupTaskToCoachPage groupToCoach = new GroupTaskToCoachPage(browser);
    groupToCoach.selectBusinessGroupToCoach("Group to task - 1").assertSubmittedDocument("my_solution.html").assertSubmittedDocument("submit_1.txt").reviewed().openGroupAssessment().groupAssessment(Boolean.TRUE, null);
    // participant check if they passed
    kanuTestCourse.clickTree().selectWithTitle(gtaNodeTitle);
    kanuTask.assertPassed();
    ryomouTestCourse.clickTree().selectWithTitle(gtaNodeTitle);
    ryomouTask.assertPassed();
}
Also used : GroupPage(org.olat.selenium.page.group.GroupPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) URL(java.net.URL) LoginPage(org.olat.selenium.page.LoginPage) UserRestClient(org.olat.test.rest.UserRestClient) GroupTaskPage(org.olat.selenium.page.course.GroupTaskPage) CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) GroupTaskConfigurationPage(org.olat.selenium.page.course.GroupTaskConfigurationPage) MembersPage(org.olat.selenium.page.course.MembersPage) File(java.io.File) GroupTaskToCoachPage(org.olat.selenium.page.course.GroupTaskToCoachPage) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 15 with CoursePageFragment

use of org.olat.selenium.page.course.CoursePageFragment 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);
}
Also used : QTI12Page(org.olat.selenium.page.qti.QTI12Page) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) WebElement(org.openqa.selenium.WebElement) URL(java.net.URL) LoginPage(org.olat.selenium.page.LoginPage) UserRestClient(org.olat.test.rest.UserRestClient) CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserToolsPage(org.olat.selenium.page.user.UserToolsPage) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) By(org.openqa.selenium.By) AssessmentToolPage(org.olat.selenium.page.course.AssessmentToolPage) File(java.io.File) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Aggregations

CoursePageFragment (org.olat.selenium.page.course.CoursePageFragment)110 Test (org.junit.Test)104 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)102 UserRestClient (org.olat.test.rest.UserRestClient)102 UserVO (org.olat.user.restapi.UserVO)102 CourseEditorPageFragment (org.olat.selenium.page.course.CourseEditorPageFragment)80 NavigationPage (org.olat.selenium.page.NavigationPage)56 LoginPage (org.olat.selenium.page.LoginPage)54 MembersPage (org.olat.selenium.page.course.MembersPage)34 AuthoringEnvPage (org.olat.selenium.page.repository.AuthoringEnvPage)30 UserToolsPage (org.olat.selenium.page.user.UserToolsPage)30 WebElement (org.openqa.selenium.WebElement)30 URL (java.net.URL)24 File (java.io.File)22 By (org.openqa.selenium.By)14 Calendar (java.util.Calendar)10 AssessmentCEConfigurationPage (org.olat.selenium.page.course.AssessmentCEConfigurationPage)8 AssessmentToolPage (org.olat.selenium.page.course.AssessmentToolPage)8 EnrollmentConfigurationPage (org.olat.selenium.page.course.EnrollmentConfigurationPage)8 EnrollmentPage (org.olat.selenium.page.course.EnrollmentPage)8