Search in sources :

Example 1 with MemberListPage

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

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)

Example 2 with MemberListPage

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

RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)2 Test (org.junit.Test)2 CourseEditorPageFragment (org.olat.selenium.page.course.CourseEditorPageFragment)2 CoursePageFragment (org.olat.selenium.page.course.CoursePageFragment)2 MemberListConfigurationPage (org.olat.selenium.page.course.MemberListConfigurationPage)2 MemberListPage (org.olat.selenium.page.course.MemberListPage)2 MembersPage (org.olat.selenium.page.course.MembersPage)2 AuthoringEnvPage (org.olat.selenium.page.repository.AuthoringEnvPage)2 UserRestClient (org.olat.test.rest.UserRestClient)2 UserVO (org.olat.user.restapi.UserVO)2