Search in sources :

Example 51 with CourseEditorPageFragment

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

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);
}
Also used : CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) Calendar(java.util.Calendar) WebElement(org.openqa.selenium.WebElement) URL(java.net.URL) LoginPage(org.olat.selenium.page.LoginPage) Date(java.util.Date) UserRestClient(org.olat.test.rest.UserRestClient) AssessmentModePage(org.olat.selenium.page.course.AssessmentModePage) CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) 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)

Example 52 with CourseEditorPageFragment

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

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();
}
Also used : 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 53 with CourseEditorPageFragment

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

the class CourseElementTest method createCourseWithBlog_externalFeed.

@Test
@RunAsClient
public void createCourseWithBlog_externalFeed(@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-Blog-" + UUID.randomUUID().toString();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    String blogNodeTitle = "Blog-1";
    String blogTitle = "Blog - " + UUID.randomUUID();
    // create a course element of type blog
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("blog").nodeTitle(blogNodeTitle).selectTabLearnContent().createFeed(blogTitle);
    // publish the course
    courseEditor.publish().quickPublish();
    // open the course and see the blog
    CoursePageFragment course = courseEditor.clickToolbarBack();
    course.clickTree().selectWithTitle(blogNodeTitle);
    // check that the title of the podcast is correct
    WebElement podcastH2 = browser.findElement(By.cssSelector("div.o_blog_info>h2>i.o_FileResource-BLOG_icon"));
    Assert.assertNotNull(podcastH2);
    // Assert.assertEquals(blogTitle, podcastH2.getText().trim());
    FeedPage feed = FeedPage.getFeedPage(browser);
    feed.newExternalBlog(blogTitle, "https://www.openolat.com/feed/");
// check only that the subscription link is visible
/*
		By subscriptionBy = By.cssSelector("div.o_subscription>a");
		OOGraphene.waitElement(subscriptionBy, 20, browser);
		WebElement subscriptionLink = browser.findElement(subscriptionBy);
		Assert.assertTrue(subscriptionLink.isDisplayed());
		*/
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) FeedPage(org.olat.selenium.page.repository.FeedPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) WebElement(org.openqa.selenium.WebElement) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 54 with CourseEditorPageFragment

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

the class CourseElementTest method createCourseWithQTITest.

@Test
@RunAsClient
public void createCourseWithQTITest(@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-QTI-Test-1.2-" + UUID.randomUUID().toString();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    String testNodeTitle = "QTITest-1";
    String testTitle = "Test - " + UUID.randomUUID().toString();
    // create a course element of type CP with the CP that we create above
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("iqtest").nodeTitle(testNodeTitle).selectTabLearnContent().createQTI12Test(testTitle);
    // publish the course
    courseEditor.publish().quickPublish();
    // open the course and see the CP
    CoursePageFragment course = courseEditor.clickToolbarBack();
    course.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());
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) WebElement(org.openqa.selenium.WebElement) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 55 with CourseEditorPageFragment

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

the class CourseElementTest method createCourseWithMemberList.

/**
 * An author create a course with a member list course element.
 * It add two participants and a coach. It publish the course and
 * check that it sees the authors, coaches and participants.<br>
 * After that, it edits the course and change the settins to only
 * show the participants. It checks that only the participants are
 * visible.<br>
 * At least, it changes the settings a second time to only show
 * the course coaches.
 *
 * @param authorLoginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void createCourseWithMemberList(@InitialPage LoginPage authorLoginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO coach = new UserRestClient(deploymentUrl).createRandomUser("Rei");
    UserVO participant1 = new UserRestClient(deploymentUrl).createRandomUser("Kanu");
    UserVO participant2 = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    // go to authoring
    AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
    String title = "Course partilist " + UUID.randomUUID();
    // create course
    authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab().clickToolbarBack();
    // add 2 participants
    CoursePageFragment course = new CoursePageFragment(browser);
    MembersPage members = course.members();
    members.importMembers().setMembers(participant1, participant2).nextUsers().nextOverview().nextPermissions().finish();
    // add a coach
    course.members().addMember().searchMember(coach, true).nextUsers().nextOverview().selectRepositoryEntryRole(false, true, false).nextPermissions().finish();
    members.clickToolbarBack();
    String memberListTitle = "MemberList";
    // open course editor
    CourseEditorPageFragment editor = course.assertOnCoursePage().assertOnTitle(title).openToolsMenu().edit().createNode("cmembers").nodeTitle(memberListTitle);
    // publish
    editor.publish().quickPublish(UserAccess.registred);
    editor.clickToolbarBack();
    course.clickTree().selectWithTitle(memberListTitle);
    // check the default configuration with authors, coaches and participants
    MemberListPage memberList = new MemberListPage(browser);
    memberList.assertOnOwner(author.getFirstName()).assertOnCoach(coach.getFirstName()).assertOnParticipant(participant1.getFirstName()).assertOnParticipant(participant2.getFirstName());
    // the author is not satisfied with the configuration
    editor = course.openToolsMenu().edit().selectNode(memberListTitle);
    MemberListConfigurationPage memberListConfig = new MemberListConfigurationPage(browser);
    memberListConfig.selectSettings().setOwners(Boolean.FALSE).setCoaches(Boolean.FALSE).save();
    // go check the results
    course = editor.autoPublish();
    course.clickTree().selectWithTitle(memberListTitle);
    memberList.assertOnMembers().assertOnNotOwner(author.getFirstName()).assertOnNotCoach(coach.getFirstName()).assertOnParticipant(participant1.getFirstName()).assertOnParticipant(participant2.getFirstName());
    // perhaps only the coaches
    editor = course.openToolsMenu().edit().selectNode(memberListTitle);
    memberListConfig = new MemberListConfigurationPage(browser);
    memberListConfig.selectSettings().setCoaches(Boolean.TRUE).setCourseCoachesOnly().setParticipants(Boolean.FALSE).save();
    // go check that we see only the coaches results
    course = editor.autoPublish();
    course.clickTree().selectWithTitle(memberListTitle);
    memberList.assertOnMembers().assertOnNotOwner(author.getFirstName()).assertOnCoach(coach.getFirstName()).assertOnNotParticipant(participant1.getFirstName()).assertOnNotParticipant(participant2.getFirstName());
}
Also used : MemberListPage(org.olat.selenium.page.course.MemberListPage) CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) AuthoringEnvPage(org.olat.selenium.page.repository.AuthoringEnvPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) MemberListConfigurationPage(org.olat.selenium.page.course.MemberListConfigurationPage) MembersPage(org.olat.selenium.page.course.MembersPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Aggregations

RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)86 Test (org.junit.Test)86 CourseEditorPageFragment (org.olat.selenium.page.course.CourseEditorPageFragment)86 UserRestClient (org.olat.test.rest.UserRestClient)84 UserVO (org.olat.user.restapi.UserVO)84 CoursePageFragment (org.olat.selenium.page.course.CoursePageFragment)80 NavigationPage (org.olat.selenium.page.NavigationPage)44 LoginPage (org.olat.selenium.page.LoginPage)40 MembersPage (org.olat.selenium.page.course.MembersPage)30 WebElement (org.openqa.selenium.WebElement)30 URL (java.net.URL)24 File (java.io.File)22 UserToolsPage (org.olat.selenium.page.user.UserToolsPage)16 AuthoringEnvPage (org.olat.selenium.page.repository.AuthoringEnvPage)14 AssessmentCEConfigurationPage (org.olat.selenium.page.course.AssessmentCEConfigurationPage)10 AssessmentToolPage (org.olat.selenium.page.course.AssessmentToolPage)10 By (org.openqa.selenium.By)10 EnrollmentConfigurationPage (org.olat.selenium.page.course.EnrollmentConfigurationPage)8 EnrollmentPage (org.olat.selenium.page.course.EnrollmentPage)8 GroupPage (org.olat.selenium.page.group.GroupPage)8