public void TODOXHTML_testAttachmentLink() { Attachment attachment = new Attachment(testPage, testImage); attachment.setId(rpc.createAttachment(attachment)); rpc.flushIndexQueue(); editor.createPage(testSpace); testContent = testImage; searchText = "Starry"; link = new EditorLink("attachment", "" + attachment.getId(), testImage.getTitle(), testImage.getDownloadUrl()); this.isAttachment = true; runAutocomplete(); }
private void runAutocompleteForAttachmentOnBlogPost() { String pdfName = "blogstar.jpg"; Attachment attachment = new Attachment(testBlogPost, pdfName, Attachment.PNG_TYPE, "", Classpath.getBytes(testImage.getFilename())); rpc.logIn(adminUser); rpc.createAttachment(attachment); rpc.flushIndexQueue(); testContent = attachment; imageInHref = pdfName; runAutocomplete(); } }
/** * Asserts whether or not the test image displayed on the current page has a thumbnail * image source. */ private void assertThumbnail(boolean thumbnailExpected) { assertThat.attributeContainsValue("css=.confluence-embedded-image", "src", thumbnailExpected ? testImage.getThumbnailUrl() : testImage.getDownloadUrl()); }
@Override protected Attachment getAttachment(ContentEntity ce) { String attachmentName = TEST_SWF; byte[] swfBytes = Classpath.getBytes(attachmentName); return new Attachment(ce, attachmentName, RESOURCE_TYPE, "", swfBytes); }
@Override public ImagePropertyPanel launchFromClickOnElement() { return ImagePropertyPanel.launchFromClickOnImage(tinyMce, testImage.getFilename()); }
public void testImageInMacroBody() { rpc.logIn(adminUser); rpc.createAttachment(testImage); testPage.setContent("{" + macroName + "}" + testImage.getImageMarkup() + "\\ *some bold text* {" + macroName + "}"); rpc.savePage(testPage); editor.edit(testPage); // click on the image, make sure it doesn't trigger the macro property panel ImagePropertyPanel.launchFromClickOnImage(tinyMce, testImage.getFilename()); assertFalse(tinyMce.isMacroPropertyPanelPresent()); assertMacroPropertyPanel(); }
private void assertImageWithoutBorder(Attachment image) { // assert the border attribute, for some reason asserting the style attribute doesn't work // maybe a jquery bug? tinyMce.waitForSelectorPresent("img[data-linked-resource-id=\"" + image.getId() + "\"][border!=\"1\"]"); }
@Test(enabled = false) public void TODOXHTML_testPreviewExpandsToFitContent() throws Exception { rpc.logIn(adminUser); rpc.createAttachment(testImage); rpc.grantPermission(SpacePermission.PAGE_EDIT, testSpace, testUser); editor.logInAndEdit(testUser, testPage); editorPreview = editor.switchToPreview(); client.waitForCondition("$('#previewArea iframe').height() == 480"); // default height testPage.setContent(testImage.getImageMarkup() + "\n\n" + testImage.getImageMarkup() + "\n\n" + testImage.getImageMarkup()); rpc.savePage(testPage); editor.edit(testPage); editor.switchToPreview(); client.waitForCondition("$('#previewArea iframe').height() > 1000"); }
String expectedHeight = specifiedHeight != null ? specifiedHeight : getDefaultHeight(); String resourceType = getResourceType(); String embeddedSelector = MessageFormat.format("object[type=\"{0}\"][data*=\"{1}\"][width=\"{2}\"][height=\"{3}\"]", resourceType, attachment.getFilename(), expectedWidth, expectedHeight); final ContentEntity contentEntity = attachment.getPage(); String title = null; if (!(contentEntity instanceof Draft))
public void clickResult(TitledContent contentEntity) { String title = contentEntity.getTitle(); if (contentEntity instanceof AbstractContentEntity) { AbstractContentEntity entity = (AbstractContentEntity) contentEntity; title = title + " (" + entity.getSpace().getName() + ")"; } else if(contentEntity instanceof Attachment) { Attachment attachment = (Attachment) contentEntity; ContentEntity ownerContent = attachment.getPage(); // not sure why drafts don't have space names in the title if (ownerContent != null && !(ownerContent instanceof Draft) && attachment.getPage().getSpace() != null) { title = title + " (" + attachment.getPage().getSpace().getName() + ")"; } } clickItem(title); }
@Override protected Attachment getAttachment(ContentEntity ce) { String attachmentName = TEST_WMA; byte[] swfBytes = Classpath.getBytes(attachmentName); return new Attachment(ce, attachmentName, RESOURCE_TYPE, "", swfBytes); }
@Override protected ImagePropertyPanel launchFromClickOnElement() { return ImagePropertyPanel.launchFromClickOnImage(tinyMce, testImage.getFilename()); }
@Override protected void setUp() throws Exception { super.setUp(); // set up page with image rpc.logIn(adminUser); rpc.createAttachment(testImage); testPage.setContent(testImage.getImageMarkup()); rpc.savePage(testPage); editor = new Editor(client, suite); tinyMce = editor.logInAndEdit(testUser, testPage); tinyMce.waitForImage(testImage); propertyPanel = ImagePropertyPanel.launchFromClickOnImage(tinyMce, testImage.getFilename()); }
/** * Wait for the specified image to load. Waits until an image has loaded that contains the given string in it's src * attribute. * @param image The image that should be present in the editor. */ public void waitForImage(Attachment image) { waitForCondition("$(\"img[data-linked-resource-id='" + image.getId() + "']\", doc).prop('complete') == true"); }
@Test(enabled = false) public void TODOXHTML_testClosePanelOnScroll() throws Exception { testPage.setContent("a\nb\nc\nd\ne\nf\ng\nh\ni\nj\nk\nl\nm\nn\no\np\nq\nr\ns\nt\nu\nv\nw\nx\ny\nz\n" + testImage.getImageMarkup()); rpc.savePage(testPage); editor.edit(testPage); tinyMce.scrollTopTo(1000); launchFromClickOnElement(); tinyMce.scrollTopTo(0); waitUntilPropertyPanelGone(); }
public void testClickSmallButtonForTallImage() { Attachment tallImage = new Attachment(testPage, "sunflowers.jpg", "image/jpeg", "sunflowers.jpg"); rpc.createAttachment(tallImage); editor.setContent(""); InsertImageDialog dialog = editor.insertImage(); dialog.chooseImage(tallImage.getFilename()); dialog.clickInsert(); ImagePropertyPanel ppanel = ImagePropertyPanel.launchFromClickOnImage(tinyMce, tallImage.getFilename()); ppanel.clickSmallButton(); assertImageWithSize(tallImage, ImagePropertyPanel.Size.HEIGHT_SMALL, true); }
@Override protected Attachment getAttachment(ContentEntity ce) { String attachmentName = TEST_WMV; byte[] swfBytes = Classpath.getBytes(attachmentName); return new Attachment(ce, attachmentName, RESOURCE_TYPE, "", swfBytes); }
public void selectAttachment(Attachment attachment) { client.getEval("$('#attachments-table .title-field:contains(" + attachment.getFilename() + ")').click();"); }
private void assertImageWithBorder(Attachment image) { tinyMce.waitForSelectorPresent("img[data-linked-resource-id=\"" + image.getId() + "\"][border=\"1\"]"); }
public void testTableCellContentsPersistOnSave() { rpc.logIn(adminUser); rpc.createAttachment(testImage); String content = "|| Col1 || Col2 || Col3 ||\n" + "| {cheese} | {cheese} | :) |\n" + "| {info} _text_ {info} | h6. Testing \\\\ [Row 3|TST:Home] | :) |\n" + "| " + testImage.getImageMarkup() + " | " + testImage.getImageMarkup() + " | (y) |"; testPage.setContent(content); rpc.savePage(testPage); editor.logInAndEdit(testUser, testPage); editor.save(); assertTableCellsNotEmpty(); editor.edit(testPage); assertEditorTableCellsNotEmpty(12); }