Search in sources :

Example 1 with EntryPage

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

the class PortfolioV2Test method editPage.

/**
 * A user create a page / entry, it edit it
 * and add a title, an image, a document
 * and a citation. It toggles between the editor
 * mode and the view mode to check if the parts it
 * add in the page are really there.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void editPage(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    UserVO user = new UserRestClient(deploymentUrl).createRandomUser("rei");
    loginPage.loginAs(user.getLogin(), user.getPassword()).resume();
    UserToolsPage userTools = new UserToolsPage(browser);
    PortfolioV2HomePage portfolio = userTools.openUserToolsMenu().openPortfolioV2();
    String pageTitle = "My page " + UUID.randomUUID();
    EntryPage entry = portfolio.openMyEntries().newPage(pageTitle).assertOnPage(pageTitle);
    // add a title
    String title = "My long title " + UUID.randomUUID();
    entry.addTitle(title).setTitleSize(4).closeEditFragment().assertOnTitle(title, 4);
    // add an image
    URL imageUrl = JunitTestHelper.class.getResource("file_resources/IMG_1484.jpg");
    File imageFile = new File(imageUrl.toURI());
    entry.addImage("Blue is the new black", imageFile).assertOnImage(imageFile);
    // close the editor and check
    entry.toggleEditor().assertOnTitle(title, 4).assertOnImage(imageFile);
    // reopen the editor and add a document
    URL pdfUrl = JunitTestHelper.class.getResource("file_resources/handInTopic1.pdf");
    File pdfFile = new File(pdfUrl.toURI());
    entry.toggleEditor().addDocument("Anything about", pdfFile).assertOnDocument(pdfFile);
    // and a citation
    String citation = "Close the world, open the next.";
    entry.addCitation("Serial experiment", citation).assertOnCitation(citation);
    // close the editor and check all parts
    entry.toggleEditor().assertOnTitle(title, 4).assertOnImage(imageFile).assertOnDocument(pdfFile).assertOnCitation(citation);
}
Also used : UserToolsPage(org.olat.selenium.page.user.UserToolsPage) UserVO(org.olat.user.restapi.UserVO) PortfolioV2HomePage(org.olat.selenium.page.portfolio.PortfolioV2HomePage) EntryPage(org.olat.selenium.page.portfolio.EntryPage) File(java.io.File) URL(java.net.URL) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 2 with EntryPage

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

the class PortfolioV2Test method editPage.

/**
 * A user create a page / entry, it edit it
 * and add a title, an image, a document
 * and a citation. It toggles between the editor
 * mode and the view mode to check if the parts it
 * add in the page are really there.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void editPage(@InitialPage LoginPage loginPage) throws IOException, URISyntaxException {
    UserVO user = new UserRestClient(deploymentUrl).createRandomUser("rei");
    loginPage.loginAs(user.getLogin(), user.getPassword()).resume();
    UserToolsPage userTools = new UserToolsPage(browser);
    PortfolioV2HomePage portfolio = userTools.openUserToolsMenu().openPortfolioV2();
    String pageTitle = "My page " + UUID.randomUUID();
    EntryPage entry = portfolio.openMyEntries().newPage(pageTitle).assertOnPage(pageTitle);
    // add a title
    String title = "My long title " + UUID.randomUUID();
    entry.addTitle(title).setTitleSize(4).closeEditFragment().assertOnTitle(title, 4);
    // add an image
    URL imageUrl = JunitTestHelper.class.getResource("file_resources/IMG_1484.jpg");
    File imageFile = new File(imageUrl.toURI());
    entry.addImage("Blue is the new black", imageFile).assertOnImage(imageFile);
    // close the editor and check
    entry.toggleEditor().assertOnTitle(title, 4).assertOnImage(imageFile);
    // reopen the editor and add a document
    URL pdfUrl = JunitTestHelper.class.getResource("file_resources/handInTopic1.pdf");
    File pdfFile = new File(pdfUrl.toURI());
    entry.toggleEditor().addDocument("Anything about", pdfFile).assertOnDocument(pdfFile);
    // and a citation
    String citation = "Close the world, open the next.";
    entry.addCitation("Serial experiment", citation).assertOnCitation(citation);
    // close the editor and check all parts
    entry.toggleEditor().assertOnTitle(title, 4).assertOnImage(imageFile).assertOnDocument(pdfFile).assertOnCitation(citation);
}
Also used : UserToolsPage(org.olat.selenium.page.user.UserToolsPage) UserVO(org.olat.user.restapi.UserVO) PortfolioV2HomePage(org.olat.selenium.page.portfolio.PortfolioV2HomePage) EntryPage(org.olat.selenium.page.portfolio.EntryPage) File(java.io.File) URL(java.net.URL) UserRestClient(org.olat.test.rest.UserRestClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Aggregations

File (java.io.File)2 URL (java.net.URL)2 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)2 Test (org.junit.Test)2 EntryPage (org.olat.selenium.page.portfolio.EntryPage)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