Search in sources :

Example 1 with EntriesPage

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

the class PortfolioV2Test method deletePage.

/**
 * A user create a binder with a section and two pages. It deletes
 * one, go to the trash, find the delete page, restore it and go
 * again in the binder. It move a second time the page to the trash
 * and delete it definitively.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void deletePage(@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 del " + UUID.randomUUID();
    BinderPage binder = portfolio.openMyBinders().createBinder(binderTitle, "A binder where I want to delete some pages");
    String sectionTitle = "Section one " + UUID.randomUUID();
    binder.selectEntries().createSection(sectionTitle).assertOnSectionTitleInEntries(sectionTitle);
    String pageTitle = "Page two " + UUID.randomUUID();
    String pageToDelete = "Page del " + UUID.randomUUID();
    binder.createEntry(pageToDelete).assertOnPage(pageToDelete).selectEntries().createEntry(pageTitle).assertOnPage(pageTitle).selectTableOfContent().selectEntryInToc(pageToDelete).moveEntryToTrash().assertOnPageInToc(pageTitle).assertOnPageNotInToc(pageToDelete);
    EntriesPage trash = portfolio.clickToolbarBack().clickToolbarBack().openDeletedEntries();
    trash.assertOnPage(pageToDelete).switchTableView().restore(pageToDelete, binderTitle, sectionTitle);
    portfolio.clickToolbarBack().openMyBinders().selectBinder(binderTitle).assertOnPageInToc(pageToDelete).selectEntryInToc(pageToDelete).moveEntryToTrash();
    trash = portfolio.clickToolbarBack().clickToolbarBack().openDeletedEntries();
    trash.switchTableView().assertOnPageTableView(pageToDelete).switchTableView().selectPageInTableView(pageToDelete).deleteEntry().assertEmptyTableView();
}
Also used : UserToolsPage(org.olat.selenium.page.user.UserToolsPage) EntriesPage(org.olat.selenium.page.portfolio.EntriesPage) 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 EntriesPage

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

the class PortfolioV2Test method deletePage.

/**
 * A user create a binder with a section and two pages. It deletes
 * one, go to the trash, find the delete page, restore it and go
 * again in the binder. It move a second time the page to the trash
 * and delete it definitively.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void deletePage(@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 del " + UUID.randomUUID();
    BinderPage binder = portfolio.openMyBinders().createBinder(binderTitle, "A binder where I want to delete some pages");
    String sectionTitle = "Section one " + UUID.randomUUID();
    binder.selectEntries().createSection(sectionTitle).assertOnSectionTitleInEntries(sectionTitle);
    String pageTitle = "Page two " + UUID.randomUUID();
    String pageToDelete = "Page del " + UUID.randomUUID();
    binder.createEntry(pageToDelete).assertOnPage(pageToDelete).selectEntries().createEntry(pageTitle).assertOnPage(pageTitle).selectTableOfContent().selectEntryInToc(pageToDelete).moveEntryToTrash().assertOnPageInToc(pageTitle).assertOnPageNotInToc(pageToDelete);
    EntriesPage trash = portfolio.clickToolbarBack().clickToolbarBack().openDeletedEntries();
    trash.assertOnPage(pageToDelete).switchTableView().restore(pageToDelete, binderTitle, sectionTitle);
    portfolio.clickToolbarBack().openMyBinders().selectBinder(binderTitle).assertOnPageInToc(pageToDelete).selectEntryInToc(pageToDelete).moveEntryToTrash();
    trash = portfolio.clickToolbarBack().clickToolbarBack().openDeletedEntries();
    trash.switchTableView().assertOnPageTableView(pageToDelete).switchTableView().selectPageInTableView(pageToDelete).deleteEntry().assertEmptyTableView();
}
Also used : UserToolsPage(org.olat.selenium.page.user.UserToolsPage) EntriesPage(org.olat.selenium.page.portfolio.EntriesPage) 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 EntriesPage (org.olat.selenium.page.portfolio.EntriesPage)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