Search in sources :

Example 91 with CoursePageFragment

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

the class CourseElementTest method createCourseWithParticipantFolder.

/**
 * An author create a course with a participant folder course
 * element. It add a participant to the course and upload file
 * in the return box of this participant.<br>
 * The participant come in and open the course, see the file
 * uploaded by the author in its return box and it uploads an
 * image in its drop box. The author go the see the image.
 *
 * @param authorLoginPage
 * @param participantBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void createCourseWithParticipantFolder(@InitialPage LoginPage authorLoginPage, @Drone @Participant WebDriver participantBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO participant = 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();
    String participantFolderTitle = "ParticipantList";
    // open course editor
    CoursePageFragment course = CoursePageFragment.getCourse(browser);
    CourseEditorPageFragment editor = course.assertOnCoursePage().assertOnTitle(title).openToolsMenu().edit().createNode("pf").nodeTitle(participantFolderTitle);
    // publish
    editor.publish().quickPublish(UserAccess.membersOnly);
    editor.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();
    // go to the course element
    course.clickTree().selectWithTitle(participantFolderTitle);
    // open the return box of the participant and upload a file
    URL coachImageUrl = JunitTestHelper.class.getResource("file_resources/IMG_1484.jpg");
    File coachImageFile = new File(coachImageUrl.toURI());
    ParticipantFolderPage folder = new ParticipantFolderPage(browser);
    folder.assertOnParticipantsList().assertOnParticipant(participant.getFirstName()).openParticipantFolder(participant.getFirstName());
    FolderPage directory = folder.openReturnBox().uploadFile(coachImageFile).assertOnFile(coachImageFile.getName());
    // 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 participant folder
    CoursePageFragment participantCourse = CoursePageFragment.getCourse(participantBrowser);
    participantCourse.clickTree().selectWithTitle(participantFolderTitle);
    ParticipantFolderPage participantFolder = new ParticipantFolderPage(participantBrowser);
    participantFolder.openReturnBox().assertOnFile(coachImageFile.getName()).selectRootDirectory();
    // Participant upload a file in its drop box
    URL participantImageUrl = JunitTestHelper.class.getResource("file_resources/IMG_1484.jpg");
    File participantImageFile = new File(participantImageUrl.toURI());
    participantFolder.openDropBox().uploadFile(participantImageFile).assertOnFile(participantImageFile.getName());
    // Author check the image in the participant drop box
    directory.selectRootDirectory();
    folder.openDropBox().assertOnFile(participantImageFile.getName());
}
Also used : CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) FolderPage(org.olat.selenium.page.core.FolderPage) ParticipantFolderPage(org.olat.selenium.page.course.ParticipantFolderPage) 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) ParticipantFolderPage(org.olat.selenium.page.course.ParticipantFolderPage) MembersPage(org.olat.selenium.page.course.MembersPage) File(java.io.File) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 92 with CoursePageFragment

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

the class CourseElementTest method blogWithMultipleUsers.

/**
 * An author create a course with a blog, open it, add a post. A student
 * open the course, see the blog post. The author add a new post, the
 * student must see it.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void blogWithMultipleUsers(@InitialPage LoginPage loginPage, @Drone @Participant WebDriver participantDrone) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO participant = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    loginPage.loginAs(author.getLogin(), author.getPassword());
    // create a course with a blog
    String courseTitle = "Course-Blog-1-" + UUID.randomUUID().toString();
    navBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    String blogNodeTitle = "Blog-RW-1";
    String blogTitle = "Blog - RW - " + UUID.randomUUID().toString();
    // create a course element of type blog with a 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);
    String postTitle = "Blog-RW-1-" + UUID.randomUUID();
    String postSummary = "Some explantations as teaser";
    String postContent = "Content of the post";
    FeedPage feed = FeedPage.getFeedPage(browser);
    feed.newBlog().fillPostForm(postTitle, postSummary, postContent).publishPost();
    // participant go to the blog
    participantDrone.navigate().to(deploymentUrl);
    LoginPage participantLogin = LoginPage.getLoginPage(participantDrone, deploymentUrl);
    participantLogin.loginAs(participant.getLogin(), participant.getPassword());
    // search the course in "My courses"
    NavigationPage participantNavigation = new NavigationPage(participantDrone);
    participantNavigation.openMyCourses().openSearch().extendedSearch(courseTitle).select(courseTitle).start();
    // Navigate the course to the blog
    CoursePageFragment participantCourse = new CoursePageFragment(participantDrone);
    participantCourse.clickTree().selectWithTitle(blogNodeTitle);
    FeedPage participantFeed = FeedPage.getFeedPage(participantDrone);
    participantFeed.assertOnBlogPost(postTitle);
    // the author publish a second post in its blog
    String post2Title = "Blog-RW-2-" + UUID.randomUUID();
    String post2Summary = "Some explantations as teaser";
    String post2Content = "Content of the post";
    feed.addBlogPost().fillPostForm(post2Title, post2Summary, post2Content).publishPost();
    // the participant must see the new post after some click
    participantFeed.clickFirstMonthOfPager().assertOnBlogPost(post2Title);
}
Also used : CourseEditorPageFragment(org.olat.selenium.page.course.CourseEditorPageFragment) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) FeedPage(org.olat.selenium.page.repository.FeedPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) 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 93 with CoursePageFragment

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

the class CourseElementTest method createCourseWithInfoMessages.

/**
 * Login, create a course, select "Messages Course", insert an info message
 * course element, publish the course, add messages, count if the messages
 * are there, show older messages, count the messages, show current messages,
 * count the messages, edit a message and delete an other, count the messages.
 *
 * @param authorLoginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void createCourseWithInfoMessages(@InitialPage LoginPage authorLoginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    authorLoginPage.loginAs(author.getLogin(), author.getPassword());
    // go to authoring
    AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
    String title = "Course Msg " + UUID.randomUUID().toString();
    // create course
    authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab().clickToolbarBack();
    String infoNodeTitle = "Infos - News";
    // open course editor
    CoursePageFragment course = CoursePageFragment.getCourse(browser);
    CourseEditorPageFragment editor = course.assertOnCoursePage().assertOnTitle(title).openToolsMenu().edit().createNode("info").nodeTitle(infoNodeTitle);
    // configure the info messages
    InfoMessageCEPage infoMsgConfig = new InfoMessageCEPage(browser);
    infoMsgConfig.selectConfiguration().configure(3);
    // publish
    editor.publish().quickPublish(UserAccess.registred);
    editor.clickToolbarBack();
    course.clickTree().selectWithTitle(infoNodeTitle);
    // set a message
    infoMsgConfig.createMessage().setMessage("Information 0", "A very important info").next().finish().assertOnMessageTitle("Information 0");
    for (int i = 1; i <= 3; i++) {
        infoMsgConfig.quickMessage("Information " + i, "More informations");
    }
    int numOfMessages = infoMsgConfig.countMessages();
    Assert.assertEquals(3, numOfMessages);
    // count old messages
    int numOfOldMessages = infoMsgConfig.oldMessages().countMessages();
    Assert.assertEquals(4, numOfOldMessages);
    // new messages
    infoMsgConfig.newMessages();
    int numOfNewMessages = infoMsgConfig.countMessages();
    Assert.assertEquals(3, numOfNewMessages);
    // edit
    infoMsgConfig.oldMessages();
    infoMsgConfig.editMessage("Information 2").setMessage("The latest information", "A very important info").save().assertOnMessageTitle("The latest information");
    // delete
    infoMsgConfig.deleteMessage("Information 3").confirmDelete();
    int numOfSurvivingMessages = infoMsgConfig.countMessages();
    Assert.assertEquals(3, numOfSurvivingMessages);
}
Also used : 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) InfoMessageCEPage(org.olat.selenium.page.course.InfoMessageCEPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 94 with CoursePageFragment

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

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 95 with CoursePageFragment

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

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

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