/** * Returns the sort alphabetical link locator for the given page. */ public String getSortAlphabeticallyLocator(Page page) { return "css=li#node-" + page.getId() + " a.abc"; }
private String getPageGadgetMacroMarkupForPage(Page page) { return GADGET_MARKUP_MACRO_START + GADGET_MARKUP_MACRO_BODY + page.getId() + GADGET_MARKUP_MACRO_END; }
/** * Expands the tree of the given page by clicking on the plus icon. * @param page the page to expand */ public void expandTree(Page page) { client.click("xpath=//li[@id='node-" + String.valueOf(page.getId()) + "']/div[@class='click-zone']"); }
/** * Returns the undo sort link locator for the given page */ public String getUndoLocator(Page page) { return "css=li#" + getTreeNodeLocator(page.getId()) + " a.rollback"; }
/** * Returns the first child node id of the given page. */ public String getFirstChildNode(Page page) { return client.getEval("selenium.browserbot.getCurrentWindow().jQuery('#node-" + page.getId() + " li')[0].id"); }
/** * Returns the tree node locator for the page */ public String getTreeNodeLocator(Page page) { return getTreeNodeLocator(page.getId()); }
public void waitForPage(Page page) { // wait up to 10 seconds for the tree to expand to the correct node client.waitForCondition("$('#" + tree.getTreeNodeLocator(page.getId()) + ":visible').length == 1", EXPAND_TIMEOUT_MILLIS); }
public void testFavouritePageFromMacro() { Page page = createAndFavouritePage("{favpages}"); client.open(page.getUrl()); // unfavourite page client.click("id=entityStar-" + page.getId()); client.waitForCondition("$('#entityStar-" + page.getId() + " span').hasClass('icon-add-fav')"); // favourite it again client.click("id=entityStar-" + page.getId()); client.waitForCondition("$('#entityStar-" + page.getId() + " span').hasClass('icon-remove-fav')"); // reload the page to make sure that we still have it as a favourite. client.open(page.getUrl()); assertThat.elementPresent("id=entityStar-" + page.getId()); }
public void testUnfavouritePageFromMacro() { Page page = createAndFavouritePage("{favpages}"); client.open(page.getUrl()); client.click("id=entityStar-" + page.getId()); client.waitForCondition("$('#entityStar-" + page.getId() + " span').hasClass('icon-add-fav')"); client.open(page.getUrl()); assertThat.elementNotPresent("id=entityStar-" + page.getId()); }
private void movePageAsChild(Page pageToMove, Page parentPage, Page siblingPage) { pageTree.expandTree(parentPage); client.waitForCondition("$('#node-" + siblingPage.getId() + "').length"); pageTree.movePageAsChild(pageToMove, siblingPage); }
public void testInheritedContentPermissionsOnCreatePage() { rpc.logIn(adminUser); rpc.setPageRestriction(defaultUserCanView, testPage); editor.logInAndCreateChildPage(defaultUser, testSpace, testPage.getId()); PagePermissionsEditor permissionsEditor = editor.openPermissionsEditor(); permissionsEditor.assertHasInheritedPermission(defaultUserCanView, testPage); }
private boolean hasPermission(Page page, ContentPermission contentPermission) { ContentPermissionType permissionType = contentPermission.getPermissionType(); Entity entity = contentPermission.getEntity(); ContentPermissionEntityType entityType = (entity instanceof User) ? USER : GROUP; ContentPermissionEntry testEntry = new ContentPermissionEntry(permissionType, entityType, entity.getName()); Collection<ContentPermissionEntry> contentPermissionEntries = rpc.getPagePermissions(page.getId()); for (ContentPermissionEntry contentPermissionEntry : contentPermissionEntries) { if (testEntry.toString().equals(contentPermissionEntry.toString())) return true; } return false; }
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())); }
@Ignore ("CONFDEV-24215") public void testGotoLinkLocation() throws Exception { LinkPropertyPanel ppanel = LinkPropertyPanel.launchFromClickOnLinkText(tinyMce, LINK_TEXT); ppanel.clickGotoLocationButton(); String windowID = "confluence-goto-link-" + testPage.getId() + "-1"; client.waitForPopUp(windowID, ""+ ConfluenceSeleniumConfiguration.getInstance().getPageLoadWait()); } }
public void testImageSuggestion() throws Exception { rpc.logIn(adminUser); rpc.createAttachment(testPage.getId(), testImage); rpc.flushIndexQueue(); tinyMce = editor.logInAndEditInRTE(testUser, testPage); tinyMce.selectEmptyFirstParagraph(); editorAutocomplete = EditorAutocomplete.triggerWithCharacter("!", tinyMce); editorAutocomplete.waitForResultsToContain(testImage); }
public void testImageSearch() throws Exception { rpc.logIn(adminUser); rpc.createAttachment(testPage.getId(), testImage); rpc.flushIndexQueue(); tinyMce = editor.logInAndEditInRTE(testUser, testPage); tinyMce.selectEmptyFirstParagraph(); editorAutocomplete = EditorAutocomplete.triggerWithCharacter("!", tinyMce); editorAutocomplete.type("sta"); editorAutocomplete.waitForResultsToContain(testImage); }
@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 testCurrentSpacePreferred() { searchText = "Crazy"; Space otherSpace = Space.TEST2; rpc.createSpace(otherSpace); rpc.grantPermission(SpacePermission.VIEW, otherSpace, testUserWithApostrophe); Page pageInCurrentSpace = new Page(testSpace, "Crazy talk", ""); Page pageInOtherSpace = new Page(otherSpace, "Crazy talk", ""); rpc.createPage(pageInCurrentSpace); rpc.createPage(pageInOtherSpace); //Make the other space much newer Calendar cal = Calendar.getInstance(); cal.add(Calendar.YEAR, -1); rpc.changePageModificationDate(pageInCurrentSpace.getId(), cal.getTime()); rpc.flushIndexQueue(); editor.edit(testPage); tinyMce.selectEmptyFirstParagraph(); setAndSelectText(searchText); editorAutocomplete = triggerWithShortcut(); String currentSpaceTitle = getPageResultTitle(pageInCurrentSpace); String otherSpaceTitle = getPageResultTitle(pageInOtherSpace); editorAutocomplete.waitForNthResultToContain(0, currentSpaceTitle); editorAutocomplete.waitForNthResultToContain(1, otherSpaceTitle); }
public void testViewAndEditableOptions() { String baseUrl = ConfluenceSeleniumConfiguration.getInstance().getBaseUrl(); selectPageWithPagePicker(testPage); pageGadget.setShowLink(true); pageGadget.setEditable(true); pageGadget.clickSave(); pageGadget.selectConfluencePageIframe(); client.waitForScriptsToLoad(); pageGadget.selectParentIframe(); assertThat.elementPresent("viewLink"); assertThat.elementPresent("//a[@id='viewLink'][contains(., 'View')][@href='" + baseUrl + "/pages/viewpage.action?pageId=" + testPage.getId() + "']"); assertThat.elementPresent("editLink"); assertThat.elementPresent("//a[@id='editLink'][contains(., 'Edit')][@href='" + baseUrl + "/pages/editpage.action?pageId=" + testPage.getId() + "']"); pageGadget.switchToConfig(); pageGadget.setShowLink(false); pageGadget.setEditable(false); pageGadget.clickSave(); pageGadget.selectConfluencePageIframe(); client.waitForScriptsToLoad(); pageGadget.selectParentIframe(); assertThat.elementNotPresent("viewLink"); assertThat.elementNotPresent("editLink"); }