Search in sources :

Example 86 with CoursePageFragment

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

the class BusinessGroupTest method enrollmentWithMultiEnrollment.

/**
 * An author create a course, with an enrollment course element. It
 * configure it and create 3 groups and set the maximum enrollment counter to 2<br>
 *
 * One user goes to the course and enrolls in 2 of the groups. It shouldent be possible
 * enroll in the third<br>
 *
 * @param authorLoginPage
 * @param ryomouBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void enrollmentWithMultiEnrollment(@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");
    // create a course
    String courseTitle = "Enrolment-3-" + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    // create a course element of type Enrolment
    String enNodeTitle = "Enrolment-3";
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit();
    courseEditor.createNode("en").nodeTitle(enNodeTitle);
    // configure enrolment with a group that we create
    List<String> groups = new ArrayList<String>();
    groups.add("Enrolment group - 3 " + UUID.randomUUID());
    groups.add("Enrolment group - 3 " + UUID.randomUUID());
    groups.add("Enrolment group - 3 " + UUID.randomUUID());
    EnrollmentConfigurationPage enrolmentConfig = new EnrollmentConfigurationPage(browser);
    enrolmentConfig.selectConfiguration().createBusinessGroup(groups.get(0), "-", 4, false, false).createBusinessGroup(groups.get(1), "-", 4, false, false).createBusinessGroup(groups.get(2), "-", 4, false, false).selectMultipleEnrollments(2);
    // publish the course
    courseEditor.publish().quickPublish(UserAccess.registred);
    courseEditor.clickToolbarBack();
    for (String groupName : groups) {
        navBar.openGroups(browser).selectGroup(groupName).openAdministration().openAdminMembers().setVisibility(true, true, false).openMembers();
    }
    // Ryomou open the course
    LoginPage.getLoginPage(ryomouBrowser, deploymentUrl).loginAs(ryomou).resume();
    NavigationPage participantNavBar = new NavigationPage(ryomouBrowser);
    participantNavBar.openMyCourses().openSearch().extendedSearch(courseTitle).select(courseTitle).start();
    OOGraphene.waitBusy(ryomouBrowser);
    // go to the enrollment
    CoursePageFragment participantCourse = new CoursePageFragment(ryomouBrowser);
    participantCourse.clickTree().selectWithTitle(enNodeTitle);
    EnrollmentPage enrollmentPage = new EnrollmentPage(ryomouBrowser);
    enrollmentPage.assertOnEnrolmentPage().multiEnroll(2);
    // assert that that no more enrollment is allowed
    enrollmentPage.assertNoEnrollmentAllowed();
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) EnrollmentPage(org.olat.selenium.page.course.EnrollmentPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) ArrayList(java.util.ArrayList) EnrollmentConfigurationPage(org.olat.selenium.page.course.EnrollmentConfigurationPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 87 with CoursePageFragment

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

the class BusinessGroupTest method enrollmentWithUnlimitedBusinessGroups.

/**
 * Variant from the above test where the business group is not
 * limited in size. This was a bug while development of the 10.3
 * release.
 *
 * @param authorLoginPage
 * @param ryomouBrowser
 * @param reiBrowser
 * @param kanuBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void enrollmentWithUnlimitedBusinessGroups(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver ryomouBrowser, @Drone @Participant WebDriver reiBrowser, @Drone @Student WebDriver kanuBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
    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 = "Enrollment-3-" + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    // create a group in members management
    String groupName = "Enroll - " + UUID.randomUUID();
    CoursePageFragment authorCourse = CoursePageFragment.getCourse(browser);
    MembersPage membersPage = authorCourse.members().selectBusinessGroups().createBusinessGroup(groupName, "-", -1, false, false);
    // back to the members page
    navBar.openCourse(courseTitle);
    authorCourse = membersPage.clickToolbarBack();
    // create an enrollment course element
    String enNodeTitle = "Enroll - 3";
    CourseEditorPageFragment courseEditor = authorCourse.edit().createNode("en").nodeTitle(enNodeTitle);
    // select the group created above
    EnrollmentConfigurationPage enrolmentConfig = new EnrollmentConfigurationPage(browser);
    enrolmentConfig.selectConfiguration().selectBusinessGroups();
    // publish the course
    courseEditor.publish().quickPublish(UserAccess.registred);
    GroupPage authorGroup = navBar.openGroups(browser).selectGroup(groupName).openAdministration().openAdminMembers().setVisibility(false, true, false).openMembers().assertParticipantList();
    Enrollment[] participantDrivers = new Enrollment[] { new Enrollment(ryomou, ryomouBrowser), new Enrollment(rei, reiBrowser), new Enrollment(kanu, kanuBrowser) };
    for (Enrollment enrollment : participantDrivers) {
        WebDriver driver = enrollment.getDriver();
        LoginPage.getLoginPage(driver, deploymentUrl).loginAs(enrollment.getUser()).resume();
        NavigationPage participantNavBar = new NavigationPage(driver);
        participantNavBar.openMyCourses().openSearch().extendedSearch(courseTitle).select(courseTitle).start();
        // go to the enrollment
        CoursePageFragment participantCourse = new CoursePageFragment(driver);
        participantCourse.clickTree().selectWithTitle(enNodeTitle);
        EnrollmentPage enrollmentPage = new EnrollmentPage(driver);
        enrollmentPage.assertOnEnrolmentPage();
        enrollment.setEnrollmentPage(enrollmentPage);
    }
    // enroll
    for (Enrollment enrollment : participantDrivers) {
        enrollment.getEnrollmentPage().enrollNoWait();
    }
    // wait
    int errors = 0;
    for (Enrollment enrollment : participantDrivers) {
        if (enrollment.getEnrollmentPage().hasError()) {
            errors++;
        }
    }
    // author check the lists
    authorGroup.openMembers();
    // must a participant and 2 in waiting list
    int participants = 0;
    for (Enrollment enrollment : participantDrivers) {
        if (authorGroup.isInMembersParticipantList(enrollment.getUser())) {
            participants++;
        }
    }
    Assert.assertEquals(3, participants);
    Assert.assertEquals(0, errors);
}
Also used : WebDriver(org.openqa.selenium.WebDriver) GroupPage(org.olat.selenium.page.group.GroupPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) UserRestClient(org.olat.test.rest.UserRestClient) CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) EnrollmentPage(org.olat.selenium.page.course.EnrollmentPage) MembersPage(org.olat.selenium.page.course.MembersPage) EnrollmentConfigurationPage(org.olat.selenium.page.course.EnrollmentConfigurationPage) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 88 with CoursePageFragment

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

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)

Example 89 with CoursePageFragment

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

the class CourseElementTest method createCourseWithLTI.

/**
 * An author setup a course with a LTI course element with score enabled.
 * A participant take the course and see the LTI content. The back channel
 * need the url of the OpenOLAT instance which is currently difficult
 * for a selenium test. The grading is not tested until a LTI server
 * can be installed on localhost.
 *
 * @param authorLoginPage
 * @param participantBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void createCourseWithLTI(@InitialPage LoginPage authorLoginPage, @Drone @User WebDriver participantBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO participant = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    // create a course
    String courseTitle = "Course-LTI-" + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    // create a course element of type Test with the test that we create above
    String ltiTitle = "LTI";
    CourseEditorPageFragment courseEditor = CoursePageFragment.getCourse(browser).edit().createNode("lti").nodeTitle(ltiTitle);
    // configure assessment
    LTIConfigurationPage ltiConfig = new LTIConfigurationPage(browser);
    ltiConfig.selectConfiguration().setLtiPage("http://lti.frentix.com/tool.php", "123456", "secret").enableScore(10.0d, 5.0d).save();
    // 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(participant, true).nextUsers().nextOverview().nextPermissions().finish();
    // Participant login
    LoginPage participantLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    participantLoginPage.loginAs(participant.getLogin(), participant.getPassword()).resume();
    NavigationPage participantNavBar = new NavigationPage(participantBrowser);
    participantNavBar.openMyCourses().openSearch().extendedSearch(courseTitle).select(courseTitle);
    CoursePageFragment participantCourse = new CoursePageFragment(participantBrowser);
    participantCourse.clickTree().selectWithTitle(ltiTitle);
    LTIPage lti = new LTIPage(participantBrowser);
    lti.start().outcomeToolProvider();
// .sendGrade(0.8d);
}
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) MembersPage(org.olat.selenium.page.course.MembersPage) LTIPage(org.olat.selenium.page.course.LTIPage) LoginPage(org.olat.selenium.page.LoginPage) UserRestClient(org.olat.test.rest.UserRestClient) LTIConfigurationPage(org.olat.selenium.page.course.LTIConfigurationPage) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 90 with CoursePageFragment

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

the class CourseElementTest method createCourseWithDialog.

/**
 * An author create a course with a dialog course element. It
 * add a participant to the course, a file to the dialog in
 * the course element configuration and after publishing the course
 * in the view of the dialog. It opens the forum of one of the files,
 * create a new thread.<br>
 * The participant log in, open the course and the dialog element. It
 * reads the thread and make a reply. The author answers to the reply.
 *
 * @param loginPage
 */
@Test
@RunAsClient
public void createCourseWithDialog(@InitialPage LoginPage authorLoginPage, @Drone @Participant WebDriver participantBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO participant = new UserRestClient(deploymentUrl).createRandomUser("Rei");
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    // go to authoring
    AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
    String title = "Course dialog " + UUID.randomUUID();
    // create course
    authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab().clickToolbarBack();
    // add a participant
    MembersPage members = new CoursePageFragment(browser).members();
    members.addMember().searchMember(participant, true).nextUsers().nextOverview().selectRepositoryEntryRole(false, false, true).nextPermissions().finish();
    members.clickToolbarBack();
    String dialogNodeTitle = "Dialog";
    // open course editor
    CoursePageFragment course = CoursePageFragment.getCourse(browser);
    CourseEditorPageFragment editor = course.assertOnCoursePage().assertOnTitle(title).openToolsMenu().edit().createNode("dialog").nodeTitle(dialogNodeTitle);
    // upload a file in the configuration
    URL imageUrl = JunitTestHelper.class.getResource("file_resources/IMG_1484.jpg");
    File imageFile = new File(imageUrl.toURI());
    DialogConfigurationPage dialogConfig = new DialogConfigurationPage(browser);
    dialogConfig.selectConfiguration().uploadFile(imageFile);
    // publish and go to the course element
    editor.publish().quickPublish(UserAccess.membersOnly);
    editor.clickToolbarBack();
    course.clickTree().selectWithTitle(dialogNodeTitle);
    // upload a second file
    URL imageRunUrl = JunitTestHelper.class.getResource("file_resources/IMG_1483.png");
    File imageRunFile = new File(imageRunUrl.toURI());
    DialogPage dialog = new DialogPage(browser);
    dialog.assertOnFile(imageFile.getName()).uploadFile(imageRunFile).assertOnFile(imageRunFile.getName()).openForum(imageRunFile.getName()).createThread("JPEG vs PNG", "Which is the best format", null);
    // The participant come in
    LoginPage participantLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    participantLoginPage.loginAs(participant.getLogin(), participant.getPassword()).resume();
    // The participant find the course
    NavigationPage participantNavBar = new NavigationPage(participantBrowser);
    participantNavBar.assertOnNavigationPage().openMyCourses().select(title);
    // And opens the dialog course element
    CoursePageFragment participantCourse = CoursePageFragment.getCourse(participantBrowser);
    participantCourse.clickTree().selectWithTitle(dialogNodeTitle);
    DialogPage participantDialog = new DialogPage(participantBrowser);
    participantDialog.assertOnFile(imageRunFile.getName()).openForum(imageRunFile.getName()).openThread("JPEG vs PNG").replyToMessage("JPEG vs PNG", "PNG for sure", "Not a loosy format");
    // The author reload the messages
    dialog.back().openForum(imageRunFile.getName()).openThread("JPEG vs PNG").assertMessageBody("Not a loosy format").replyToMessage("PNG for sure", "JPEG smaller", "JPEG is smaller");
    // The participant check the reply
    participantDialog.back().openForum(imageRunFile.getName()).openThread("JPEG vs PNG").assertMessageBody("JPEG is smaller");
}
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) CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) AuthoringEnvPage(org.olat.selenium.page.repository.AuthoringEnvPage) NavigationPage(org.olat.selenium.page.NavigationPage) DialogPage(org.olat.selenium.page.course.DialogPage) MembersPage(org.olat.selenium.page.course.MembersPage) File(java.io.File) DialogConfigurationPage(org.olat.selenium.page.course.DialogConfigurationPage) 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