001 package edu.samplu.krad.demo.uif.library; 002 003 import com.thoughtworks.selenium.SeleneseTestBase; 004 import edu.samplu.common.Failable; 005 import edu.samplu.common.ITUtil; 006 import edu.samplu.common.WebDriverLegacyITBase; 007 import org.kuali.rice.krad.uif.UifConstants; 008 import org.openqa.selenium.By; 009 import org.openqa.selenium.WebElement; 010 011 import java.util.List; 012 013 /** 014 * @author Kuali Rice Team (rice.collab@kuali.org) 015 */ 016 public abstract class DemoGroupSmokeTestBase extends WebDriverLegacyITBase { 017 018 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=ComponentLibraryHome"; 019 020 @Override 021 public String getTestUrl() { 022 return ITUtil.KRAD_PORTAL; 023 } 024 025 protected void navigation() throws Exception { 026 waitAndClickById("Demo-LibraryLink", ""); 027 } 028 029 protected void navigationMenu() throws Exception { 030 waitAndClickByLinkText("Containers"); 031 waitAndClickByLinkText("Group"); 032 } 033 034 public void testBasicGroupNav(Failable failable) throws Exception { 035 navigation(); 036 037 testBasicGroupBookmark(this); 038 } 039 040 /** 041 * Asserts basic group elements are present: header, validation messages, 042 * instructional text, and the actual items 043 * 044 * @param failable 045 * @throws Exception 046 */ 047 public void testBasicGroupBookmark(Failable failable) throws Exception { 048 navigationMenu(); 049 050 WebElement element = driver.findElement(By.id("Demo-Group-Example1")); 051 element.findElement(By.tagName("h3")); 052 053 getElementByDataAttributeValue(UifConstants.DataAttributes.MESSAGES_FOR, "Demo-Group-Example1"); 054 055 element.findElement(By.className("uif-instructionalMessage")); 056 057 List<WebElement> inputFields = element.findElements(By.className("uif-inputField")); 058 SeleneseTestBase.assertTrue("group does not contain correct number of items", inputFields.size() == 4); 059 } 060 }