@Test(groups = "Enterprise-only") public void testSearchUser() throws Exception { List<String> searchUsers; membersPage.searchUser(userNameTest); RenderTime t = new RenderTime(30000); try { while (true) { t.start(); try { searchUsers = membersPage.searchUser(userNameTest); if (searchUsers != null) { break; } } finally { t.end(); } } } catch (PageRenderTimeException e) { saveScreenShot("InviteMembersPage.testSearchUser"); throw new TestNGException("failed to render in time"); } user = searchUsers.get(0); Assert.assertNotNull(user); Assert.assertTrue(user.contains(userNameTest)); }
public List<String> searchUser(String userName) { if (logger.isTraceEnabled()) { logger.trace("Members page: searchUser :" + userName); } if (userName == null || userName.trim().isEmpty()) { throw new UnsupportedOperationException("userName input required"); } try { WebElement searchTextBox = drone.findAndWait(By.cssSelector(SEARCH_USER_ROLE_TEXT)); searchTextBox.clear(); searchTextBox.sendKeys(userName); drone.findAndWait(By.cssSelector(SEARCH_USER_ROLE_BUTTON)).click(); logger.info("Waiting for max: " + 7000/1000 + " seconds"); canResume(7000); List<WebElement> users = getListOfInvitees(); if (users != null && !users.isEmpty()) { List<String> userNames = new ArrayList<String>(); for (WebElement element : users) { userNames.add(element.findElement(SEARCH_USER_FROM_LIST).getText()); } return userNames; } } catch (NoSuchElementException e) { if (logger.isTraceEnabled()) { logger.trace("Unable to find the username for the userElement.", e); } } return Collections.emptyList(); }
InviteMembersPage extends SharePage { public List<String> searchUser(String userName) { if (logger.isTraceEnabled()) { logger.trace("Members page: searchUser :" + userName); } if (userName == null || userName.trim().isEmpty()) { throw new UnsupportedOperationException("userName input required"); } try { WebElement searchTextBox = drone.findAndWait(By.cssSelector(SEARCH_USER_ROLE_TEXT)); searchTextBox.clear(); searchTextBox.sendKeys(userName); drone.findAndWait(By.cssSelector(SEARCH_USER_ROLE_BUTTON)).click(); logger.info("Waiting for max: " + 7000/1000 + " seconds"); canResume(7000); List<WebElement> users = getListOfInvitees(); if (users != null && !users.isEmpty()) { List<String> userNames = new ArrayList<String>(); for (WebElement element : users) { userNames.add(element.findElement(SEARCH_USER_FROM_LIST).getText()); } return userNames; } } catch (NoSuchElementException e) { if (logger.isTraceEnabled()) { logger.trace("Unable to find the username for the userElement.", e); } } return Collections.emptyList(); } }
InviteMembersPage extends SharePage { public List<String> searchUser(String userName) { if (logger.isTraceEnabled()) { logger.trace("Members page: searchUser :" + userName); } if (userName == null || userName.trim().isEmpty()) { throw new UnsupportedOperationException("userName input required"); } try { WebElement searchTextBox = drone.findAndWait(By.cssSelector(SEARCH_USER_ROLE_TEXT)); searchTextBox.clear(); searchTextBox.sendKeys(userName); drone.findAndWait(By.cssSelector(SEARCH_USER_ROLE_BUTTON)).click(); logger.info("Waiting for max: " + 7000/1000 + " seconds"); canResume(7000); List<WebElement> users = getListOfInvitees(); if (users != null && !users.isEmpty()) { List<String> userNames = new ArrayList<String>(); for (WebElement element : users) { userNames.add(element.findElement(SEARCH_USER_FROM_LIST).getText()); } return userNames; } } catch (NoSuchElementException e) { if (logger.isTraceEnabled()) { logger.trace("Unable to find the username for the userElement.", e); } } return Collections.emptyList(); } InviteMembersPage(WebDrone drone); }
InviteMembersPage extends SharePage { public List<String> searchUser(String userName) { if (logger.isTraceEnabled()) { logger.trace("Members page: searchUser :" + userName); } if (userName == null || userName.trim().isEmpty()) { throw new UnsupportedOperationException("userName input required"); } try { WebElement searchTextBox = drone.findAndWait(By.cssSelector(SEARCH_USER_ROLE_TEXT)); searchTextBox.clear(); searchTextBox.sendKeys(userName); drone.findAndWait(By.cssSelector(SEARCH_USER_ROLE_BUTTON)).click(); logger.info("Waiting for max: " + 7000/1000 + " seconds"); canResume(7000); List<WebElement> users = getListOfInvitees(); if (users != null && !users.isEmpty()) { List<String> userNames = new ArrayList<String>(); for (WebElement element : users) { userNames.add(element.findElement(SEARCH_USER_FROM_LIST).getText()); } return userNames; } } catch (NoSuchElementException e) { if (logger.isTraceEnabled()) { logger.trace("Unable to find the username for the userElement.", e); } } return Collections.emptyList(); } InviteMembersPage(WebDrone drone); @SuppressWarnings("unchecked") @Override InviteMembersPage render(RenderTime timer); @SuppressWarnings("unchecked") @Override InviteMembersPage render(); @SuppressWarnings("unchecked") @Override InviteMembersPage render(final long time); InviteMembersPage renderWithUserSearchResults(final long time); InviteMembersPage renderWithUserSearchResults(); InviteMembersPage renderWithUserSearchResults(RenderTime timer); boolean titlePresent(); List<String> searchUser(String userName); InviteMembersPage clickAddUser(String user); InviteMembersPage selectInviteeAndAssignRole(String user, UserRole role); InviteMembersPage clickInviteButton(); InviteMembersPage selectRole(String user, UserRole role); SiteGroupsPage navigateToSiteGroupsPage(); void removeUserFromInvite(String userName); void selectRoleForAll(UserRole role); boolean isAddButtonEnabledFor(String userName); boolean isInviteButtonEnabled(); boolean isSelectRoleEnabledFor(String userName); boolean isRemoveIconEnabledFor(String userName); SiteMembersPage navigateToMembersSitePage(); PendingInvitesPage navigateToPendingInvitesPage(); void invExternalUser(String firstName, String lastName, String email, UserRole userRole); }
InviteMembersPage extends SharePage { public List<String> searchUser(String userName) { if (logger.isTraceEnabled()) { logger.trace("Members page: searchUser :" + userName); } if (userName == null || userName.trim().isEmpty()) { throw new UnsupportedOperationException("userName input required"); } try { WebElement searchTextBox = drone.findAndWait(By.cssSelector(SEARCH_USER_ROLE_TEXT)); searchTextBox.clear(); searchTextBox.sendKeys(userName); drone.findAndWait(By.cssSelector(SEARCH_USER_ROLE_BUTTON)).click(); logger.info("Waiting for max: " + 7000/1000 + " seconds"); canResume(7000); List<WebElement> users = getListOfInvitees(); if (users != null && !users.isEmpty()) { List<String> userNames = new ArrayList<String>(); for (WebElement element : users) { userNames.add(element.findElement(SEARCH_USER_FROM_LIST).getText()); } return userNames; } } catch (NoSuchElementException e) { if (logger.isTraceEnabled()) { logger.trace("Unable to find the username for the userElement.", e); } } return Collections.emptyList(); } InviteMembersPage(WebDrone drone); @SuppressWarnings("unchecked") @Override InviteMembersPage render(RenderTime timer); @SuppressWarnings("unchecked") @Override InviteMembersPage render(); @SuppressWarnings("unchecked") @Override InviteMembersPage render(final long time); InviteMembersPage renderWithUserSearchResults(final long time); InviteMembersPage renderWithUserSearchResults(); InviteMembersPage renderWithUserSearchResults(RenderTime timer); boolean titlePresent(); List<String> searchUser(String userName); InviteMembersPage clickAddUser(String user); InviteMembersPage selectInviteeAndAssignRole(String user, UserRole role); InviteMembersPage clickInviteButton(); InviteMembersPage selectRole(String user, UserRole role); SiteGroupsPage navigateToSiteGroupsPage(); void removeUserFromInvite(String userName); void selectRoleForAll(UserRole role); boolean isAddButtonEnabledFor(String userName); boolean isInviteButtonEnabled(); boolean isSelectRoleEnabledFor(String userName); boolean isRemoveIconEnabledFor(String userName); SiteMembersPage navigateToMembersSitePage(); PendingInvitesPage navigateToPendingInvitesPage(); void invExternalUser(String firstName, String lastName, String email, UserRole userRole);  }