/** * Assumes User is logged in Selects the specified view for the open folder in repository * * @param driver WebDrone Instance * @param view ViewType * @return RepositoryPage */ public static RepositoryPage selectView(WebDrone driver, ViewType view) { // Assumes User is logged in RepositoryPage repositorypage = ((RepositoryPage) ShareUserSitePage.selectView(driver, view)); logger.info("Opened RepositoryPage"); return repositorypage; }
/** * Assumes Repository Page is open and navigates to the Path specified. * * @param driver WebDrone Instance * @param folderPath : String folder path relative to RepositoryPage e.g. Repo + file.seperator + * folderName1 * @throws SkipException if error in this API * @return RepositoryPage */ public static RepositoryPage navigateToFolderInRepository(WebDrone driver, String folderPath) throws Exception { openRepository(driver); RepositoryPage repositoryPage = ((RepositoryPage) ShareUserSitePage.navigateToFolder(driver, folderPath)).render(); return repositoryPage; }
/** * Add given tags to file or folder in {@link TagPage}. Assume that user currently in {@link * RepositoryPage}. * * @param drone * @param contentName * @param tags - Tags to be added to content * @return {@link RepositoryPage} */ public static RepositoryPage addTagsInRepo( WebDrone drone, String contentName, List<String> tags) { DetailsPage detailsPage = ShareUserSitePage.addTags(drone, contentName, tags).render(); RepositoryPage repoPage = detailsPage.navigateToParentFolder().render(); return repoPage; }
/** * Get properties. * * @param drone * @param folderName * @param aspect * @return */ public static Map<String, Object> getProperties(WebDrone drone, String folderName) { FolderDetailsPage folderDetailsPage = ShareUserSitePage.getFileDirectoryInfo(drone, folderName) .selectViewFolderDetails() .render(); return folderDetailsPage.getProperties(); }
/** * Open Repository Page: Top Level Assumes User is logged in - Opens repository in detailed View * * @param driver WebDrone Instance * @return RepositoryPage */ public static RepositoryPage openRepositoryDetailedView(WebDrone driver) { // Assumes User is logged in RepositoryPage repositorypage = openRepository(driver); repositorypage = ((RepositoryPage) ShareUserSitePage.selectView(driver, ViewType.DETAILED_VIEW)).render(); logger.info("Opened RepositoryPage"); return repositorypage; }
/** * Open Repository Page: Top Level Assumes User is logged in Opens repository in simple View * * @param driver WebDrone Instance * @return RepositoryPage */ public static RepositoryPage openRepositoryGalleryView(WebDrone driver) { // Assumes User is logged in SharePage page = ShareUser.getSharePage(driver); RepositoryPage repositorypage = page.getNav().selectRepository(); repositorypage = ((RepositoryPage) ShareUserSitePage.selectView(driver, ViewType.GALLERY_VIEW)); logger.info("Opened RepositoryPage"); return repositorypage; }
/** * Copy folder to destination. * * @param drone * @param folderName * @param destinationFolderName */ public static void copyToFolderInDestination( WebDrone drone, String folderName, String destinationFolderName) { CopyOrMoveContentPage copyOrMoveContentPage = ShareUserSitePage.getFileDirectoryInfo(drone, folderName).selectCopyTo().render(); copyOrMoveContentPage = copyOrMoveContentPage.selectDestination(destinationFolderName).render(); copyOrMoveContentPage.selectOkButton().render(); }
/** * Creates a new folder at the Path specified, Starting from the RepositoryPage Page. Assumes User * is logged in and a specific Site is open. * * @param driver WebDrone Instance * @param folderName String Name of the folder to be created * @param folderTitle String Title of the folder to be created * @param folderDesc String Description of the folder to be created * @return RepositoryPage */ public static HtmlPage createFolderInRepositoryWithValidation( WebDrone driver, String folderName, String folderTitle, String folderDesc) { HtmlPage htmlPage = ShareUserSitePage.createFolderWithValidation(driver, folderName, folderTitle, folderDesc); if (htmlPage instanceof DocumentLibraryPage) { RepositoryPage repositoryPage = htmlPage.render(); return repositoryPage; } return htmlPage; }
/** * This method does the copy or move the folder or document into another folder. User should be on * RepositoryPage Page. * * @param isCopy * @param testFolderName * @param copyFolderName * @param docLibPage * @return CopyOrMoveContentPage */ public static CopyOrMoveContentPage copyOrMoveToFolderInRepository( WebDrone drone, String sourceFolder, String[] destinationFolders, boolean isCopy) { if ((StringUtils.isEmpty(sourceFolder)) || (destinationFolders.length == 0)) { throw new IllegalArgumentException( "sitename/sourceFolder/destinationFolders should not be empty or null"); } CopyOrMoveContentPage copyOrMoveContentPage; FileDirectoryInfo contentRow = ShareUserSitePage.getFileDirectoryInfo(drone, sourceFolder); if (isCopy) { copyOrMoveContentPage = contentRow.selectCopyTo().render(); } else { copyOrMoveContentPage = contentRow.selectMoveTo().render(); } copyOrMoveContentPage = copyOrMoveContentPage.selectDestination(REPO).render(); copyOrMoveContentPage = copyOrMoveContentPage.selectPath(destinationFolders).render(); return copyOrMoveContentPage; }
/** * Sorts the document library by the given field. * * @param drone * @param field The field to sort by. * @param sortAscending <code>true</code> if ascending. <code>false</code> if descending. * @return {@link RepositoryPage} */ public static RepositoryPage sortLibraryOn( WebDrone drone, SortField field, boolean sortAscending) { return (RepositoryPage) ShareUserSitePage.sortLibraryOn(drone, field, sortAscending); }
/** * Add tag from repository page. * * @param drone * @param contentName * @param tagName */ public static RepositoryPage addTag(WebDrone drone, String contentName, String tagName) { RepositoryPage repoPage = ((RepositoryPage) ShareUserSitePage.addTag(drone, contentName, tagName)).render(); return repoPage; }
/** * Creates files in a folder in site's document library * * @param numberOfFiles * @param siteName * @param siteNumber * @throws Exception */ public static void createFilesInSiteFolder( WebDrone drone, String testName, int numberOfFiles, String siteName, int siteNumber, String rule) throws Exception { // Create folder String folderName = getFileName(testName + "_" + siteNumber); DocumentLibraryPage documentLibraryPage = ShareUserSitePage.createFolder(drone, folderName, folderName); // create rule if rule is set if (MOVE_RULE.equalsIgnoreCase(rule)) { FolderRulesPage folderRulesPage = documentLibraryPage.getFileDirectoryInfo(folderName).selectManageRules().render(); Assert.assertTrue(folderRulesPage.isPageCorrect(folderName)); CreateRulePage createRulePage = folderRulesPage.openCreateRulePage().render(); createRulePage.fillNameField("New Move Rule Name"); createRulePage.fillDescriptionField("New Move Rule Description"); ActionSelectorEnterpImpl actionSelectorEnterpImpl = createRulePage.getActionOptionsObj(); // move rule actionSelectorEnterpImpl.selectMove(siteName, "Documents"); FolderRulesPageWithRules folderRulesPageWithRules = createRulePage.clickCreate().render(); Assert.assertTrue(folderRulesPageWithRules.isPageCorrect(folderName)); documentLibraryPage = ShareUser.openSitesDocumentLibrary(drone, siteName); } else if (COPY_RULE.equalsIgnoreCase(rule)) { FolderRulesPage folderRulesPage = documentLibraryPage.getFileDirectoryInfo(folderName).selectManageRules().render(); Assert.assertTrue(folderRulesPage.isPageCorrect(folderName)); CreateRulePage createRulePage = folderRulesPage.openCreateRulePage().render(); createRulePage.fillNameField("New Copy and Transform Rule Name"); createRulePage.fillDescriptionField("New Copy and Transform Rule Description"); ActionSelectorEnterpImpl actionSelectorEnterpImpl = createRulePage.getActionOptionsObj(); // copy rule actionSelectorEnterpImpl.selectTransformAndCopy("XML", siteName, "Documents"); FolderRulesPageWithRules folderRulesPageWithRules = createRulePage.clickCreate().render(); Assert.assertTrue(folderRulesPageWithRules.isPageCorrect(folderName)); documentLibraryPage = ShareUser.openSitesDocumentLibrary(drone, siteName); } documentLibraryPage.selectFolder(folderName).render(); // Create Files for (int i = 0; i <= numberOfFiles - 1; i++) { ContentDetails contentDetails = new ContentDetails(); String fileName = getFileName(testName + "_" + i + "." + "txt"); contentDetails.setName(fileName); contentDetails.setTitle(testName + " title"); contentDetails.setDescription(testName + " description"); contentDetails.setContent(testName + " content"); CreatePlainTextContentPage contentPage = documentLibraryPage.getNavigation().selectCreateContent(ContentType.PLAINTEXT).render(); contentPage.create(contentDetails).render(); ShareUserSitePage.navigateToFolder(drone, folderName); } }
/** * Edits the document using the in-line edit form. * * @param drone * @param fileName * @param mimeType * @param details * @return */ public static HtmlPage editTextDocumentInLine( WebDrone drone, String fileName, ContentDetails details) { return ShareUserSitePage.editTextDocumentInLine(drone, fileName, details); }
public static DocumentDetailsPage uploadNewVersionFromDocDetail( WebDrone drone, boolean majorVersion, String fileName, String comments) { return ShareUserSitePage.uploadNewVersionFromDocDetail(drone, majorVersion, fileName, comments); }
/** * Opens the content details page starting from the parent folder within DocumentLibrary Assume * that user currently in {@link RepositoryPage}. * * @param drone * @param contentName * @param isFile * @return DetailsPage */ public static DetailsPage getContentDetailsPage(WebDrone drone, String contentName) { return ShareUserSitePage.getContentDetailsPage(drone, contentName); }
/** * @param drone * @param folderName * @param properString * @param doSave * @return */ public static RepositoryPage editContentProperties( WebDrone drone, String folderName, String properString, boolean doSave) { return ((RepositoryPage) ShareUserSitePage.editContentProperties(drone, folderName, properString, doSave)) .render(); }
/** * Method to get given Node Template Node Ref. * * @param drone * @param contentName * @return * @throws Exception */ public static String getNodeTemplateNodeRef(WebDrone drone, String contentName) throws Exception { navigateToFolderInRepository( drone, REPO + SLASH + DATA_DICTIONARY_FOLDER + SLASH + NODE_TEMPLATES_FOLDER); return ShareUserSitePage.getFileDirectoryInfo(drone, contentName).getNodeRef(); }
/** * Assumes User is logged in and a specific Site's RepositoryPage is open, Parent Folder is * pre-selected. * * @param file File Object for the file in reference * @return RepositoryPage * @throws SkipException if error in this API */ public static RepositoryPage uploadFileInRepository(WebDrone driver, File file) throws Exception { RepositoryPage repositoryPage = ((RepositoryPage) ShareUserSitePage.uploadFile(driver, file)).render(); return repositoryPage; }
/** * @param drone * @param contentName * @return */ public static ContentDetails getInLineEditContentDetails(WebDrone drone, String contentName) { return ShareUserSitePage.getInLineEditContentDetails(drone, contentName); }
/** * Creates a new folder at the Path specified, Starting from the RepositoryPage Page. Assumes User * is logged in and a specific Site is open. * * @param driver WebDrone Instance * @param folderName String Name of the folder to be created * @param folderTitle String Title of the folder to be created * @param folderDesc String Description of the folder to be created * @return RepositoryPage */ public static RepositoryPage createFolderInRepository( WebDrone driver, String folderName, String folderTitle, String folderDesc) { RepositoryPage repositoryPage = ShareUserSitePage.createFolder(driver, folderName, folderTitle, folderDesc).render(); return repositoryPage; }
/** * Utility to create events in share for adhoc reports * * @param drone * @param testName * @throws Exception */ public static void userShareInteractions(WebDrone drone, String testName) throws Exception { String testUser = getUserNameForDomain(testName, DOMAIN_FREE); String[] testUserInfo = new String[] {testUser}; String siteName = getSiteName(testName); // Create test user CreateUserAPI.createActivateUserAsTenantAdmin(drone, ADMIN_USERNAME, testUserInfo); // Login as created test user ShareUser.login(drone, testUser, DEFAULT_PASSWORD); // test user creates site SiteUtil.createSite(drone, siteName, AbstractUtils.SITE_VISIBILITY_PUBLIC); String folderName = getFolderName(testName) + System.currentTimeMillis(); // and a folder in sites document library ShareUserSitePage.createFolder(drone, folderName, folderName); // add comment to folder ShareUserSitePage.addComment(drone, folderName, "folderComment"); // create text file in the folder - file-previewed String fileName = getFileName(testName) + "-" + System.currentTimeMillis(); ContentDetails contentDetails = new ContentDetails(); contentDetails.setName(fileName); ShareUserSitePage.createContentInFolder( drone, contentDetails, ContentType.PLAINTEXT, siteName, folderName); ShareUser.openDocumentLibrary(drone); // uploads a file in the folder String fileName1 = getFileName(testName) + System.currentTimeMillis() + "_1" + ".txt"; File file1 = newFile(fileName1, fileName1); ShareUserSitePage.uploadFile(drone, file1); // add comment to file - file-previewed ShareUserSitePage.addComment(drone, fileName1, "fileComment"); ShareUser.openDocumentLibrary(drone); // like file ShareUserSitePage.likeContent(drone, fileName1); // share file ShareUserSitePage.getFileDirectoryInfo(drone, fileName1).clickShareLink().render(); ContentDetails newContentDetails = new ContentDetails(); newContentDetails.setContent(testName); DocumentLibraryPage documentLibPage = ShareUser.openDocumentLibrary(drone); // edit document inline ShareUserSitePage.editTextDocumentInLine(drone, fileName1, newContentDetails).render(); // select all documentLibPage.getNavigation().selectAll().render(); // delete all ConfirmDeletePage confirmDeletePage = documentLibPage.getNavigation().selectDelete().render(); confirmDeletePage.selectAction(ConfirmDeletePage.Action.Delete).render(); // add user with write permissions to write to the site ShareUserMembers.inviteUserToSiteWithRole( drone, testUser, testName, siteName, UserRole.COLLABORATOR); // change the user role ShareUserMembers.assignRoleToSiteMember(drone, testName, siteName, UserRole.CONTRIBUTOR); // Inviting user logs out ShareUser.logout(drone); // Invited User logs in ShareUser.login(drone, testName, DEFAULT_PASSWORD); // user leaves site ShareUserMembers.userRequestToLeaveSite(drone, siteName); }
/** * Return EditDocumentPropertiesPopup from RepositoryPage or documentLibrary page. * * @param drone * @param folderName * @return */ public static EditDocumentPropertiesPage returnEditDocumentProperties( WebDrone drone, String folderName) { return ShareUserSitePage.getFileDirectoryInfo(drone, folderName) .selectEditProperties() .render(); }