/**
  * 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();
 }
  /**
   * 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();
  }
  /**
   * 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;
  }
Ejemplo n.º 4
0
  /**
   * 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);
  }
  /**
   * 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();
  }
 /**
  * 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();
 }