@Test public void uploadFile() throws Exception { if (logger.isTraceEnabled()) logger.trace("====uploadFile===="); SitePage site = (SitePage) drone.getCurrentPage(); site.render(); DocumentLibraryPage docPage = site.getSiteNav().selectSiteDocumentLibrary().render(); docPage.render(); docPage = (docPage.getNavigation().selectDetailedView()).render(); Assert.assertTrue(docPage.isTitlePresent(siteName)); Assert.assertTrue(docPage.isDocumentLibrary()); UploadFilePage upLoadPage = docPage.getNavigation().selectFileUpload().render(); docPage = upLoadPage.uploadFile(file.getCanonicalPath()).render(); List<FileDirectoryInfo> results = docPage.getFiles(); if (logger.isTraceEnabled()) { logger.trace("results are not null: " + results); logger.trace("results empty: " + results.isEmpty()); } Assert.assertNotNull(results); if (results.isEmpty()) { saveScreenShot("DocumentDetailsPageTest.uploadFile.empty"); } Assert.assertFalse(results.isEmpty()); boolean isFolder = results.get(0).isTypeFolder(); Assert.assertEquals(isFolder, false); }
@SuppressWarnings("unchecked") @Override public synchronized DocumentDetailsPage render(RenderTime timer) { String docVersionOnScreen; while (true) { timer.start(); synchronized (this) { try { this.wait(100L); } catch (InterruptedException e) { } } try { if (!drone.find(By.cssSelector("div.bd")).isDisplayed()) { if (!drone.find(By.cssSelector("div.yui-dt-bd")).isDisplayed()) { docVersionOnScreen = drone.find(By.cssSelector(DOCUMENT_VERSION_PLACEHOLDER)).getText().trim(); if (this.previousVersion != null && docVersionOnScreen.equals(this.previousVersion)) { continue; } if (expectedVersion != null && !expectedVersion.isEmpty()) { if (docVersionOnScreen.equals(this.expectedVersion)) { break; } } break; } } } catch (TimeoutException te) { throw new PageException("Document version not rendered in time", te); } catch (NoSuchElementException te) { } catch (StaleElementReferenceException e) { } finally { timer.end(); } } this.documentVersion = docVersionOnScreen; return this; }
DocumentDetailsPage extends DetailsPage { @SuppressWarnings("unchecked") @Override public synchronized DocumentDetailsPage render(RenderTime timer) { String docVersionOnScreen; while (true) { timer.start(); synchronized (this) { try { this.wait(100L); } catch (InterruptedException e) { } } try { if (!drone.find(By.cssSelector("div.bd")).isDisplayed()) { if (!drone.find(By.cssSelector("div.yui-dt-bd")).isDisplayed()) { docVersionOnScreen = drone.find(By.cssSelector(DOCUMENT_VERSION_PLACEHOLDER)).getText().trim(); if (this.previousVersion != null && docVersionOnScreen.equals(this.previousVersion)) { continue; } if (expectedVersion != null && !expectedVersion.isEmpty()) { if (docVersionOnScreen.equals(this.expectedVersion)) { break; } } break; } } } catch (TimeoutException te) { throw new PageException("Document version not rendered in time", te); } catch (NoSuchElementException te) { } catch (StaleElementReferenceException e) { } finally { timer.end(); } } this.documentVersion = docVersionOnScreen; return this; } }
DocumentDetailsPage extends DetailsPage { @SuppressWarnings("unchecked") @Override public synchronized DocumentDetailsPage render(RenderTime timer) { String docVersionOnScreen; while (true) { timer.start(); synchronized (this) { try { this.wait(100L); } catch (InterruptedException e) { } } try { if (!drone.find(By.cssSelector("div.bd")).isDisplayed()) { if (!drone.find(By.cssSelector("div.yui-dt-bd")).isDisplayed()) { docVersionOnScreen = drone.find(By.cssSelector(DOCUMENT_VERSION_PLACEHOLDER)).getText().trim(); if (this.previousVersion != null && docVersionOnScreen.equals(this.previousVersion)) { continue; } if (expectedVersion != null && !expectedVersion.isEmpty()) { if (docVersionOnScreen.equals(this.expectedVersion)) { break; } } break; } } } catch (TimeoutException te) { throw new PageException("Document version not rendered in time", te); } catch (NoSuchElementException te) { } catch (StaleElementReferenceException e) { } finally { timer.end(); } } this.documentVersion = docVersionOnScreen; return this; } DocumentDetailsPage(WebDrone drone);  DocumentDetailsPage(WebDrone drone, final String previousVersion); }
DocumentDetailsPage extends DetailsPage { @SuppressWarnings("unchecked") @Override public synchronized DocumentDetailsPage render(RenderTime timer) { String docVersionOnScreen; while (true) { timer.start(); synchronized (this) { try { this.wait(100L); } catch (InterruptedException e) { } } try { if (!drone.find(By.cssSelector("div.bd")).isDisplayed()) { if (!drone.find(By.cssSelector("div.yui-dt-bd")).isDisplayed()) { docVersionOnScreen = drone.find(By.cssSelector(DOCUMENT_VERSION_PLACEHOLDER)).getText().trim(); if (this.previousVersion != null && docVersionOnScreen.equals(this.previousVersion)) { continue; } if (expectedVersion != null && !expectedVersion.isEmpty()) { if (docVersionOnScreen.equals(this.expectedVersion)) { break; } } break; } } } catch (TimeoutException te) { throw new PageException("Document version not rendered in time", te); } catch (NoSuchElementException te) { } catch (StaleElementReferenceException e) { } finally { timer.end(); } } this.documentVersion = docVersionOnScreen; return this; } 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 { @SuppressWarnings("unchecked") @Override public synchronized DocumentDetailsPage render(RenderTime timer) { String docVersionOnScreen; while (true) { timer.start(); synchronized (this) { try { this.wait(100L); } catch (InterruptedException e) { } } try { if (!drone.find(By.cssSelector("div.bd")).isDisplayed()) { if (!drone.find(By.cssSelector("div.yui-dt-bd")).isDisplayed()) { docVersionOnScreen = drone.find(By.cssSelector(DOCUMENT_VERSION_PLACEHOLDER)).getText().trim(); if (this.previousVersion != null && docVersionOnScreen.equals(this.previousVersion)) { continue; } if (expectedVersion != null && !expectedVersion.isEmpty()) { if (docVersionOnScreen.equals(this.expectedVersion)) { break; } } break; } } } catch (TimeoutException te) { throw new PageException("Document version not rendered in time", te); } catch (NoSuchElementException te) { } catch (StaleElementReferenceException e) { } finally { timer.end(); } } this.documentVersion = docVersionOnScreen; return this; } 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; }