コード例 #1
0
  /**
   * Creates files in site's document library
   *
   * @param numberOfFiles
   * @param siteName
   * @throws Exception
   */
  public static void createFilesInSite(
      WebDrone drone, String testName, int numberOfFiles, String siteName) throws Exception {

    // Create Files
    for (int i = 0; i <= numberOfFiles - 1; i++) {
      DocumentLibraryPage documentLibraryPage = ShareUser.openSitesDocumentLibrary(drone, siteName);

      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();
    }
  }
コード例 #2
0
  /**
   * 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);
    }
  }
コード例 #3
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);
  }
コード例 #4
0
  /**
   * Enterprise40x-6553:Search for items
   *
   * <ul>
   *   <li>Search for Content using Keywords search criteria
   *   <li>Search for Content using Name search criteria
   *   <li>Search for Content using Title search criteria
   *   <li>Search for Content using Description search criteria
   *   <li>Search for Content using Mimetype search criteria
   *   <li>Search for Content using Modified Date search criteria
   *   <li>Search for Content using Modifier search criteria
   *   <li>Click View in Browser icon
   *   <li>Click Download icon
   *   <li>Search for Folder using Keywords search criteria
   *   <li>Search for Folder using Name search criteria
   *   <li>Search for Folder using Title search criteria
   *   <li>Search for Folder using Description search criteria
   *   <li>Click on folder's path
   *   <li>Sort the found items by any criteria
   * </ul>
   *
   * @throws Exception
   */
  @Test(groups = {"Sanity", "Search"})
  public void enterprise40x_6553() throws Exception {
    testName = getTestName();
    String searchTerm = testName + "-" + System.currentTimeMillis();
    Boolean searchOk;

    String testUser = getUserNameFreeDomain(searchTerm);
    String siteName = getSiteName(searchTerm);
    String folderName = getFolderName(searchTerm + "-1");
    String folderName2 = getFolderName(searchTerm + "-2");
    String fileName = getFileName(searchTerm);

    CreateUserAPI.CreateActivateUser(drone, ADMIN_USERNAME, testUser);

    ShareUser.login(drone, testUser, DEFAULT_PASSWORD);

    // Create a Site
    ShareUser.createSite(drone, siteName, SITE_VISIBILITY_PUBLIC).render();

    // Open Document library
    ShareUser.openDocumentLibrary(drone);

    // Create 2 Folder
    ShareUserSitePage.createFolder(drone, folderName, folderName + "Title1", folderName + "Desc1");
    ShareUserSitePage.createFolder(drone, folderName2, folderName + "Title2", folderName + "Desc2");

    // Create 2 Documents
    for (int i = 0; i < 2; i++) {
      ContentDetails contentDetails = new ContentDetails();
      contentDetails.setName(fileName + "-Name-0" + i);
      contentDetails.setTitle(fileName + "-Title-0" + i);
      contentDetails.setDescription(fileName + "-Desc-0" + i);

      ShareUser.createContent(drone, contentDetails, ContentType.PLAINTEXT);
    }
    htmlFileName = fileName + "-Name-0" + TEST_HTML_FILE;
    ShareUser.uploadFileInFolder(drone, new String[] {htmlFileName});

    /** Start Test */

    // Searching and sorting the content items
    List<String> searchInfo = Arrays.asList(ADV_CONTENT_SEARCH);
    Map<String, String> keyWordSearchText = new HashMap<String, String>();

    DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
    Calendar cal = Calendar.getInstance();
    String todaysDate = dateFormat.format(cal.getTime());
    cal.add(Calendar.DATE, -1);

    try {
      keyWordSearchText.put(SearchKeys.KEYWORD.getSearchKeys(), searchTerm);
      List<SearchResultItem> searchResults = null;
      // Content Search with keyword: common part of filename
      searchResults = ShareUserSearchPage.advanceSearch(drone, searchInfo, keyWordSearchText);

      // Check the Search Results: Search with Retry for Solr
      assertTrue(
          ShareUserSearchPage.checkSearchResultsWithRetry(
              drone, ADV_CONTENT_SEARCH, searchTerm, fileName + "-Name-01", true),
          "Incorrect Search Results for: Keyword search- " + searchTerm + " file1 not displayed");

      searchOk = ShareUserSearchPage.isSearchItemAvailable(drone, fileName + "-Name-00");
      Assert.assertTrue(
          searchOk,
          "Incorrect Search Results for Name search- "
              + searchTerm
              + ". Result item - "
              + fileName
              + "-Name-00"
              + " not found");

      keyWordSearchText.clear();

      // Searching for valid Name.
      searchTerm = "-Name-00";
      keyWordSearchText.put(SearchKeys.NAME.getSearchKeys(), searchTerm);
      searchResults = ShareUserSearchPage.advanceSearch(drone, searchInfo, keyWordSearchText);

      searchOk = ShareUserSearchPage.isSearchItemAvailable(drone, fileName + searchTerm);
      Assert.assertTrue(searchOk, "Incorrect Search Results for Name search- " + searchTerm);

      keyWordSearchText.clear();

      // Searching for valid Title string
      searchTerm = "-Title-01";
      keyWordSearchText.put(SearchKeys.TITLE.getSearchKeys(), searchTerm);
      searchResults = ShareUserSearchPage.advanceSearch(drone, searchInfo, keyWordSearchText);

      searchOk = ShareUserSearchPage.isSearchItemAvailable(drone, fileName + "-Name-01");
      Assert.assertTrue(searchOk, "Incorrect Search Results for Name search- " + searchTerm);

      keyWordSearchText.clear();

      // Searching for valid Description string
      searchTerm = "-Desc-01";
      keyWordSearchText.put(SearchKeys.DESCRIPTION.getSearchKeys(), searchTerm);
      ShareUserSearchPage.advanceSearch(drone, searchInfo, keyWordSearchText);

      searchOk = ShareUserSearchPage.isSearchItemAvailable(drone, fileName + "-Name-01");
      Assert.assertTrue(searchOk, "Incorrect Search Results for Name search- " + searchTerm);

      keyWordSearchText.clear();

      // Searching for valid MODIFIERTODATE string
      keyWordSearchText.put(SearchKeys.MODIFIERTODATE.getSearchKeys(), todaysDate);
      keyWordSearchText.put(SearchKeys.MODIFIERFROMDATE.getSearchKeys(), todaysDate);
      searchResults = ShareUserSearchPage.advanceSearch(drone, searchInfo, keyWordSearchText);

      assertTrue(
          searchResults.size() > 0, "There should be search results for to date - " + todaysDate);
      searchOk = ShareUserSearchPage.isSearchItemAvailable(drone, fileName + "-Name-01");
      Assert.assertTrue(
          searchOk,
          "Incorrect Search Results for Name search- "
              + keyWordSearchText
              + ". Result item - "
              + fileName
              + "-Name-00");

      keyWordSearchText.clear();

      // Searching for valid Name and Mime type.
      keyWordSearchText.put(SearchKeys.MIME.getSearchKeys(), "HTML");
      searchResults = ShareUserSearchPage.advanceSearch(drone, searchInfo, keyWordSearchText);

      assertTrue(searchResults.size() > 0, "There should be search results for html MIME TYPE.");
      searchOk = ShareUserSearchPage.isSearchItemAvailable(drone, htmlFileName);
      Assert.assertTrue(
          searchOk,
          "Incorrect Search Results for Name search- "
              + keyWordSearchText
              + ". Result item - "
              + fileName
              + "-Name-00"
              + " not found");

      searchResults.clear();

      keyWordSearchText.clear();

      // Searching for valid Name and Mime type.
      keyWordSearchText.put(SearchKeys.MODIFIER.getSearchKeys(), testUser);
      searchResults = ShareUserSearchPage.advanceSearch(drone, searchInfo, keyWordSearchText);

      assertTrue(
          searchResults.size() > 0,
          "There should be search results for " + testUser + " as modifier.");
      searchOk = ShareUserSearchPage.isSearchItemAvailable(drone, fileName + "-Name-00");
      Assert.assertTrue(
          searchOk,
          "Incorrect Search Results for Name search- "
              + keyWordSearchText
              + ". Result item - "
              + fileName
              + "-Name-00"
              + " not found");

      searchResults.clear();

      keyWordSearchText.clear();

      // Folder Search: Searching with keyword
      searchInfo = Arrays.asList(ADV_FOLDER_SEARCH);

      searchTerm = folderName;
      keyWordSearchText.put(SearchKeys.KEYWORD.getSearchKeys(), searchTerm);
      searchResults = ShareUserSearchPage.advanceSearch(drone, searchInfo, keyWordSearchText);

      searchOk = ShareUserSearchPage.isSearchItemAvailable(drone, folderName);
      Assert.assertTrue(
          searchOk,
          "Incorrect Search Results for Name search- "
              + searchTerm
              + ". Result item - "
              + fileName
              + "-Name-00"
              + " not found");

      keyWordSearchText.clear();

      // Searching for valid Name.
      keyWordSearchText.put(SearchKeys.NAME.getSearchKeys(), searchTerm);
      searchResults = ShareUserSearchPage.advanceSearch(drone, searchInfo, keyWordSearchText);

      assertTrue(searchResults.size() > 0, "There should be search results for name on folder.");
      searchOk = ShareUserSearchPage.isSearchItemAvailable(drone, folderName);
      Assert.assertTrue(
          searchOk,
          "Incorrect Search Results for Name search- "
              + searchTerm
              + ". Result item - "
              + fileName
              + "-Name-00"
              + " not found");

      keyWordSearchText.clear();

      // Searching for valid Title string
      keyWordSearchText.put(SearchKeys.TITLE.getSearchKeys(), searchTerm);
      searchResults = ShareUserSearchPage.advanceSearch(drone, searchInfo, keyWordSearchText);

      assertTrue(searchResults.size() > 0, "There should be search results for title on folder.");
      searchOk = ShareUserSearchPage.isSearchItemAvailable(drone, folderName);
      Assert.assertTrue(
          searchOk,
          "Incorrect Search Results for Name search- "
              + searchTerm
              + ". Result item - "
              + folderName
              + " not found");
      keyWordSearchText.clear();

      // Searching for valid Description string
      keyWordSearchText.put(SearchKeys.DESCRIPTION.getSearchKeys(), searchTerm);
      searchResults = ShareUserSearchPage.advanceSearch(drone, searchInfo, keyWordSearchText);

      assertTrue(
          searchResults.size() > 0, "There should be search results for description on folder.");
      searchOk = ShareUserSearchPage.isSearchItemAvailable(drone, folderName);
      Assert.assertTrue(
          searchOk,
          "Incorrect Search Results for Name search- "
              + searchTerm
              + ". Result item - "
              + folderName
              + " not found");

      // Sorting results by Name
      List<SearchResultItem> sortedByName =
          ShareUserSearchPage.sortSearchResults(drone, SortType.NAME);

      List<SearchResultItem> expectedResultsSortedByName =
          new ArrayList<SearchResultItem>(sortedByName);
      Collections.sort(expectedResultsSortedByName, new SortedSearchResultItemByName());

      // Check Sort order
      for (int i = 0; (i < 5 && i < expectedResultsSortedByName.size()); i++) {
        assertTrue(
            expectedResultsSortedByName
                .get(i)
                .getTitle()
                .equalsIgnoreCase(sortedByName.get(i).getTitle()),
            "The results are not sorted as expected - "
                + expectedResultsSortedByName.get(i).getTitle()
                + " - "
                + sortedByName.get(i).getTitle());
      }
    } catch (Throwable e) {
      reportError(drone, testName, e);
    } finally {
      testCleanup(drone, testName);
    }
  }