Search in sources :

Example 1 with ParticipantFolderPage

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

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 2 with ParticipantFolderPage

use of org.olat.selenium.page.course.ParticipantFolderPage 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)

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 FolderPage (org.olat.selenium.page.core.FolderPage)2 CourseEditorPageFragment (org.olat.selenium.page.course.CourseEditorPageFragment)2 CoursePageFragment (org.olat.selenium.page.course.CoursePageFragment)2 MembersPage (org.olat.selenium.page.course.MembersPage)2 ParticipantFolderPage (org.olat.selenium.page.course.ParticipantFolderPage)2 AuthoringEnvPage (org.olat.selenium.page.repository.AuthoringEnvPage)2 UserRestClient (org.olat.test.rest.UserRestClient)2 UserVO (org.olat.user.restapi.UserVO)2