/** * Located at the root of a space (i.e. no parent page). */ public Location(Space space) { this(space.getKey(), ""); }
public String getEditSpaceStylesheetUrl(Space space) { return "/spaces/editstylesheet.action?key=" + space.getKey(); } }
public Location(Space space, String parentPageTitle) { this(space.getKey(), parentPageTitle); }
public TinyMce logInAndCreateEditorTemplate(User user, Space space) { logInAndEdit(user, CREATE_EDITOR_TEMPLATE_URL + space.getKey()); return tinyMce; }
public void testSpaceKeyField() throws Exception { // Depending on the parameter field width, long space names might be truncated and not match correctly. String shortSpaceName = testSpace.getName().substring(0, 10); fieldTest("popular-labels", "spaceKey", shortSpaceName, testSpace.getKey()); }
public void assertLinkInserted(String linkText, BlogPost blog) { Date now = new Date(); SimpleDateFormat format = new SimpleDateFormat("/yyyy/MM/dd/"); String linkMarkup = blog.getSpace().getKey() + ":" + format.format(now) + blog.getTitle(); assertLinkInserted(linkText); }
public Location(Page parentPage) { this(parentPage.getSpace().getKey(), parentPage.getTitle()); }
@Override protected void setUp() throws Exception { super.setUp(); suite.logIn(adminUser); client.open("/spaces/editspacepermissions.action?key=" + testSpace.getKey()); }
private void runMediaAutoCompleteTest(String mediaFile) { Attachment attachment = new Attachment(testPage, mediaFile, Attachment.SWF_TYPE, "", Classpath.getBytes(mediaFile)); rpc.logIn(adminUser); rpc.createAttachment(attachment); rpc.flushIndexQueue(); testContent = attachment; searchText = mediaFile; editor.createPage(testSpace); autocompleteSearchAndSelect(); Map<String,String> expectedParameters = new HashMap<String,String>(3); expectedParameters.put("page", testPage.getTitle()); expectedParameters.put("name", mediaFile); expectedParameters.put("space", testSpace.getKey()); assertEquals("Expected macro placeholder not found.", expectedParameters, editor.getMacroParameters("multimedia")); }
@Override protected void setUp() throws Exception { super.setUp(); editor = new Editor(client, suite); rpc.logIn(adminUser); rpc.createPage(testSpace.getKey(), "Another page", "", 0); rpc.flushIndexQueue(); }
private void assertPopupContents(Page page) { assertTinyUrl(page); client.waitForFunction(String.format("var link = $('#link-popup-field-link').val();" + "return link.indexOf('%s/display/%s/%s') == 0 || link.indexOf('%s/pages/viewpage.action?pageId=%d') == 0", getBaseUrl(), page.getSpace().getKey(), urlEncode(page.getTitle()), getBaseUrl(), page.getId())); }
private void assertPopupContents(BlogPost blogPost) { assertTinyUrl(blogPost); client.waitForCondition(String.format("!!$('#link-popup-field-link').val().match(new RegExp('^%s/display/%s\\/.+\\/%s$'))", getBaseUrl(), regexEscape(blogPost.getSpace().getKey()), regexEscape(urlEncode(blogPost.getTitle())))); }
public void testInsertViewFileMacroFromAutocomplete() throws Exception { String pdfName = "beesonflowers.pdf"; Attachment attachment = new Attachment(testPage, pdfName, Attachment.PDF_TYPE, "", Classpath.getBytes(pdfName)); rpc.logIn(adminUser); rpc.createAttachment(attachment); rpc.flushIndexQueue(); testContent = attachment; searchText = "bees"; editor.createPage(testSpace); setAndSelectText(searchText); editorAutocomplete = triggerWithShortcut(); editorAutocomplete.pressEnter(); Map<String,String> expectedParameters = new HashMap<String,String>(3); expectedParameters.put("page", testPage.getTitle()); expectedParameters.put("name", pdfName); expectedParameters.put("space", testSpace.getKey()); assertEquals("Expected macro placeholder not found.", expectedParameters, editor.getMacroParameters("viewpdf")); }
public void testGroupPickerInSpacePerms() { suite.logIn(adminUser, "/spaces/editspacepermissions.action?key=" + testSpace.getKey()); client.click("grouppicker-popup-link"); popup = new GroupPickerPopup(client); popup.search(TEST_GROUP_NAME.substring(0, 4)); assertThat.textPresent(TEST_GROUP_NAME); popup.select(TEST_GROUP_NAME); popup.addGroups(); String destination = client.getEval("$('#groups-to-add-autocomplete').val()"); assertEquals(TEST_GROUP_NAME, destination); }
public void testSpaceLink() { Space space = new Space("BLAH", "<em>B</em>lah"); rpc.createSpace(space); rpc.grantAllPermissionsExceptAdmin(defaultUser, space); rpc.flushIndexQueue(); editor.createPage(space); testContent = space; searchText = space.getName().substring(0, 3); //3 characters is enough link = new EditorLink("space", space.getName(), "/display/" + space.getKey()); runAutocomplete(); }
@Override protected void setUp() throws Exception { super.setUp(); rpc.logIn(testUser); rpc.createPage(testSpace.getKey(), "dummy page", "content", testPage.getId()); rpc.logIn(adminUser); rpc.flushIndexQueue(); testUserHover = new UserHoverPopup(client, testUser); adminUserHover = new UserHoverPopup(client, adminUser); }
public void testUserPickerInSpacePerms() { suite.logIn(adminUser, "/spaces/editspacepermissions.action?key=" + testSpace.getKey()); client.click("userpicker-popup-link"); popup = new UserPickerPopup(client); popup.switchToUserTab(); popup.searchForUsers(sampleUser.getUsername().substring(0, 4)); assertThat.textPresent(sampleUser.getFullName()); popup.select(sampleUser); popup.addUsers(); String destination = client.getEval("$('#users-to-add-autocomplete').val()"); assertEquals(sampleUser.getUsername(), destination); }
public void testCurrentSpaceAppearsInOptionsWhenEditingBlog() { rpc.logIn(adminUser); rpc.grantPermission(SpacePermission.BLOG_EDIT, testSpace, testUser); editor.logInAndEdit(testUser, testBlogPost); LinkBrowser dialog = editor.openLinkBrowser(); dialog.selectTab(LinkBrowser.Tab.SEARCH); assertEquals("", dialog.getSpaceSelected()); dialog.selectSearchSpace(testSpace.getName()); assertEquals(testSpace.getKey(), dialog.getSpaceSelected()); }
public void testConfluenceContentField() throws Exception { fieldTest("contributors", "page", testPage.getTitle(), testPage.getTitle()); // Test the ConfluenceContent field for content in a different space Space monkeySpace = new Space("MKY", "Monkey Trousers"); rpc.createSpace(monkeySpace); rpc.grantPermission(SpacePermission.VIEW, monkeySpace, testUser); Page monkeyPage = new Page(monkeySpace, "tweet", "munky trousers!"); rpc.createPage(monkeyPage); rpc.flushIndexQueue(); fieldTest("contributors", "page", monkeyPage.getTitle(), monkeySpace.getKey() + ":" + monkeyPage.getTitle()); }
public void testEditExistingAttachmentOnOtherPageLink() { rpc.logIn(adminUser); rpc.createAttachment(testImage); String content = "[" + testSpace.getKey() + ":" + testPage.getTitle() + "^" + testImage.getFilename() + "]"; Page pageWithoutImage = new Page(testSpace, "Gets the picture", content); rpc.savePage(pageWithoutImage); editor.logInAndEdit(testUser, pageWithoutImage); tinyMce.selectFirstElementWithSelector("a"); LinkBrowser dialog = editor.openLinkBrowser(); assertEquals(EDIT_TITLE, dialog.getTitle()); assertEquals("Save", dialog.getInsertButtonText()); assertEquals(SEARCH, dialog.getSelectedTab()); assertEquals(testImage.getFilename(), dialog.getTextInAlias()); dialog.clickCancel(); }