/**
  * 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();
 }
 /**
  * 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);
 }
  @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");
  }
 /**
  * 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();
 }