Search in sources :

Example 1 with BindersPage

use of org.olat.selenium.page.portfolio.BindersPage in project OpenOLAT by OpenOLAT.

the class PortfolioV2Test method deleteBinder.

/**
 * A user create a binder with section and pages, move it to
 * the trash. Then it goes to the trash restore it. Return to
 * the list of binders, move the binder again to the trash and
 * goes there to delete it definitively.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void deleteBinder(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createRandomUser("rei");
    loginPage.loginAs(author.getLogin(), author.getPassword()).resume();
    UserToolsPage userTools = new UserToolsPage(browser);
    PortfolioV2HomePage portfolio = userTools.openUserToolsMenu().openPortfolioV2();
    String binderTitle = "Binder ephemere " + UUID.randomUUID();
    BindersPage myBinders = portfolio.openMyBinders();
    BinderPage binder = myBinders.createBinder(binderTitle, "A binder that I want to delete");
    String sectionTitle = "Section one " + UUID.randomUUID();
    binder.selectEntries().createSection(sectionTitle).assertOnSectionTitleInEntries(sectionTitle);
    for (int i = 1; i < 3; i++) {
        String pageTitle = "Page " + i;
        binder.createEntry(pageTitle).assertOnPage(pageTitle).selectEntries();
    }
    binder.selectTableOfContent().selectEntryInToc("Page 1");
    // reload the binder
    portfolio.clickToolbarBack().clickToolbarBack();
    myBinders.selectBinder(binderTitle);
    // move the binder to the trash
    binder.assertOnPageInToc("Page 1").moveBinderToTrash();
    // go in the trash to restore it
    portfolio.clickToolbarBack().openDeletedBinders().switchTableView().restoreBinder(binderTitle);
    // move it to the trash again
    portfolio.clickToolbarBack().openMyBinders().selectBinder(binderTitle).moveBinderToTrash();
    // go to the trash to delete it definitively
    portfolio.clickToolbarBack().openDeletedBinders().selectBinderInTableView(binderTitle).assertOnPageInToc("Page 2").deleteBinder().assertEmptyTableView();
}
Also used : UserToolsPage(org.olat.selenium.page.user.UserToolsPage) BindersPage(org.olat.selenium.page.portfolio.BindersPage) UserVO(org.olat.user.restapi.UserVO) PortfolioV2HomePage(org.olat.selenium.page.portfolio.PortfolioV2HomePage) UserRestClient(org.olat.test.rest.UserRestClient) BinderPage(org.olat.selenium.page.portfolio.BinderPage) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 2 with BindersPage

use of org.olat.selenium.page.portfolio.BindersPage in project openolat by klemens.

the class PortfolioV2Test method deleteBinder.

/**
 * A user create a binder with section and pages, move it to
 * the trash. Then it goes to the trash restore it. Return to
 * the list of binders, move the binder again to the trash and
 * goes there to delete it definitively.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void deleteBinder(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createRandomUser("rei");
    loginPage.loginAs(author.getLogin(), author.getPassword()).resume();
    UserToolsPage userTools = new UserToolsPage(browser);
    PortfolioV2HomePage portfolio = userTools.openUserToolsMenu().openPortfolioV2();
    String binderTitle = "Binder ephemere " + UUID.randomUUID();
    BindersPage myBinders = portfolio.openMyBinders();
    BinderPage binder = myBinders.createBinder(binderTitle, "A binder that I want to delete");
    String sectionTitle = "Section one " + UUID.randomUUID();
    binder.selectEntries().createSection(sectionTitle).assertOnSectionTitleInEntries(sectionTitle);
    for (int i = 1; i < 3; i++) {
        String pageTitle = "Page " + i;
        binder.createEntry(pageTitle).assertOnPage(pageTitle).selectEntries();
    }
    binder.selectTableOfContent().selectEntryInToc("Page 1");
    // reload the binder
    portfolio.clickToolbarBack().clickToolbarBack();
    myBinders.selectBinder(binderTitle);
    // move the binder to the trash
    binder.assertOnPageInToc("Page 1").moveBinderToTrash();
    // go in the trash to restore it
    portfolio.clickToolbarBack().openDeletedBinders().switchTableView().restoreBinder(binderTitle);
    // move it to the trash again
    portfolio.clickToolbarBack().openMyBinders().selectBinder(binderTitle).moveBinderToTrash();
    // go to the trash to delete it definitively
    portfolio.clickToolbarBack().openDeletedBinders().selectBinderInTableView(binderTitle).assertOnPageInToc("Page 2").deleteBinder().assertEmptyTableView();
}
Also used : UserToolsPage(org.olat.selenium.page.user.UserToolsPage) BindersPage(org.olat.selenium.page.portfolio.BindersPage) UserVO(org.olat.user.restapi.UserVO) PortfolioV2HomePage(org.olat.selenium.page.portfolio.PortfolioV2HomePage) UserRestClient(org.olat.test.rest.UserRestClient) BinderPage(org.olat.selenium.page.portfolio.BinderPage) 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 BinderPage (org.olat.selenium.page.portfolio.BinderPage)2 BindersPage (org.olat.selenium.page.portfolio.BindersPage)2 PortfolioV2HomePage (org.olat.selenium.page.portfolio.PortfolioV2HomePage)2 UserToolsPage (org.olat.selenium.page.user.UserToolsPage)2 UserRestClient (org.olat.test.rest.UserRestClient)2 UserVO (org.olat.user.restapi.UserVO)2