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