public UserHoverPopup(ConfluenceSeleniumClient client, User user) { this.client = client; this.username = user.getUsername(); }
/** * Checks the box for the supplied user. */ public void select(User user) { select(user.getUsername()); } }
public void isUserPresent(User user) { client.waitForJQueryElementSelector("#network-pane .network-macro a.userLogoLink[data-username = \"" + user.getUsername() + "\"]"); }
public void selectUser(User user) { selectItem(user.getFullName() + " (" + user.getUsername() + ")"); }
public void waitForResultsToContainUser(User user) { waitForItem(user.getFullName() + " (" + user.getUsername() + ")"); }
public static WebResource newResource(Client client, String url, User user) { MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl(); if (user != null) // todo basic auth? { queryParams.add("os_username", user.getUsername()); queryParams.add("os_password", user.getPassword()); } WebResource webResource; if (url == null) { webResource = client.resource(TestProperties.getBaseUrl(1) + RestHelper.PROTOTYPE_REST_PATH); } else { webResource = client.resource(url); } return webResource.queryParams(queryParams); }
public void testHoverInPage() { rpc.logIn(adminUser); Page page = new Page(testSpace, "Hovers", MessageFormat.format("[~{0}] // [~{1}]", adminUser.getUsername(), testUser.getUsername())); rpc.createPage(page); suite.logIn(adminUser, page); // Test hovers for in-page links testUserHover.mouseOver(ConfluenceSeleniumClient.WIKI_CONTENT_XPATH); adminUserHover.mouseOver(ConfluenceSeleniumClient.WIKI_CONTENT_XPATH); // Test hover in metadata section above page adminUserHover.mouseOver("div[@class='page-metadata']"); }
public void testUsernameField() throws Exception { //TODO fails in OnDemand if (TestProperties.isOnDemandAlaCarte()) return; fieldTest("content-by-user", "", testUser.getFullName(), testUser.getUsername()); }
@Override protected void createTestData(ConfluenceRpc adminRpc) { userHelper.createUser(ampersandUser); adminRpc.removeSpace("~" + adminUser.getUsername()); adminRpc.flushIndexQueue(); // ensure user is indexed }
public void testCannotFollowUserFromProfile() { suite.logIn(adminUser); userHelper.removeUserFromGroup(testuser1, Group.USERS); client.open("/display/~" + testuser1.getUsername()); assertThat.elementNotPresent("id=profile-user-follow"); userHelper.addUserToGroup(testuser1, Group.USERS); client.open("/display/~" + testuser1.getUsername()); assertThat.elementPresent("id=profile-user-follow"); } }
public void testUserPickerInGlobalPerms() { suite.logIn(adminUser, "/admin/permissions/editglobalpermissions.action"); 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("$('#usersToAdd').val()"); assertEquals(sampleUser.getUsername(), destination); }
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 testFollowInHoverUserWithAmpersand() { // TODO - looks like it should work in the browser, but the mouseOver is failing. if (TestProperties.isOnDemandAlaCarte()) return; suite.logIn(testUser, "/peopledirectory.action"); // test follow UserHoverPopup ampersandUserHover = new UserHoverPopup(client, ampersandUser); ampersandUserHover.mouseOver(); ampersandUserHover.followUser(); client.open("/users/viewfollow.action?username=" + testUser.getUsername()); assertThat.textPresent("People you're following"); assertThat.elementVisible("//ul[@class='avatars']//li//a[@data-username='" + ampersandUser.getUsername() + "']"); // Test unfollow client.open("/peopledirectory.action"); ampersandUserHover.mouseOverLogo(); ampersandUserHover.unfollowUser(); client.open("/users/viewfollow.action?username=" + testUser.getUsername()); assertThat.textPresent("You are not following anyone"); }
public void testUserLink() { if (Browser.IE.equals(client.getBrowser())) { return; } editor.createPage(testSpace); testContent = testUserWithApostrophe; searchText = "Pad"; link = new EditorLink("userinfo", testUserWithApostrophe.getFullName(), "/display/~" + testUserWithApostrophe.getUsername()); runAutocomplete(); }
if (user.getUsername().equals(loggedInUser) && !TestProperties.isOnDemandAlaCarte())
public void testUserPickerPopupInManageGroups() { suite.logIn(adminUser, "/admin/users/domembersofgroupsearch.action?membersOfGroupTerm=confluence-administrators"); client.click("css=.add-user"); client.click("popup-link"); popup = new UserPickerPopup(client); popup.searchForUsers(sampleUser.getUsername()); assertThat.textPresent(sampleUser.getFullName()); popup.select(sampleUser); popup.addUsers(); String destination = client.getEval("$('#usersToAdd').val()"); assertEquals(sampleUser.getUsername(), destination); } }
client.type("os_username", user.getUsername()); client.type("os_password", user.getPassword()); if (rememberMe)
public void testRemoveEditPermissionsOnEditPage() { rpc.logIn(adminUser); rpc.setPageRestriction(defaultUserCanEdit, testPage); editor.logInAndEdit(defaultUser, testPage); PagePermissionsEditor pagePermissionsEditor = editor.openPermissionsEditor(); pagePermissionsEditor.removePermission(defaultUserCanEdit); pagePermissionsEditor.update(); editor.save(); //check that restriction is no longer displayed client.open(testPage.getPageInfoUrl()); assertThat.textNotPresent("Only " + defaultUser.getUsername() + " can edit this page"); //log in as different user and confirm can edit page suite.logOut(); editor.logInAndEdit(defaultUser, testPage); assertTrue(editor.isRichTextMode()); }
public void testRemoveViewPermissionsOnEditPage() { rpc.logIn(adminUser); ContentPermission adminCanView = this.defaultUserCanView; rpc.setPageRestriction(adminCanView, testPage); editor.logInAndEdit(defaultUser, testPage); PagePermissionsEditor pagePermissionsEditor = editor.openPermissionsEditor(); pagePermissionsEditor.removePermission(adminCanView); pagePermissionsEditor.update(); editor.save(); //check that restriction is no longer displayed client.open(testPage.getPageInfoUrl()); assertThat.textNotPresent("Only " + defaultUser.getUsername() + " can view this page"); //log in as different user and confirm can view page suite.logOut(); suite.logIn(defaultUser, testPage); assertThat.wikiContentContains(testPage.getContent()); }
public void todoTestFollowUser() { // can't make this stupid test pass - I'm at my wits end! writing a test shouldn't take half a day! // This is because when the selenium client clicks on the dropdown item, // the hidden username parameter is not populated suite.logIn(adminUser, "/users/viewfollow.action?username=admin"); AuthorAutocompleteTextField followUserBox = new AuthorAutocompleteTextField("name=follow-autocomplete", client); followUserBox.typeUserName(adminUser.getUsername()); followUserBox.waitForResultsToContainUser(adminUser); followUserBox.selectUser(adminUser); client.clickButtonWithName("follow", false); assertThat.textPresent("Now following " + adminUser.getFullName()); followUserBox.typeUserName("admin"); followUserBox.waitForResultsToContainUser(adminUser); followUserBox.selectUser(adminUser); client.clickButtonWithName("follow", false); assertThat.textPresent("Already following " + adminUser.getFullName()); }