Search in sources :

Example 1 with CPPage

use of org.olat.selenium.page.repository.CPPage in project OpenOLAT by OpenOLAT.

the class CourseTest method createContentPackage.

/**
 * An author creates a CP, changes the name of a page, import
 * an other page, create two pages and delete one, import an
 * image...<br>
 * A user come to see the CP, check that the deleted page is
 * really deleted and that the "Small HTML page" exists and
 * can be read.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void createContentPackage(@InitialPage LoginPage loginPage, @Drone @User WebDriver ryomouBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    loginPage.loginAs(author.getLogin(), author.getPassword());
    // create a CP
    String cpTitle = "CP " + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCP(cpTitle).clickToolbarBack();
    String firstPage = "Page 1 " + UUID.randomUUID();
    String secondPage = "Seite 2 " + UUID.randomUUID();
    String thirdPage = "Feuillet 3 " + UUID.randomUUID();
    String deletedPage = "To delete 4 " + UUID.randomUUID();
    URL pageUrl = JunitTestHelper.class.getResource("file_resources/page.html");
    File pageFile = new File(pageUrl.toURI());
    URL imageUrl = JunitTestHelper.class.getResource("file_resources/IMG_1482.JPG");
    File imageFile = new File(imageUrl.toURI());
    CPPage cpPage = new CPPage(browser);
    cpPage.openEditor().editMetadata(firstPage).clickRoot().newPage(secondPage).clickRoot().newPage(deletedPage).clickRoot().importPage(pageFile).fillMetadataForm(thirdPage).importPage(imageFile).closeMetadataForm().selectPage(deletedPage).deletePage().clickToolbarBack();
    // set access to registered members
    cpPage.accessConfiguration().setUserAccess(UserAccess.registred).clickToolbarBack();
    // a user search the content package
    LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl);
    ryomouLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
    NavigationPage ryomouNavBar = new NavigationPage(ryomouBrowser);
    ryomouNavBar.openMyCourses().openSearch().extendedSearch(cpTitle).select(cpTitle).start();
    CPPage ryomouPage = new CPPage(ryomouBrowser);
    ryomouPage.assertPageDeleted(deletedPage).assertInIFrame(By.xpath("//h1[text()[contains(.,'Small HTML page')]]")).selectPage(secondPage).selectPage(firstPage).assertInIFrame(By.xpath("//h2[text()[contains(.,'Lorem Ipsum')]]"));
}
Also used : UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) File(java.io.File) CPPage(org.olat.selenium.page.repository.CPPage) URL(java.net.URL) 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 CPPage

use of org.olat.selenium.page.repository.CPPage in project openolat by klemens.

the class CourseTest method createContentPackage.

/**
 * An author creates a CP, changes the name of a page, import
 * an other page, create two pages and delete one, import an
 * image...<br>
 * A user come to see the CP, check that the deleted page is
 * really deleted and that the "Small HTML page" exists and
 * can be read.
 *
 * @param loginPage
 * @throws IOException
 * @throws URISyntaxException
 */
@Test
@RunAsClient
public void createContentPackage(@InitialPage LoginPage loginPage, @Drone @User WebDriver ryomouBrowser) throws IOException, URISyntaxException {
    UserVO author = new UserRestClient(deploymentUrl).createAuthor();
    UserVO ryomou = new UserRestClient(deploymentUrl).createRandomUser("Ryomou");
    loginPage.loginAs(author.getLogin(), author.getPassword());
    // create a CP
    String cpTitle = "CP " + UUID.randomUUID();
    navBar.openAuthoringEnvironment().createCP(cpTitle).clickToolbarBack();
    String firstPage = "Page 1 " + UUID.randomUUID();
    String secondPage = "Seite 2 " + UUID.randomUUID();
    String thirdPage = "Feuillet 3 " + UUID.randomUUID();
    String deletedPage = "To delete 4 " + UUID.randomUUID();
    URL pageUrl = JunitTestHelper.class.getResource("file_resources/page.html");
    File pageFile = new File(pageUrl.toURI());
    URL imageUrl = JunitTestHelper.class.getResource("file_resources/IMG_1482.JPG");
    File imageFile = new File(imageUrl.toURI());
    CPPage cpPage = new CPPage(browser);
    cpPage.openEditor().editMetadata(firstPage).clickRoot().newPage(secondPage).clickRoot().newPage(deletedPage).clickRoot().importPage(pageFile).fillMetadataForm(thirdPage).importPage(imageFile).closeMetadataForm().selectPage(deletedPage).deletePage().clickToolbarBack();
    // set access to registered members
    cpPage.accessConfiguration().setUserAccess(UserAccess.registred).clickToolbarBack();
    // a user search the content package
    LoginPage ryomouLoginPage = LoginPage.getLoginPage(ryomouBrowser, deploymentUrl);
    ryomouLoginPage.loginAs(ryomou.getLogin(), ryomou.getPassword()).resume();
    NavigationPage ryomouNavBar = new NavigationPage(ryomouBrowser);
    ryomouNavBar.openMyCourses().openSearch().extendedSearch(cpTitle).select(cpTitle).start();
    CPPage ryomouPage = new CPPage(ryomouBrowser);
    ryomouPage.assertPageDeleted(deletedPage).assertInIFrame(By.xpath("//h1[text()[contains(.,'Small HTML page')]]")).selectPage(secondPage).selectPage(firstPage).assertInIFrame(By.xpath("//h2[text()[contains(.,'Lorem Ipsum')]]"));
}
Also used : UserVO(org.olat.user.restapi.UserVO) NavigationPage(org.olat.selenium.page.NavigationPage) File(java.io.File) CPPage(org.olat.selenium.page.repository.CPPage) URL(java.net.URL) 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

File (java.io.File)2 URL (java.net.URL)2 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 CPPage (org.olat.selenium.page.repository.CPPage)2 UserRestClient (org.olat.test.rest.UserRestClient)2 UserVO (org.olat.user.restapi.UserVO)2