001/* 002 * (C) Copyright 2015 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 * 016 * Contributors: 017 * Nelson Silva 018 */ 019package org.nuxeo.functionaltests.pages.admincenter.usermanagement; 020 021import org.nuxeo.functionaltests.AbstractTest; 022import org.nuxeo.functionaltests.Required; 023import org.openqa.selenium.By; 024import org.openqa.selenium.NoSuchElementException; 025import org.openqa.selenium.WebDriver; 026import org.openqa.selenium.WebElement; 027import org.openqa.selenium.support.FindBy; 028 029/** 030 * Groups Tab Page of the users & groups management 031 * 032 * @since 7.2 033 */ 034public class GroupsTabSubPage extends UsersGroupsBasePage { 035 036 @Required 037 @FindBy(id = "groupsListingView:createGroupActionsForm:createGroupButton") 038 WebElement createNewGroupLink; 039 040 @FindBy(id = "groupsListingView:searchForm:searchText") 041 WebElement searchInput; 042 043 @FindBy(id = "groupsListingView:searchForm:searchButton") 044 WebElement searchButton; 045 046 public GroupsTabSubPage(WebDriver driver) { 047 super(driver); 048 } 049 050 public GroupCreationFormPage getGroupCreatePage() { 051 createNewGroupLink.click(); 052 return asPage(GroupCreationFormPage.class); 053 } 054 055 public GroupsTabSubPage searchGroup(String query) { 056 searchInput.clear(); 057 searchInput.sendKeys(query); 058 searchButton.submit(); 059 return asPage(GroupsTabSubPage.class); 060 } 061 062 /** 063 * Checks if the group was found in the last search result page. 064 */ 065 public boolean isGroupFound(String groupname) { 066 try { 067 findElementWithTimeout(By.linkText(groupname), AbstractTest.LOAD_SHORT_TIMEOUT_SECONDS * 1000); 068 } catch (NoSuchElementException e) { 069 return false; 070 } 071 return true; 072 } 073 074 public GroupViewTabSubPage viewGroup(String groupname) { 075 findElementWithTimeout(By.linkText(groupname)).click(); 076 return asPage(GroupViewTabSubPage.class); 077 } 078 079}