@Test(groups = "EnterpriseOnly")
  public void Enterprise40x_14032() {
    /** Start Test */
    testName = getTestName();

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

    DocumentLibraryPage documentLibraryPage;

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

    documentLibraryPage = ShareUser.openSitesDocumentLibrary(drone, siteName);

    DocumentDetailsPage detailsPage = documentLibraryPage.selectFile(fileName);

    // Click 'Change Type' action
    ChangeTypePage changeTypePage = detailsPage.selectChangeType().render();
    assertTrue(changeTypePage.isChangeTypeDisplayed());

    // Select any type if present and click Cancel
    // The behavior for standard install is: no types are available -> click cancel
    changeTypePage.selectCancel();
  }
  /**
   * method to Navigate folder
   *
   * @param drone
   * @param List of Folders
   */
  public static RepositoryPage navigateFoldersInRepositoryPage(
      WebDrone drone, String... folderPath) {
    boolean selected = false;
    if (folderPath == null || folderPath.length < 1) {
      throw new IllegalArgumentException("Invalid Folder path!!");
    }

    RepositoryPage repoPage = ShareUser.getSharePage(drone).render();

    try {

      for (String folder : folderPath) {
        repoPage.selectFolder(folder).render();
        selected = true;
        logger.info("Folder \"" + folder + "\" selected");
      }
      if (!selected) {
        throw new ShareException("Cannot select the folder metioned in the path");
      }
    } catch (Exception e) {
      throw new ShareException("Cannot select the folder metioned in the path");
    }

    return ShareUser.getSharePage(drone).render();
  }
  @Test(groups = "EnterpriseOnly")
  public void Enterprise40x_3960() throws Exception {
    /** Start Test */
    testName = getTestName();

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

    setupCustomDrone(WebDroneType.DownLoadDrone);

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

    documentLibraryPage = ShareUser.openSitesDocumentLibrary(customDrone, siteName);
    // Document details page has been opened;
    DocumentDetailsPage detailsPage = documentLibraryPage.selectFile(fileName).render();
    Assert.assertFalse(detailsPage.getDocumentVersion().equals("1.0"));

    // Click Download icon for previous version;
    detailsPage.selectDownloadPreviousVersion("2.0");

    // Check the file is downloaded successfully
    detailsPage.waitForFile(maxWaitTime, downloadDirectory + fileName);

    String body = FileUtils.readFileToString(new File(filePath));
    if (body.length() == 0) {
      body = FileUtils.readFileToString(new File(filePath));
    }

    Assert.assertEquals(body, String.format("New version of document %s: %s", 2, fileName));
  }
  @Test(groups = "EnterpriseOnly")
  public void Enterprise40x_13863() throws Exception {
    /** Start Test */
    testName = getTestName();

    /** Test Data Setup */
    String siteName = getSiteName(testName);
    String testUser = getUserNameFreeDomain(testName);
    String fileName = getFileName(testName) + getRandomStringWithNumders(3) + ".txt";

    DocumentLibraryPage documentLibraryPage;

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

    documentLibraryPage = ShareUser.openSitesDocumentLibrary(drone, siteName);

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

    DocumentDetailsPage detailsPage = documentLibraryPage.selectFile(fileName);

    // Click "Edit Properties" in Actions section;
    EditDocumentPropertiesPage editPropertiesPage = detailsPage.selectEditProperties().render();
    editPropertiesPage.selectMimeType(MimeType.XML);
    detailsPage = editPropertiesPage.selectSave().render();
    detailsPage.render();

    Map<String, Object> properties = detailsPage.getProperties();
    Assert.assertEquals(properties.get("Mimetype"), "XML");
  }
  @Test(groups = "EnterpriseOnly")
  public void Enterprise40x_3910() {
    /** 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);

    DocumentDetailsPage detailsPage = documentLibraryPage.selectFile(fileName);
    AddCommentForm addCommentForm = detailsPage.clickAddCommentButton();

    // 1. Type any text and make it bold;
    TinyMceEditor tinyMceEditor = addCommentForm.getTinyMceEditor();
    tinyMceEditor.setText(text);

    tinyMceEditor.clickTextFormatter(BOLD);
    assertEquals(
        tinyMceEditor.getContent(),
        String.format("<p><b>%s</b></p>", text),
        "The text didn't mark as bold.");

    tinyMceEditor.clickTextFormatter(ITALIC);
    assertEquals(
        tinyMceEditor.getContent(),
        String.format("<p><i><b>%s</b></i></p>", text),
        "The text didn't italic.");

    tinyMceEditor.clickTextFormatter(BULLET);
    assertEquals(
        tinyMceEditor.getContent(),
        String.format("<ul><li><i><b>%s</b></i></li></ul>", text),
        "List didn't display.");

    tinyMceEditor.clickTextFormatter(NUMBER);
    assertEquals(
        tinyMceEditor.getContent(),
        String.format("<ol><li><i><b>%s</b></i></li></ol>", text),
        "Numbered list didn't display.");

    tinyMceEditor.clickColorCode(TinyMceColourCode.BLUE);
    assertEquals(
        tinyMceEditor.getColourAttribute(), "BLUE", "The text didn't highlight with any color.");

    addCommentForm.clickAddCommentButton();
    assertTrue(detailsPage.isCommentCorrect(text), "Comment didn't create");
  }
  @Test(groups = "EnterpriseOnly")
  public void Enterprise40x_13861() throws Exception {
    /** Start Test */
    testName = getTestName();

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

    DocumentLibraryPage documentLibraryPage;

    String workFlowName1 = testName + System.currentTimeMillis() + "-1-WF";
    String dueDate = new DateTime().plusDays(2).toString("dd/MM/yyyy");

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

    documentLibraryPage = ShareUser.openSitesDocumentLibrary(drone, siteName);

    DocumentDetailsPage detailsPage = documentLibraryPage.selectFile(fileName);

    // Click Start Workflow from Actions section

    StartWorkFlowPage startWorkFlowPage =
        ShareUserWorkFlow.selectStartWorkFlowFromDetailsPage(drone).render();

    NewWorkflowPage newWorkflowPage =
        startWorkFlowPage.getWorkflowPage(WorkFlowType.NEW_WORKFLOW).render();

    List<String> reviewers = new ArrayList<String>();
    reviewers.add(username);

    WorkFlowFormDetails formDetails = new WorkFlowFormDetails(siteName, siteName, reviewers);
    formDetails.setMessage(workFlowName1);
    formDetails.setDueDate(dueDate);
    formDetails.setTaskPriority(Priority.MEDIUM);
    // detailsPage = newWorkflowPage.startWorkflow(formDetails).render();

    newWorkflowPage.startWorkflow(formDetails).render();

    // check the document is marked with icon
    assertTrue(detailsPage.isPartOfWorkflow(), "Verifying the file is part of a workflow");

    // site creator logs out and assignee user logs in
    ShareUser.logout(drone);
    ShareUser.login(drone, ADMIN_USERNAME, ADMIN_PASSWORD);

    // check the task is in MyTasks for site creator
    MyTasksPage myTasksPage = ShareUserWorkFlow.navigateToMyTasksPage(drone);
    assertTrue(myTasksPage.isTaskPresent(workFlowName1));
  }
 /**
  * Creates a new folder at the Path specified, Starting from the Re. 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 folderDesc String Description of the folder to be created
  * @param parentFolderPath String Path for the folder to be created, under DocumentLibrary : such
  *     as ConstRepo + file.seperator + parentFolderName1 + file.seperator + parentFolderName2
  * @throws Excetion
  */
 public static RepositoryPage createFolderInFolderInRepository(
     WebDrone driver, String folderName, String folderDesc, String parentFolderPath)
     throws Exception {
   return ((RepositoryPage)
           ShareUser.createFolderInFolder(driver, folderName, folderDesc, parentFolderPath))
       .render();
 }
Example #8
0
 /**
  * Method to return tag name from Details Page of wiki. User must be logged in to the Share.
  *
  * @param driver - WebDrone Instance
  * @param siteName
  * @param wikiTitle
  * @return String - tag name
  */
 public static String getWikiTag(WebDrone driver, String siteName, String wikiTitle) {
   WikiPage wikiPage = WikiUtils.openWikiPage(driver, siteName);
   WikiPageList wikiPageList = wikiPage.clickWikiPageListBtn().render();
   wikiPage = ShareUser.getCurrentPage(driver).render();
   wikiPage = wikiPageList.getWikiPageDirectoryInfo(wikiTitle.replace("_", " ")).clickDetails();
   return wikiPage.getTagName();
 }
 /**
  * This method provides the user to login into edit google docs page through google authorization.
  *
  * @param drone WebDrone
  * @return EditInGoogleDocsPage
  */
 public static EditInGoogleDocsPage signIntoResumeEditGoogleDocFromDetailsPage(WebDrone drone)
     throws InterruptedException {
   DocumentDetailsPage detailsPage = ShareUser.getSharePage(drone).render();
   detailsPage.render();
   GoogleDocsAuthorisation googleAuthorisationPage = detailsPage.resumeEditInGoogleDocs().render();
   return signInGoogleDocs(drone, googleAuthorisationPage);
 }
  /**
   * Open Repository Page: Default View
   *
   * @param driver WebDrone Instance
   * @return RepositoryPage
   */
  public static RepositoryPage openRepository(WebDrone driver) {
    SharePage page = ShareUser.getSharePage(driver);

    RepositoryPage repositorypage = page.getNav().selectRepository().render();
    logger.info("Opened RepositoryPage");
    return repositorypage;
  }
 /**
  * This method provides the user to login into create google docs with given filename through
  * google authorization. And Saves the document return to the document library page. User should
  * be already logged
  *
  * @param drone WebDrone
  * @param fileName String
  * @param contentType ContentType
  * @return DocumentLibraryPage
  * @throws Exception
  */
 public static DocumentLibraryPage createAndSavegoogleDocBySignIn(
     WebDrone drone, String fileName, ContentType contentType) throws Exception {
   DocumentLibraryPage docLibPage;
   String docTitle = "";
   EditInGoogleDocsPage googleDocsPage = createGoogleDocWithoutSave(drone, fileName, contentType);
   if (isGoogleDocsV3) {
     switch (contentType) {
       case GOOGLEDOCS:
         docTitle = "Untitled Document.docx";
         break;
       case GOOGLESPREADSHEET:
         docTitle = "Untitled Document.xlsx";
         break;
       case GOOGLEPRESENTATION:
         docTitle = "Untitled Document.pptx";
         break;
     }
     closeAndSwitchToShare(drone).render();
     Thread.sleep(10000);
     docLibPage = ShareUser.getSharePage(drone).render();
     docLibPage.render();
     try {
       docLibPage.getFileDirectoryInfo(docTitle).selectCheckInGoogleDoc();
     } catch (TimeoutException e) {
       throw new PageOperationException("Check-in didn't finish within the timeout");
     }
   } else {
     docLibPage = googleDocsPage.selectSaveToAlfresco().render();
   }
   return docLibPage.render();
 }
 /**
  * Discarding the changes made in google doc.
  *
  * @param drone WebDrone
  * @return SharePage
  */
 public static HtmlPage discardGoogleDocsChanges(WebDrone drone) {
   EditInGoogleDocsPage googleDocsPage = ShareUser.getSharePage(drone).render();
   if (isGoogleDocsV3) {
     String docTitle = googleDocsPage.getDocumentTitle();
     closeAndSwitchToShare(drone);
     HtmlPage currentPage = FactorySharePage.resolvePage(drone);
     if (currentPage instanceof DocumentLibraryPage) {
       ((DocumentLibraryPage) currentPage)
           .getFileDirectoryInfo(docTitle)
           .selectCancelEditingInGoogleDocs()
           .render();
     } else if (currentPage instanceof DocumentDetailsPage) {
       ((DocumentDetailsPage) currentPage).clickCancelEditingInGoogleDocs().render();
     }
     HtmlPage thePage = FactorySharePage.resolvePage(drone).render();
     if (thePage instanceof SharePopup) {
       ((SharePopup) thePage).clickYes();
       drone.waitUntilElementDeletedFromDom(
           By.cssSelector("span[class='message']"), SECONDS.convert(maxWaitTime, MILLISECONDS));
     }
   } else {
     GoogleDocsDiscardChanges googleDocsDiscardChanges = googleDocsPage.selectDiscard().render();
     return googleDocsDiscardChanges.clickOkButton().render();
   }
   return FactorySharePage.resolvePage(drone).render();
 }
 /**
  * Saving the google doc with the minor version and if isCreate boolean value is true for saving
  * the new google doc otherwise existing google doc. Methods used for edition by concurrent user's
  *
  * @param drone WebDrone
  * @param isCreateDoc boolean
  * @return SharePage
  */
 public static SharePage saveGoogleDocOtherEditor(WebDrone drone, boolean isCreateDoc) {
   EditInGoogleDocsPage googleDocsPage = ShareUser.getSharePage(drone).render();
   googleDocsPage.setGoogleCreate(isCreateDoc);
   GoogleDocsUpdateFilePage googleUpdatefile = googleDocsPage.selectSaveToAlfresco().render();
   googleUpdatefile.render();
   googleUpdatefile.selectMinorVersionChange();
   return googleUpdatefile.submitWithConcurrentEditors().render();
 }
  @Test(groups = {"DataPrepDocumentLibrary"})
  public void dataPrep_Enterprise40x_13863() throws Exception {
    String testName = getTestName();
    String testUser = getUserNameFreeDomain(testName);
    String siteName = getSiteName(testName);

    // 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);
  }
 /**
  * This method provides edit google docs page.
  *
  * @param drone WebDrone
  * @return EditInGoogleDocsPage
  */
 public static EditInGoogleDocsPage openEditGoogleDocFromDetailsPage(WebDrone drone) {
   DocumentDetailsPage detailsPage = ShareUser.getSharePage(drone).render();
   detailsPage.render();
   EditInGoogleDocsPage googleDocsPage = detailsPage.editInGoogleDocs().render();
   if (isGoogleDocsV3) {
     googleDocsPage = switchToGoogleWindow(drone).render();
   }
   return googleDocsPage.render();
 }
Example #16
0
 /**
  * Method to create new Wiki Page. User must be logged in to the Share.
  *
  * @param driver - WebDrone Instance
  * @param siteName
  * @param wikiTitle
  * @param text
  * @param tag
  * @return WikiPage
  */
 public static WikiPage createWikiPage(
     WebDrone driver, String siteName, String wikiTitle, String text, String tag) {
   SiteDashboardPage siteDashboardPage = ShareUser.openSiteDashboard(driver, siteName).render();
   WikiPage wikiPage = siteDashboardPage.getSiteNav().selectSiteWikiPage().render();
   List<String> wikiText = new ArrayList<>();
   wikiText.add(text);
   List<String> wikiTag = new ArrayList<>();
   wikiTag.add(tag);
   return wikiPage.createWikiPage(wikiTitle, wikiText, wikiTag).render();
 }
  /**
   * 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;
  }
Example #18
0
  /**
   * navigate to the Wiki Page. User must be logged in to the Share
   *
   * @param driver - WebDrone Instance
   * @param siteName
   * @return WikiPage
   */
  public static WikiPage openWikiPage(WebDrone driver, String siteName) {
    WikiPage wikiPage =
        ShareUser.openSiteDashboard(driver, siteName)
            .render()
            .getSiteNav()
            .selectSiteWikiPage()
            .render();
    logger.info("Opened Wiki page");

    return wikiPage;
  }
Example #19
0
  /**
   * Method to get LinkId
   *
   * @param drone
   * @param siteName
   * @param linkTitle
   * @return String
   */
  public static String getLinkId(WebDrone drone, String siteName, String linkTitle) {
    try {

      SiteDashboardPage site = ShareUser.openSiteDashboard(drone, siteName).render();
      LinksPage linksPage = site.getSiteNav().selectLinksPage();
      linksPage.clickLink(linkTitle);
      WebElement element = drone.findAndWait(By.xpath(LINK_TITLE_PREVIEW));
      String linkId = element.getAttribute("href").split("[?=]+")[2];
      return linkId;
    } catch (NoSuchElementException ex) {
      throw new NoSuchElementException("Element not found", ex);
    }
  }
  @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);
    }
  }
  /**
   * Navigates to the Path specified, Starting from the Repository Page. Assumes User is logged in
   * and a specific Site is open.
   *
   * @param fileName
   * @param parentFolderPath : such as Repository + file.seperator + parentFolderName1
   * @throws SkipException if error in this API
   */
  public static RepositoryPage uploadFileInFolderInRepository(WebDrone driver, String[] fileInfo)
      throws Exception {
    Integer argCount = fileInfo.length;
    if (argCount < 1) {
      throw new IllegalArgumentException("Specify at least Filename");
    } else if (argCount == 1) {
      fileInfo[1] = REPO;
    }

    openRepository(driver);
    RepositoryPage repositoryPage =
        ((RepositoryPage) ShareUser.uploadFileInFolder(driver, fileInfo)).render();
    return repositoryPage;
  }
  @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);
  }
 /**
  * Saving the google doc with the minor version and if isCreate boolean value is true for saving
  * the new google doc otherwise existing google doc.
  *
  * @param drone WebDrone
  * @param isCreateDoc boolean
  * @return SharPage
  */
 public static SharePage saveGoogleDoc(WebDrone drone, boolean isCreateDoc) {
   EditInGoogleDocsPage googleDocsPage = ShareUser.getSharePage(drone).render();
   googleDocsPage.setGoogleCreate(isCreateDoc);
   if (isGoogleDocsV3) {
     String title = googleDocsPage.getDocumentTitle();
     closeAndSwitchToShare(drone);
     SharePage currPage = ShareUser.getSharePage(drone).render();
     if (currPage instanceof DocumentDetailsPage) {
       return ((DocumentDetailsPage) currPage).clickCheckInGoogleDoc().submit().render();
     } else if (currPage instanceof DocumentLibraryPage) {
       return ((DocumentLibraryPage) currPage)
           .getFileDirectoryInfo(title)
           .selectCheckInGoogleDoc()
           .submit()
           .render();
     }
   } else {
     GoogleDocsUpdateFilePage googleUpdatefile = googleDocsPage.selectSaveToAlfresco().render();
     googleUpdatefile.render();
     googleUpdatefile.selectMinorVersionChange();
     return googleUpdatefile.submit().render();
   }
   throw new PageOperationException("Unable to save Google Doc");
 }
  public static RepositoryPage openUserFromUserHomesFolderOfRepository(
      WebDrone drone, String usrName) {
    String url = drone.getCurrentUrl();
    // http://127.0.0.1:8081/share  /page/repository#filter=path|%2FUser%2520Homes%2F
    // userEnterprise42-5405%40freetht1.test-1  |&page=1
    String target =
        url.substring(0, url.indexOf("/page/"))
            + "/page/repository#filter=path|%2FUser%2520Homes%2F"
            + StringUtils.replace(usrName, "@", "%40")
            + "|&page=1";

    drone.navigateTo(target);
    drone.waitForPageLoad(maxWaitTime);
    RepositoryPage repoPage = (RepositoryPage) ShareUser.getSharePage(drone);

    return repoPage.render();
  }
  /**
   * 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();
    }
  }
  public static EditInGoogleDocsPage createGoogleDocWithoutSave(
      WebDrone drone, String fileName, ContentType contentType) throws Exception {
    DocumentLibraryPage docLibPage = ShareUser.getSharePage(drone).render();

    GoogleDocsAuthorisation googleAuthorisationPage =
        docLibPage.getNavigation().selectCreateContent(contentType).render();
    googleAuthorisationPage.render();

    EditInGoogleDocsPage googleDocsPage = signInGoogleDocs(drone, googleAuthorisationPage);
    googleDocsPage.setGoogleCreate(true);

    if (isGoogleDocsV3) {
      googleDocsPage = switchToGoogleWindow(drone);
    }
    if (!(fileName == null)) {
      return renameGoogleDocName(fileName, googleDocsPage);
    }
    throw new PageOperationException("Filename param must not be null : error creating GoogleDoc");
  }
  /**
   * 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);
  }
  /**
   * 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);
    }
  }
 @AfterMethod(alwaysRun = true)
 public void logout() {
   ShareUser.logout(drone);
   logger.info("User logged out - drone.");
 }
 /**
  * Discarding the changes made in google doc. Methods used for edition by concurrent user's
  *
  * @param drone WebDrone
  * @return HtmlPage
  */
 public static HtmlPage discardGoogleDocsChangesOtherEditor(WebDrone drone) {
   EditInGoogleDocsPage googleDocsPage = ShareUser.getSharePage(drone).render();
   GoogleDocsDiscardChanges googleDocsDiscardChanges = googleDocsPage.selectDiscard().render();
   return googleDocsDiscardChanges.clickOkConcurrentEditorButton().render();
 }