@Test(dependsOnMethods = "removeComment") public void downloadFile() throws IOException { DocumentDetailsPage docDetailsPage = selectDocument(file).render(); newfile = File.createTempFile(fileName, fileExt); newfile.createNewFile(); docDetailsPage = docDetailsPage.selectDownload(newfile).render(); long fileSize = newfile.length(); if (fileSize < 1) saveScreenShot("DocumentDetailsPageTest.downloadFile"); Assert.assertTrue(fileSize > 0); Assert.assertTrue(docDetailsPage.isDocumentDetailsPage()); String size = docDetailsPage.getDocumentSize(); Assert.assertEquals(size, "33 bytes"); }
private String downloadFile(final String selector, boolean click) { String filePath = ""; try { WebElement link = drone.find(By.cssSelector(selector)); if (click) { link.click(); } String fileUrl = link.getAttribute("href"); if (fileUrl != null && !fileUrl.isEmpty()) { filePath = fileUrl.replace("?a=true", ""); } } catch (NoSuchElementException nse) { } return filePath; }
DocumentDetailsPage extends DetailsPage { private String downloadFile(final String selector, boolean click) { String filePath = ""; try { WebElement link = drone.find(By.cssSelector(selector)); if (click) { link.click(); } String fileUrl = link.getAttribute("href"); if (fileUrl != null && !fileUrl.isEmpty()) { filePath = fileUrl.replace("?a=true", ""); } } catch (NoSuchElementException nse) { } return filePath; } }
DocumentDetailsPage extends DetailsPage { private String downloadFile(final String selector, boolean click) { String filePath = ""; try { WebElement link = drone.find(By.cssSelector(selector)); if (click) { link.click(); } String fileUrl = link.getAttribute("href"); if (fileUrl != null && !fileUrl.isEmpty()) { filePath = fileUrl.replace("?a=true", ""); } } catch (NoSuchElementException nse) { } return filePath; } DocumentDetailsPage(WebDrone drone);  DocumentDetailsPage(WebDrone drone, final String previousVersion); }
DocumentDetailsPage extends DetailsPage { private String downloadFile(final String selector, boolean click) { String filePath = ""; try { WebElement link = drone.find(By.cssSelector(selector)); if (click) { link.click(); } String fileUrl = link.getAttribute("href"); if (fileUrl != null && !fileUrl.isEmpty()) { filePath = fileUrl.replace("?a=true", ""); } } catch (NoSuchElementException nse) { } return filePath; } DocumentDetailsPage(WebDrone drone);  DocumentDetailsPage(WebDrone drone, final String previousVersion); synchronized void setPreviousVersion(final String previousVersion); @SuppressWarnings("unchecked") @Override synchronized DocumentDetailsPage render(RenderTime timer); synchronized String getDocumentVersion(); boolean isUploadNewVersionDisplayed(); boolean isEditOfflineLinkDisplayed(); boolean isEditOfflineDisplayed(); boolean isLockedByYou(); @SuppressWarnings("unchecked") @Override DocumentDetailsPage render(); @SuppressWarnings("unchecked") @Override DocumentDetailsPage render(final long time); boolean isDocumentDetailsPage(); DocumentLibraryPage delete(); String getDocumentTitle(); HtmlPage selectUploadNewVersion(); HtmlPage getFileUpdatePage(WebDrone drone, final String version, final boolean editOffLine); WebElement getRevisionPanel(); String getCommentsOfLastCommit(); synchronized boolean isCheckedOut(); synchronized String getContentInfo(); HtmlPage selectEditOffLine(File file); EditTextDocumentPage selectInlineEdit(); HtmlPage selectDownload(File file); String getDocumentSize(); boolean isFlashPreviewDisplayed(); String getPreviewerClassName(); boolean isNoPreviewMessageDisplayed(); PdfJsPlugin getPdfJsPreview(); DocumentDetailsPage clickOnDownloadLinkForUnsupportedDocument(); HtmlPage selectSyncToCloud(); HtmlPage selectSyncToCloud(boolean isCloudSyncSetUp); boolean isSignUpDialogVisible(); boolean isDestAndAssigneeVisible(); DocumentDetailsPage selectUnSyncFromCloud(); boolean isFileSyncSetUp(); StartWorkFlowPage selectStartWorkFlowPage(); HtmlPage selectStartWorkFlowIcon(); boolean isSyncToCloudOptionDisplayed(); HtmlPage editInGoogleDocs(); HtmlPage editInGoogleDocsOldFormat(boolean confirmUpgrade); HtmlPage resumeEditInGoogleDocs(); boolean isEditInGoogleDocsLinkVisible(); boolean isResumeEditingInGoogleDocsLinkVisible(); boolean isInlineEditLinkDisplayed(); boolean isCommentCountPresent(long waitTime); boolean isHideRecordLinkDisplayed(); String getSyncStatus(); String getLocationInCloud(); boolean isRequestSyncIconDisplayed(); HtmlPage selectRevertToVersion(String versionNumber); boolean isPartOfWorkflow(); DocumentDetailsPage openCopyThisLinkInNewTab(); String getExpectedVersion(); synchronized void setExpectedVersion(String expectedVersion); ChangeTypePage selectChangeType(); void selectDownloadPreviousVersion(String versionNumber); HtmlPage clickShareLink(); boolean isFileShared(); List<WebElement> getEditControls(); boolean isViewOnGoogleMapsLinkVisible(); boolean isDownloadButtonVisible(); EditTextDocumentPage selectOnlineEdit(); HtmlPage selectDownloadFromActions(File file); boolean isViewWorkingCopyDisplayed(); List<String> getDocumentActionList(); boolean isVersionHistoryPanelPresent(); boolean isVersionPresentInVersionHistoryPanel(String version); boolean isStartWorkflowIconDisplayed(); boolean isUploadNewVersionIconDisplayed(); StartWorkFlowPage clickStartWorkflowIcon(); HtmlPage selectUploadNewVersionIcon(); HtmlPage selectViewProperties(String versionNumber); HtmlPage selectInlineHtmlEdit(); VersionDetails getCurrentVersionDetails(); List<VersionDetails> getOlderVersionDetails(); HtmlPage cancelNo(); void clickYes(); String getDocumentBody(); String getErrorEditOfflineDocument(); }
DocumentDetailsPage extends DetailsPage { private String downloadFile(final String selector, boolean click) { String filePath = ""; try { WebElement link = drone.find(By.cssSelector(selector)); if (click) { link.click(); } String fileUrl = link.getAttribute("href"); if (fileUrl != null && !fileUrl.isEmpty()) { filePath = fileUrl.replace("?a=true", ""); } } catch (NoSuchElementException nse) { } return filePath; } DocumentDetailsPage(WebDrone drone);  DocumentDetailsPage(WebDrone drone, final String previousVersion); synchronized void setPreviousVersion(final String previousVersion); @SuppressWarnings("unchecked") @Override synchronized DocumentDetailsPage render(RenderTime timer); synchronized String getDocumentVersion(); boolean isUploadNewVersionDisplayed(); boolean isEditOfflineLinkDisplayed(); boolean isEditOfflineDisplayed(); boolean isLockedByYou(); @SuppressWarnings("unchecked") @Override DocumentDetailsPage render(); @SuppressWarnings("unchecked") @Override DocumentDetailsPage render(final long time); boolean isDocumentDetailsPage(); DocumentLibraryPage delete(); String getDocumentTitle(); HtmlPage selectUploadNewVersion(); HtmlPage getFileUpdatePage(WebDrone drone, final String version, final boolean editOffLine); WebElement getRevisionPanel(); String getCommentsOfLastCommit(); synchronized boolean isCheckedOut(); synchronized String getContentInfo(); HtmlPage selectEditOffLine(File file); EditTextDocumentPage selectInlineEdit(); HtmlPage selectDownload(File file); String getDocumentSize(); boolean isFlashPreviewDisplayed(); String getPreviewerClassName(); boolean isNoPreviewMessageDisplayed(); PdfJsPlugin getPdfJsPreview(); DocumentDetailsPage clickOnDownloadLinkForUnsupportedDocument(); HtmlPage selectSyncToCloud(); HtmlPage selectSyncToCloud(boolean isCloudSyncSetUp); boolean isSignUpDialogVisible(); boolean isDestAndAssigneeVisible(); DocumentDetailsPage selectUnSyncFromCloud(); boolean isFileSyncSetUp(); StartWorkFlowPage selectStartWorkFlowPage(); HtmlPage selectStartWorkFlowIcon(); boolean isSyncToCloudOptionDisplayed(); HtmlPage editInGoogleDocs(); HtmlPage editInGoogleDocsOldFormat(boolean confirmUpgrade); HtmlPage resumeEditInGoogleDocs(); boolean isEditInGoogleDocsLinkVisible(); boolean isResumeEditingInGoogleDocsLinkVisible(); boolean isInlineEditLinkDisplayed(); boolean isCommentCountPresent(long waitTime); boolean isHideRecordLinkDisplayed(); String getSyncStatus(); String getLocationInCloud(); boolean isRequestSyncIconDisplayed(); HtmlPage selectRevertToVersion(String versionNumber); boolean isPartOfWorkflow(); DocumentDetailsPage openCopyThisLinkInNewTab(); String getExpectedVersion(); synchronized void setExpectedVersion(String expectedVersion); ChangeTypePage selectChangeType(); void selectDownloadPreviousVersion(String versionNumber); HtmlPage clickShareLink(); boolean isFileShared(); List<WebElement> getEditControls(); boolean isViewOnGoogleMapsLinkVisible(); boolean isDownloadButtonVisible(); EditTextDocumentPage selectOnlineEdit(); HtmlPage selectDownloadFromActions(File file); boolean isViewWorkingCopyDisplayed(); List<String> getDocumentActionList(); boolean isVersionHistoryPanelPresent(); boolean isVersionPresentInVersionHistoryPanel(String version); boolean isStartWorkflowIconDisplayed(); boolean isUploadNewVersionIconDisplayed(); StartWorkFlowPage clickStartWorkflowIcon(); HtmlPage selectUploadNewVersionIcon(); HtmlPage selectViewProperties(String versionNumber); HtmlPage selectInlineHtmlEdit(); VersionDetails getCurrentVersionDetails(); List<VersionDetails> getOlderVersionDetails(); HtmlPage cancelNo(); void clickYes(); String getDocumentBody(); String getErrorEditOfflineDocument(); static final String DOCUMENT_VERSION_PLACEHOLDER; }