Search in sources :

Example 1 with ScormPage

use of org.olat.selenium.page.repository.ScormPage 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);
}
Also used : 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) ScormPage(org.olat.selenium.page.repository.ScormPage) 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)

Example 2 with ScormPage

use of org.olat.selenium.page.repository.ScormPage in project openolat by klemens.

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);
}
Also used : 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) ScormPage(org.olat.selenium.page.repository.ScormPage) 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

File (java.io.File)2 URL (java.net.URL)2 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)2 Test (org.junit.Test)2 LoginPage (org.olat.selenium.page.LoginPage)2 NavigationPage (org.olat.selenium.page.NavigationPage)2 AssessmentToolPage (org.olat.selenium.page.course.AssessmentToolPage)2 CourseEditorPageFragment (org.olat.selenium.page.course.CourseEditorPageFragment)2 CoursePageFragment (org.olat.selenium.page.course.CoursePageFragment)2 ScormPage (org.olat.selenium.page.repository.ScormPage)2 UserToolsPage (org.olat.selenium.page.user.UserToolsPage)2 UserRestClient (org.olat.test.rest.UserRestClient)2 UserVO (org.olat.user.restapi.UserVO)2 By (org.openqa.selenium.By)2 WebElement (org.openqa.selenium.WebElement)2