Search in sources :

Example 16 with CoursePageFragment

use of org.olat.selenium.page.course.CoursePageFragment 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 17 with CoursePageFragment

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

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);
}
Also used : UserToolsPage(org.olat.selenium.page.user.UserToolsPage) UserVO(org.olat.user.restapi.UserVO) 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 18 with CoursePageFragment

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

the class AssessmentTest method bulkAssessment.

/**
 * Create an assessment course element, add two users to the course
 * and assesses them with the bulk assessment tool. The 2 users
 * log in and check their results.
 *
 * @param loginPage
 * @param kanuBrowser
 * @param reiBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void bulkAssessment(@InitialPage LoginPage loginPage, @Drone @User WebDriver ryomouBrowser, @Drone @Participant WebDriver kanuBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    UserVO kanu = new UserRestClient(deploymentUrl).createRandomUser("Kanu");
    loginPage.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.importMembers().setMembers(ryomou, kanu).nextUsers().nextOverview().nextPermissions().finish();
    BulkAssessmentData[] data = new BulkAssessmentData[] { new BulkAssessmentData(ryomou, 8.0f, null, "Well done"), new BulkAssessmentData(kanu, 4.0f, null, "Need more work") };
    members.clickToolbarBack().assessmentTool().bulk().data(data).nextData().nextColumns().nextValidation().finish();
    // Ryomou login
    LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl);
    ryomouLoginPage.loginAs(ryomou).resume();
    NavigationPage ryomouNavBar = new NavigationPage(ryomouBrowser);
    ryomouNavBar.openMyCourses().select(courseTitle);
    // go to the group task
    CoursePageFragment ryomouCourse = new CoursePageFragment(ryomouBrowser);
    ryomouCourse.clickTree().selectWithTitle(assessmentNodeTitle);
    // Second login
    LoginPage kanuLoginPage = LoginPage.getLoginPage(kanuBrowser, deploymentUrl);
    kanuLoginPage.loginAs(kanu).resume();
    NavigationPage kanuNavBar = new NavigationPage(kanuBrowser);
    kanuNavBar.openMyCourses().select(courseTitle);
    // go to the group task
    CoursePageFragment kanuCourse = new CoursePageFragment(kanuBrowser);
    kanuCourse.clickTree().selectWithTitle(assessmentNodeTitle);
    // Ryomou -> passed
    WebElement passedEl = ryomouBrowser.findElement(By.cssSelector("tr.o_state.o_passed"));
    Assert.assertTrue(passedEl.isDisplayed());
    // Kanu -> failed
    WebElement failedEl = kanuBrowser.findElement(By.cssSelector("tr.o_state.o_failed"));
    Assert.assertTrue(failedEl.isDisplayed());
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) BulkAssessmentData(org.olat.selenium.page.course.BulkAssessmentPage.BulkAssessmentData) NavigationPage(org.olat.selenium.page.NavigationPage) AssessmentCEConfigurationPage(org.olat.selenium.page.course.AssessmentCEConfigurationPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) MembersPage(org.olat.selenium.page.course.MembersPage) WebElement(org.openqa.selenium.WebElement) 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 19 with CoursePageFragment

use of org.olat.selenium.page.course.CoursePageFragment 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);
}
Also used : RepositoryRestClient(org.olat.test.rest.RepositoryRestClient) UserToolsPage(org.olat.selenium.page.user.UserToolsPage) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) MembersPage(org.olat.selenium.page.course.MembersPage) File(java.io.File) URL(java.net.URL) 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 20 with CoursePageFragment

use of org.olat.selenium.page.course.CoursePageFragment 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']"));
}
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)

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