/** * This method is used to create content with name, title and description. User should be logged * in * * @param drone * @param contentDetails * @param contentType * @return {@link RepositoryPage} * @throws Exception */ public static RepositoryPage createContentInFolder( WebDrone drone, ContentDetails contentDetails, ContentType contentType, String... folderPath) throws Exception { // Open Folder in repository Library RepositoryPage repositoryPage = navigateFoldersInRepositoryPage(drone, folderPath); DocumentDetailsPage detailsPage = null; try { CreatePlainTextContentPage contentPage = repositoryPage.getNavigation().selectCreateContent(contentType).render(); detailsPage = contentPage.create(contentDetails).render(); repositoryPage = detailsPage.navigateToFolderInRepositoryPage().render(); } catch (Exception e) { throw new SkipException("Error in creating content." + e); } return repositoryPage; }
/** * This method is used to create content with name, title and description. User should be logged * in * * @param drone * @param contentDetails * @param contentType * @return {@link RepositoryPage} * @throws Exception */ public static HtmlPage createContentInFolderWithValidation( WebDrone drone, ContentDetails contentDetails, ContentType contentType, String... folderPath) throws Exception { // Open Folder in repository Library RepositoryPage repositoryPage = navigateFoldersInRepositoryPage(drone, folderPath); try { CreatePlainTextContentPage contentPage = repositoryPage.getNavigation().selectCreateContent(contentType).render(); HtmlPage page = contentPage.createWithValidation(contentDetails).render(); if (page instanceof DocumentDetailsPage) { DocumentDetailsPage detailsPage = page.render(); repositoryPage = detailsPage.navigateToFolderInRepositoryPage().render(); return repositoryPage; } return page; } catch (Exception e) { throw new SkipException("Error in creating content." + e.getMessage()); } }