Search in sources :

Example 1 with BookingPage

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

the class CourseTest method courseBooking.

/**
 * An author creates a course, make it visible for
 * members and add an access control by password.
 * The user search for the course, books it and give
 * the password.<br/>
 * The author checks in the list of orders if the booking
 * of the user is there and after it checks if the user is
 * in the member list too.
 *
 * @param loginPage
 * @param ryomouBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void courseBooking(@InitialPage LoginPage loginPage, @Drone @User WebDriver ryomouBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    loginPage.loginAs(author.getLogin(), author.getPassword());
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    // go to authoring
    AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
    String title = "Create-Selen-" + UUID.randomUUID().toString();
    // create course
    authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab();
    // open course editor
    CoursePageFragment course = new CoursePageFragment(browser);
    RepositoryAccessPage courseAccess = course.openToolsMenu().edit().createNode("info").autoPublish().accessConfiguration().setUserAccess(UserAccess.registred);
    // add booking by secret token
    courseAccess.boooking().openAddDropMenu().addTokenMethod().configureTokenMethod("secret", "The password is secret");
    courseAccess.clickToolbarBack();
    // a user search the course
    LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl);
    ryomouLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
    NavigationPage ryomouNavBar = new NavigationPage(ryomouBrowser);
    ryomouNavBar.openMyCourses().openSearch().extendedSearch(title).book(title);
    // book the course
    BookingPage booking = new BookingPage(ryomouBrowser);
    booking.bookToken("secret");
    // check the course
    CoursePageFragment bookedCourse = CoursePageFragment.getCourse(ryomouBrowser);
    bookedCourse.assertOnTitle(title);
    // Author go in the list of bookings of the course
    BookingPage bookingList = course.openToolsMenu().bookingTool();
    bookingList.assertFirstNameInListIsOk(ryomou);
    // Author go to members list
    course.members().assertFirstNameInList(ryomou);
}
Also used : UserVO(org.olat.user.restapi.UserVO) AuthoringEnvPage(org.olat.selenium.page.repository.AuthoringEnvPage) NavigationPage(org.olat.selenium.page.NavigationPage) BookingPage(org.olat.selenium.page.core.BookingPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) RepositoryAccessPage(org.olat.selenium.page.repository.RepositoryAccessPage) 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 BookingPage

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

the class RepositoryAccessPage method boooking.

public BookingPage boooking() {
    By bookingFieldsetBy = By.cssSelector("fieldset.o_ac_configuration");
    List<WebElement> bookingFieldsetEls = browser.findElements(bookingFieldsetBy);
    Assert.assertEquals(1, bookingFieldsetEls.size());
    return new BookingPage(browser);
}
Also used : BookingPage(org.olat.selenium.page.core.BookingPage) By(org.openqa.selenium.By) WebElement(org.openqa.selenium.WebElement)

Example 3 with BookingPage

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

the class GroupsPage method bookGroup.

/**
 * Click on the book link
 *
 * @param name
 * @return
 */
public BookingPage bookGroup(String name) {
    By rowBy = By.cssSelector("div.o_table_wrapper tr");
    By colBy = By.cssSelector("td a");
    WebElement groupLink = null;
    List<WebElement> rows = browser.findElements(rowBy);
    for (WebElement row : rows) {
        if (row.getText().contains(name)) {
            // take the last link of the row
            List<WebElement> links = row.findElements(colBy);
            if (links.size() > 0) {
                groupLink = links.get(links.size() - 1);
            }
        }
    }
    Assert.assertNotNull(groupLink);
    groupLink.click();
    OOGraphene.waitBusy(browser);
    By tokenEntryBy = By.className("o_sel_accesscontrol_token_entry");
    OOGraphene.waitElement(tokenEntryBy, browser);
    return new BookingPage(browser);
}
Also used : BookingPage(org.olat.selenium.page.core.BookingPage) By(org.openqa.selenium.By) WebElement(org.openqa.selenium.WebElement)

Example 4 with BookingPage

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

the class CourseTest method courseBooking.

/**
 * An author creates a course, make it visible for
 * members and add an access control by password.
 * The user search for the course, books it and give
 * the password.<br/>
 * The author checks in the list of orders if the booking
 * of the user is there and after it checks if the user is
 * in the member list too.
 *
 * @param loginPage
 * @param ryomouBrowser
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void courseBooking(@InitialPage LoginPage loginPage, @Drone @User WebDriver ryomouBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    loginPage.loginAs(author.getLogin(), author.getPassword());
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    // go to authoring
    AuthoringEnvPage authoringEnv = navBar.assertOnNavigationPage().openAuthoringEnvironment();
    String title = "Create-Selen-" + UUID.randomUUID().toString();
    // create course
    authoringEnv.openCreateDropDown().clickCreate(ResourceType.course).fillCreateForm(title).assertOnGeneralTab();
    // open course editor
    CoursePageFragment course = new CoursePageFragment(browser);
    RepositoryAccessPage courseAccess = course.openToolsMenu().edit().createNode("info").autoPublish().accessConfiguration().setUserAccess(UserAccess.registred);
    // add booking by secret token
    courseAccess.boooking().openAddDropMenu().addTokenMethod().configureTokenMethod("secret", "The password is secret");
    courseAccess.clickToolbarBack();
    // a user search the course
    LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl);
    ryomouLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
    NavigationPage ryomouNavBar = new NavigationPage(ryomouBrowser);
    ryomouNavBar.openMyCourses().openSearch().extendedSearch(title).book(title);
    // book the course
    BookingPage booking = new BookingPage(ryomouBrowser);
    booking.bookToken("secret");
    // check the course
    CoursePageFragment bookedCourse = CoursePageFragment.getCourse(ryomouBrowser);
    bookedCourse.assertOnTitle(title);
    // Author go in the list of bookings of the course
    BookingPage bookingList = course.openToolsMenu().bookingTool();
    bookingList.assertFirstNameInListIsOk(ryomou);
    // Author go to members list
    course.members().assertFirstNameInList(ryomou);
}
Also used : UserVO(org.olat.user.restapi.UserVO) AuthoringEnvPage(org.olat.selenium.page.repository.AuthoringEnvPage) NavigationPage(org.olat.selenium.page.NavigationPage) BookingPage(org.olat.selenium.page.core.BookingPage) CoursePageFragment(org.olat.selenium.page.course.CoursePageFragment) RepositoryAccessPage(org.olat.selenium.page.repository.RepositoryAccessPage) 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 5 with BookingPage

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

the class RepositoryAccessPage method boooking.

public BookingPage boooking() {
    By bookingFieldsetBy = By.cssSelector("fieldset.o_ac_configuration");
    List<WebElement> bookingFieldsetEls = browser.findElements(bookingFieldsetBy);
    Assert.assertEquals(1, bookingFieldsetEls.size());
    return new BookingPage(browser);
}
Also used : BookingPage(org.olat.selenium.page.core.BookingPage) By(org.openqa.selenium.By) WebElement(org.openqa.selenium.WebElement)

Aggregations

BookingPage (org.olat.selenium.page.core.BookingPage)6 By (org.openqa.selenium.By)4 WebElement (org.openqa.selenium.WebElement)4 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 CoursePageFragment (org.olat.selenium.page.course.CoursePageFragment)2 AuthoringEnvPage (org.olat.selenium.page.repository.AuthoringEnvPage)2 RepositoryAccessPage (org.olat.selenium.page.repository.RepositoryAccessPage)2 UserRestClient (org.olat.test.rest.UserRestClient)2 UserVO (org.olat.user.restapi.UserVO)2