Search in sources :

Example 6 with UserRestClient

use of org.olat.test.rest.UserRestClient in project OpenOLAT by OpenOLAT.

the class UserTest method userChangeItsPassword.

/**
 * Change the password, log out and try to log in again
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void userChangeItsPassword(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    UserVO user = new UserRestClient(deploymentUrl).createRandomUser();
    loginPage.loginAs(user.getLogin(), user.getPassword()).resume();
    UserToolsPage userTools = new UserToolsPage(browser);
    userTools.openUserToolsMenu().openPassword();
    String newPassword = UUID.randomUUID().toString();
    UserPasswordPage password = UserPasswordPage.getUserPasswordPage(browser);
    password.setNewPassword(user.getPassword(), newPassword);
    userTools.logout();
    loginPage.loginAs(user.getLogin(), newPassword).resume().assertLoggedIn(user);
}
Also used : UserToolsPage(org.olat.selenium.page.user.UserToolsPage) UserVO(org.olat.user.restapi.UserVO) UserPasswordPage(org.olat.selenium.page.user.UserPasswordPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 7 with UserRestClient

use of org.olat.test.rest.UserRestClient in project OpenOLAT by OpenOLAT.

the class BusinessGroupTest method createGroupWithWaitingList.

/**
 * An author creates a group, it opens the tab groups and then "My groups". It
 * creates a group, enters a number of participants "1", enable the waiting
 * list. In members visibility, it see coaches, participants and waiting
 * list visible to members.<br>
 * A participant and than a student come, book the group. The first enters
 * the group, the second the waiting list.<br>
 * The author go in the members list to check if it's in the coach list,
 * the participant in the participants list and the student in the waiting
 * list.
 *
 * Should show group starting page, with menu items Administration and Bookings visible
 *
 * @param loginPage
 * @param participantBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void createGroupWithWaitingList(@InitialPage LoginPage loginPage, @Drone @Participant WebDriver participantBrowser, @Drone @Student WebDriver studentBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createRandomUser("Selena");
    UserVO participant = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    UserVO student = new UserRestClient(deploymentUrl).createRandomUser("Asuka");
    loginPage.loginAs(author.getLogin(), author.getPassword()).resume();
    // go to groups
    String groupName = "Group-1-" + UUID.randomUUID();
    GroupPage group = navBar.openGroups(browser).createGroup(groupName, "A group with a waiting list").openAdministration().openEditDetails().setMaxNumberOfParticipants(1).setWaitingList().saveDetails();
    // add booking ( token one )
    String token = "secret";
    String description = "The password is secret";
    group.openBookingConfig().openAddDropMenu().addTokenMethod().configureTokenMethod(token, description).assertOnToken(token);
    // members see members
    group = GroupPage.getGroup(browser).openAdminMembers().setVisibility(true, true, true).openMembers();
    // participant search published groups
    LoginPage participantLoginPage = LoginPage.getLoginPage(participantBrowser, deploymentUrl);
    // tools
    participantLoginPage.loginAs(participant.getLogin(), participant.getPassword()).resume();
    // groups
    NavigationPage participantNavBar = new NavigationPage(participantBrowser);
    participantNavBar.openGroups(participantBrowser).publishedGroups().bookGroup(groupName).bookToken(token);
    // are we that we are in the right group?
    GroupPage.getGroup(participantBrowser).assertOnInfosPage(groupName);
    // student search published groups
    LoginPage studentLoginPage = LoginPage.getLoginPage(studentBrowser, deploymentUrl);
    // tools
    studentLoginPage.loginAs(student.getLogin(), student.getPassword()).resume();
    // groups
    NavigationPage studentNavBar = new NavigationPage(studentBrowser);
    studentNavBar.openGroups(studentBrowser).publishedGroups().bookGroup(groupName).bookToken(token);
    // are we that we are in the right group?
    GroupPage.getGroup(studentBrowser).assertOnWaitingList(groupName);
    group = GroupPage.getGroup(browser).openMembers().assertMembersInOwnerList(author).assertMembersInParticipantList(participant).assertMembersInWaitingList(student);
}
Also used : 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 8 with UserRestClient

use of org.olat.test.rest.UserRestClient in project OpenOLAT by OpenOLAT.

the class BusinessGroupTest method groupCalendar_recurringEvent.

/**
 * A coach create a group, enable the calendar, create a recurring event
 * and save it. Reopen it, edit it and save it, confirm that it will
 * only change a single occurence of the recurring event. After change
 * the begin and end hour of all others events.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void groupCalendar_recurringEvent(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    UserVO coach = new UserRestClient(deploymentUrl).createAuthor();
    loginPage.loginAs(coach.getLogin(), coach.getPassword()).resume();
    // go to groups
    String groupName = "iCal-2-" + UUID.randomUUID();
    GroupPage group = navBar.openGroups(browser).createGroup(groupName, "Calendar with a recurring event");
    group.openAdministration().openAdminTools().enableCalendarTool();
    int startdDate = 2;
    // add an event to the calendar
    CalendarPage calendar = group.openCalendar().assertOnCalendar().addEvent(startdDate).setDescription("Recurring", "Very important event 4-5 times", "In the way").setAllDay(false).setBeginEnd(10, 11).setRecurringEvent(KalendarEvent.WEEKLY, 28).save().assertOnEvents("Recurring", 4);
    // pick an occurence of the recurring event and modify it
    calendar.openDetailsOccurence("Recurring", 9).edit().setDescription("Special", null, null).save().confirmModifyOneOccurence().assertOnEvents("Special", 1).assertOnEvents("Recurring", 3);
    // pick the first occurence and change all events but the modified above
    calendar.openDetailsOccurence("Recurring", 2).edit().setBeginEnd(11, 12).assertOnEvents("Special", 1).save().confirmModifyAllOccurences().assertOnEventsAt("Recurring", 3, 11);
}
Also used : UserVO(org.olat.user.restapi.UserVO) GroupPage(org.olat.selenium.page.group.GroupPage) CalendarPage(org.olat.selenium.page.core.CalendarPage) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 9 with UserRestClient

use of org.olat.test.rest.UserRestClient in project OpenOLAT by OpenOLAT.

the class BusinessGroupTest method enrollment.

/**
 * An author create a course and a business group in the members
 * management. It has max. participants set to 1 and no waiting list.
 * Than it returns in the course editor to create an enrollment
 * course element. It configure it and select the group created before.<br>
 *
 * Three users goes to the course and try to enroll. One will become
 * a participant, the 2 others get an error message.
 *
 * @param authorLoginPage
 * @param ryomouBrowser
 * @param reiBrowser
 * @param kanuBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void enrollment(@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-2-" + 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 - 2";
    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
    for (Enrollment enrollment : participantDrivers) {
        OOGraphene.waitBusy(enrollment.getDriver());
    }
    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(1, participants);
    Assert.assertEquals(participantDrivers.length - 1, 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 10 with UserRestClient

use of org.olat.test.rest.UserRestClient in project OpenOLAT by OpenOLAT.

the class BusinessGroupTest method groupChat.

/**
 * An author create a group, set the visibility to true for owners
 * and participants, enable the tools and add 2 users to it. The 2
 * users joins the chat. All three send some messages and read them.
 *
 * @param loginPage
 * @param kanuBrowser
 * @param ryomouBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void groupChat(@InitialPage LoginPage loginPage, @Drone @Participant WebDriver kanuBrowser, @Drone @User WebDriver ryomouBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO kanu = new UserRestClient(deploymentUrl).createRandomUser("Kanu");
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    loginPage.loginAs(author.getLogin(), author.getPassword()).resume();
    // go to groups
    String groupName = "Group-Chat-1-" + UUID.randomUUID();
    GroupPage group = navBar.openGroups(browser).createGroup(groupName, "A very little group to chat");
    group.openAdministration().openAdminTools().enableTools().openAdminMembers().setVisibility(true, true, false);
    // add Kanu to the group
    group.openAdminMembers().addMember().searchMember(kanu, true).nextUsers().nextOverview().nextPermissions().finish();
    // add Ryomou
    group.addMember().searchMember(ryomou, true).nextUsers().nextOverview().nextPermissions().finish();
    // Kanu open the group
    LoginPage kanuLoginPage = LoginPage.getLoginPage(kanuBrowser, deploymentUrl);
    kanuLoginPage.loginAs(kanu.getLogin(), kanu.getPassword()).resume();
    NavigationPage kanuNavBar = new NavigationPage(kanuBrowser);
    GroupPage kanuGroup = kanuNavBar.openGroups(kanuBrowser).selectGroup(groupName);
    // Ryomou open the group
    LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl);
    ryomouLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
    NavigationPage ryomouNavBar = new NavigationPage(ryomouBrowser);
    IMPage ryomouIM = ryomouNavBar.openGroups(ryomouBrowser).selectGroup(groupName).openChat().openGroupChat();
    // Author send a message to Kanu
    String msg1 = "Hello Kanu " + UUID.randomUUID();
    IMPage authorIM = group.openChat().openGroupChat().sendMessage(msg1).assertOnMessage(msg1);
    String msg2 = "Hello dear author " + UUID.randomUUID();
    // Kanu opens her chat window
    IMPage kanuIM = kanuGroup.openChat().openGroupChat().assertOnMessage(msg1).sendMessage(msg2);
    String msg3 = "Hello Kanu and author " + UUID.randomUUID();
    // Ryomou reads her messages
    ryomouIM.sendMessage(msg3).assertOnMessage(msg1).assertOnMessage(msg2);
    // Kanu reads her message
    kanuIM.assertOnMessage(msg3);
    // Author reads too
    authorIM.assertOnMessage(msg2).assertOnMessage(msg3);
}
Also used : UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) GroupPage(org.olat.selenium.page.group.GroupPage) IMPage(org.olat.selenium.page.core.IMPage) 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

Test (org.junit.Test)258 UserRestClient (org.olat.test.rest.UserRestClient)258 UserVO (org.olat.user.restapi.UserVO)258 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)254 NavigationPage (org.olat.selenium.page.NavigationPage)110 LoginPage (org.olat.selenium.page.LoginPage)108 CoursePageFragment (org.olat.selenium.page.course.CoursePageFragment)102 QTI21Page (org.olat.selenium.page.qti.QTI21Page)96 URL (java.net.URL)88 File (java.io.File)86 CourseEditorPageFragment (org.olat.selenium.page.course.CourseEditorPageFragment)84 UserToolsPage (org.olat.selenium.page.user.UserToolsPage)62 QTI21EditorPage (org.olat.selenium.page.qti.QTI21EditorPage)46 WebElement (org.openqa.selenium.WebElement)46 MembersPage (org.olat.selenium.page.course.MembersPage)36 AuthoringEnvPage (org.olat.selenium.page.repository.AuthoringEnvPage)34 GroupPage (org.olat.selenium.page.group.GroupPage)22 BinderPage (org.olat.selenium.page.portfolio.BinderPage)12 PortfolioV2HomePage (org.olat.selenium.page.portfolio.PortfolioV2HomePage)12 By (org.openqa.selenium.By)12