コード例 #1
0
  @Test(groups = "EnterpriseOnly")
  public void Enterprise40x_5675() {
    /** Start Test */
    testName = getTestName();

    /** Test Data Setup */
    String siteName = getSiteName(testName);
    String testUser = getUserNameFreeDomain(testName);
    String fileName = getFileName(testName) + ".txt";
    String text = getRandomString(5);
    DocumentLibraryPage documentLibraryPage;

    // Login
    ShareUser.login(drone, testUser, DEFAULT_PASSWORD);

    documentLibraryPage = ShareUser.openSitesDocumentLibrary(drone, siteName);
    // Click Comment link near created file
    DocumentDetailsPage detailsPage =
        documentLibraryPage.getFileDirectoryInfo(fileName).clickCommentsLink().render();
    // Write some text in text box and click Add Comment button
    detailsPage.addComment(text);

    // Go to document library and verify comment counter

    documentLibraryPage = ShareUser.openDocumentLibrary(drone);
    Assert.assertEquals(documentLibraryPage.getFileDirectoryInfo(fileName).getCommentsCount(), 1);

    // Go to Details page and delete the comment
    detailsPage = documentLibraryPage.selectFile(fileName);
    detailsPage.removeComment(text);

    // Go to document library and verify comment counter

    documentLibraryPage = ShareUser.openDocumentLibrary(drone);
    Assert.assertEquals(documentLibraryPage.getFileDirectoryInfo(fileName).getCommentsCount(), 0);
  }
コード例 #2
0
  @Test(groups = {"DataPrepDocumentLibrary"})
  public void dataPrep_Enterprise40x_3960() throws Exception {

    String testName = getTestName();
    String testUser = getUserNameFreeDomain(testName);
    String siteName = getSiteName(testName);
    String fileName = getFileName(testName) + ".txt";

    // User
    String[] testUserInfo = new String[] {testUser};
    CreateUserAPI.CreateActivateUser(drone, ADMIN_USERNAME, testUserInfo);

    // Login
    ShareUser.login(drone, testUser, DEFAULT_PASSWORD);

    // Create Site
    ShareUser.createSite(drone, siteName, AbstractUtils.SITE_VISIBILITY_PUBLIC);
    ShareUser.openSiteDashboard(drone, siteName);
    ShareUser.openSitesDocumentLibrary(drone, siteName);

    // Upload File
    String[] fileInfo = {fileName, DOCLIB};
    DocumentLibraryPage documentLibraryPage =
        ShareUser.uploadFileInFolder(drone, fileInfo).render();

    // Upload New version of the document.
    for (int i = 0; i < 2; i++) {
      UpdateFilePage updatePage =
          documentLibraryPage.getFileDirectoryInfo(fileName).selectUploadNewVersion().render();
      updatePage.selectMajorVersionChange();
      String fileContents = String.format("New version of document %s: %s", i + 2, fileName);
      File newFileName = newFile(DATA_FOLDER + (fileName + getRandomString(3)), fileContents);
      updatePage.uploadFile(newFileName.getCanonicalPath());
      updatePage.setComment(fileName);
      SitePage sitePage = updatePage.submit().render();
      documentLibraryPage = (DocumentLibraryPage) sitePage.render();
      FileUtils.forceDelete(newFileName);
    }
  }