Search in sources :

Example 1 with AdministrationPage

use of org.olat.selenium.page.core.AdministrationPage in project OpenOLAT by OpenOLAT.

the class BusinessGroupTest method confirmMembershipByGroup.

/**
 * First, an administrator make in administration part
 * the confirmation of group's membership mandatory if
 * the group is created by a standard user.<br>
 *
 * A standard user create a group and add a participant.
 * The participant log-in and confirm its membership and
 * visit the group.<br>
 *
 * A first user log in, confirm the membership and search
 * the group.<br>
 *
 * A second user log in but with a rest url to the group
 * and jump to the group after confirming the membership.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void confirmMembershipByGroup(@InitialPage LoginPage loginPage, @Drone @User WebDriver ryomouBrowser, @Drone @Participant WebDriver participantBrowser, @Drone @Student WebDriver reiBrowser) throws IOException, URISyntaxException {
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
    UserVO participant = new UserRestClient(deploymentUrl).createRandomUser();
    // admin make the confirmation of membership mandatory
    // for groups created by standard users.
    loginPage.loginAs("administrator", "openolat").resume();
    AdministrationPage administration = new NavigationPage(browser).openAdministration().openGroupSettings().setGroupConfirmationForUser(true);
    // a standard user create a group
    LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl);
    ryomouLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
    // go to groups
    String groupName = "Group-1-" + UUID.randomUUID();
    NavigationPage rymouNavBar = new NavigationPage(ryomouBrowser);
    GroupPage group = rymouNavBar.openGroups(ryomouBrowser).createGroup(groupName, "Confirmation group");
    String groupUrl = group.openAdministration().getGroupURL();
    group.openAdminMembers().addMember().searchMember(participant, false).nextUsers().nextOverview().nextPermissions().finish();
    group.addMember().searchMember(rei, false).nextUsers().nextOverview().nextPermissions().finish();
    // participant login
    LoginPage participantLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    participantLoginPage.loginAs(participant.getLogin(), participant.getPassword()).assertOnMembershipConfirmation().confirmMembership();
    NavigationPage participantNavBar = new NavigationPage(participantBrowser);
    participantNavBar.openGroups(participantBrowser).selectGroup(groupName).assertOnInfosPage(groupName);
    // second participant log in with rest url
    reiBrowser.get(groupUrl);
    new LoginPage(reiBrowser).loginAs(rei.getLogin(), rei.getPassword()).assertOnMembershipConfirmation().confirmMembership();
    NavigationPage reiNavBar = new NavigationPage(reiBrowser);
    reiNavBar.openGroups(reiBrowser).selectGroup(groupName).assertOnInfosPage(groupName);
    // reset the settings
    administration.setGroupConfirmationForUser(false);
}
Also used : AdministrationPage(org.olat.selenium.page.core.AdministrationPage) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) GroupPage(org.olat.selenium.page.group.GroupPage) 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 2 with AdministrationPage

use of org.olat.selenium.page.core.AdministrationPage in project OpenOLAT by OpenOLAT.

the class CourseTest method confirmMembershipForCourse.

/**
 *  First, an administrator make in administration part
 * the confirmation of group's membership mandatory if
 * the group is created by an author.<br>
 *
 * An author create a course and a group and add two
 * participants. The first user jump to the course
 * with a rest url, log in, confirm its membership
 * and see the course.<br>
 * The second participant log-in, confirm its membership,
 * go the "My courses" and visit the course.
 *
 * @param loginPage
 * @param authorBrowser
 * @param participantBrowser
 * @param reiBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void confirmMembershipForCourse(@InitialPage LoginPage loginPage, @Drone @Author WebDriver authorBrowser, @Drone @Participant WebDriver participantBrowser, @Drone @Student WebDriver reiBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
    UserVO participant = new UserRestClient(deploymentUrl).createRandomUser();
    // admin make the confirmation of membership mandatory
    // for groups created by standard users.
    loginPage.loginAs("administrator", "openolat").resume();
    AdministrationPage administration = new NavigationPage(browser).openAdministration().openGroupSettings().setGroupConfirmationForAuthor(true);
    // author create a course
    String courseTitle = "Membership " + UUID.randomUUID();
    LoginPage.getLoginPage(authorBrowser, deploymentUrl).loginAs(author).resume();
    NavigationPage authorNavBar = new NavigationPage(authorBrowser);
    authorNavBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    String groupName = "Groupship " + UUID.randomUUID();
    MembersPage members = CoursePageFragment.getCourse(authorBrowser).members();
    // create a group
    members.selectBusinessGroups().createBusinessGroup(groupName, "-", 1, false, false);
    // return to course
    authorNavBar.openCourse(courseTitle);
    // add the 2 participants to the group
    members.selectMembers().addMember().searchMember(rei, true).nextUsers().nextOverview().selectGroupAsParticipant(groupName).nextPermissions().finish();
    members.addMember().searchMember(participant, true).nextUsers().nextOverview().selectGroupAsParticipant(groupName).nextPermissions().finish();
    members.clickToolbarBack();
    // set the course for members only
    CoursePageFragment.getCourse(authorBrowser).accessConfiguration().setUserAccess(UserAccess.registred);
    String currentUrl = authorBrowser.getCurrentUrl();
    int index = currentUrl.indexOf("/Access");
    Assert.assertTrue(index > 0);
    String courseUrl = currentUrl.substring(0, index);
    // rest url -> login -> accept membership
    reiBrowser.get(courseUrl);
    new LoginPage(reiBrowser).loginAs(rei.getLogin(), rei.getPassword()).assertOnMembershipConfirmation().confirmMembership();
    new CoursePageFragment(reiBrowser).assertOnCoursePage().assertOnTitle(courseTitle);
    // participant login -> accept membership -> my courses -> course
    LoginPage participantLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    participantLoginPage.loginAs(participant.getLogin(), participant.getPassword()).assertOnMembershipConfirmation().confirmMembership();
    NavigationPage participantNavBar = new NavigationPage(participantBrowser);
    participantNavBar.openMyCourses().select(courseTitle);
    new CoursePageFragment(participantBrowser).assertOnCoursePage().assertOnTitle(courseTitle);
    // reset the settings
    administration.setGroupConfirmationForAuthor(false);
}
Also used : AdministrationPage(org.olat.selenium.page.core.AdministrationPage) 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) 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 3 with AdministrationPage

use of org.olat.selenium.page.core.AdministrationPage in project openolat by klemens.

the class CourseTest method confirmMembershipForCourse.

/**
 *  First, an administrator make in administration part
 * the confirmation of group's membership mandatory if
 * the group is created by an author.<br>
 *
 * An author create a course and a group and add two
 * participants. The first user jump to the course
 * with a rest url, log in, confirm its membership
 * and see the course.<br>
 * The second participant log-in, confirm its membership,
 * go the "My courses" and visit the course.
 *
 * @param loginPage
 * @param authorBrowser
 * @param participantBrowser
 * @param reiBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void confirmMembershipForCourse(@InitialPage LoginPage loginPage, @Drone @Author WebDriver authorBrowser, @Drone @Participant WebDriver participantBrowser, @Drone @Student WebDriver reiBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
    UserVO participant = new UserRestClient(deploymentUrl).createRandomUser();
    // admin make the confirmation of membership mandatory
    // for groups created by standard users.
    loginPage.loginAs("administrator", "openolat").resume();
    AdministrationPage administration = new NavigationPage(browser).openAdministration().openGroupSettings().setGroupConfirmationForAuthor(true);
    // author create a course
    String courseTitle = "Membership " + UUID.randomUUID();
    LoginPage.getLoginPage(authorBrowser, deploymentUrl).loginAs(author).resume();
    NavigationPage authorNavBar = new NavigationPage(authorBrowser);
    authorNavBar.openAuthoringEnvironment().createCourse(courseTitle).clickToolbarBack();
    String groupName = "Groupship " + UUID.randomUUID();
    MembersPage members = CoursePageFragment.getCourse(authorBrowser).members();
    // create a group
    members.selectBusinessGroups().createBusinessGroup(groupName, "-", 1, false, false);
    // return to course
    authorNavBar.openCourse(courseTitle);
    // add the 2 participants to the group
    members.selectMembers().addMember().searchMember(rei, true).nextUsers().nextOverview().selectGroupAsParticipant(groupName).nextPermissions().finish();
    members.addMember().searchMember(participant, true).nextUsers().nextOverview().selectGroupAsParticipant(groupName).nextPermissions().finish();
    members.clickToolbarBack();
    // set the course for members only
    CoursePageFragment.getCourse(authorBrowser).accessConfiguration().setUserAccess(UserAccess.registred);
    String currentUrl = authorBrowser.getCurrentUrl();
    int index = currentUrl.indexOf("/Access");
    Assert.assertTrue(index > 0);
    String courseUrl = currentUrl.substring(0, index);
    // rest url -> login -> accept membership
    reiBrowser.get(courseUrl);
    new LoginPage(reiBrowser).loginAs(rei.getLogin(), rei.getPassword()).assertOnMembershipConfirmation().confirmMembership();
    new CoursePageFragment(reiBrowser).assertOnCoursePage().assertOnTitle(courseTitle);
    // participant login -> accept membership -> my courses -> course
    LoginPage participantLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    participantLoginPage.loginAs(participant.getLogin(), participant.getPassword()).assertOnMembershipConfirmation().confirmMembership();
    NavigationPage participantNavBar = new NavigationPage(participantBrowser);
    participantNavBar.openMyCourses().select(courseTitle);
    new CoursePageFragment(participantBrowser).assertOnCoursePage().assertOnTitle(courseTitle);
    // reset the settings
    administration.setGroupConfirmationForAuthor(false);
}
Also used : AdministrationPage(org.olat.selenium.page.core.AdministrationPage) 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) 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 4 with AdministrationPage

use of org.olat.selenium.page.core.AdministrationPage in project openolat by klemens.

the class BusinessGroupTest method confirmMembershipByGroup.

/**
 * First, an administrator make in administration part
 * the confirmation of group's membership mandatory if
 * the group is created by a standard user.<br>
 *
 * A standard user create a group and add a participant.
 * The participant log-in and confirm its membership and
 * visit the group.<br>
 *
 * A first user log in, confirm the membership and search
 * the group.<br>
 *
 * A second user log in but with a rest url to the group
 * and jump to the group after confirming the membership.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void confirmMembershipByGroup(@InitialPage LoginPage loginPage, @Drone @User WebDriver ryomouBrowser, @Drone @Participant WebDriver participantBrowser, @Drone @Student WebDriver reiBrowser) throws IOException, URISyntaxException {
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    UserVO rei = new UserRestClient(deploymentUrl).createRandomUser("Rei");
    UserVO participant = new UserRestClient(deploymentUrl).createRandomUser();
    // admin make the confirmation of membership mandatory
    // for groups created by standard users.
    loginPage.loginAs("administrator", "openolat").resume();
    AdministrationPage administration = new NavigationPage(browser).openAdministration().openGroupSettings().setGroupConfirmationForUser(true);
    // a standard user create a group
    LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl);
    ryomouLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
    // go to groups
    String groupName = "Group-1-" + UUID.randomUUID();
    NavigationPage rymouNavBar = new NavigationPage(ryomouBrowser);
    GroupPage group = rymouNavBar.openGroups(ryomouBrowser).createGroup(groupName, "Confirmation group");
    String groupUrl = group.openAdministration().getGroupURL();
    group.openAdminMembers().addMember().searchMember(participant, false).nextUsers().nextOverview().nextPermissions().finish();
    group.addMember().searchMember(rei, false).nextUsers().nextOverview().nextPermissions().finish();
    // participant login
    LoginPage participantLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    participantLoginPage.loginAs(participant.getLogin(), participant.getPassword()).assertOnMembershipConfirmation().confirmMembership();
    NavigationPage participantNavBar = new NavigationPage(participantBrowser);
    participantNavBar.openGroups(participantBrowser).selectGroup(groupName).assertOnInfosPage(groupName);
    // second participant log in with rest url
    reiBrowser.get(groupUrl);
    new LoginPage(reiBrowser).loginAs(rei.getLogin(), rei.getPassword()).assertOnMembershipConfirmation().confirmMembership();
    NavigationPage reiNavBar = new NavigationPage(reiBrowser);
    reiNavBar.openGroups(reiBrowser).selectGroup(groupName).assertOnInfosPage(groupName);
    // reset the settings
    administration.setGroupConfirmationForUser(false);
}
Also used : AdministrationPage(org.olat.selenium.page.core.AdministrationPage) UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) GroupPage(org.olat.selenium.page.group.GroupPage) LoginPage(org.olat.selenium.page.LoginPage) 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)4 Test (org.junit.Test)4 LoginPage (org.olat.selenium.page.LoginPage)4 NavigationPage (org.olat.selenium.page.NavigationPage)4 AdministrationPage (org.olat.selenium.page.core.AdministrationPage)4 UserRestClient (org.olat.test.rest.UserRestClient)4 UserVO (org.olat.user.restapi.UserVO)4 CoursePageFragment (org.olat.selenium.page.course.CoursePageFragment)2 MembersPage (org.olat.selenium.page.course.MembersPage)2 GroupPage (org.olat.selenium.page.group.GroupPage)2