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')]]"));
}
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')]]"));
}
Aggregations