001/* 002 * Copyright 2005-2013 The Kuali Foundation 003 * 004 * Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php 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 */ 016package edu.samplu.krad.demo.uif.library; 017 018import com.thoughtworks.selenium.SeleneseTestBase; 019import edu.samplu.common.Failable; 020import org.junit.Test; 021import org.kuali.rice.krad.uif.UifConstants; 022import org.openqa.selenium.By; 023import org.openqa.selenium.WebElement; 024 025import java.util.List; 026 027/** 028 * @author Kuali Rice Team (rice.collab@kuali.org) 029 */ 030public class DemoLibraryGroupSmokeTest extends DemoLibraryBase { 031 032 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=ComponentLibraryHome"; 033 034 @Override 035 public String getBookmarkUrl() { 036 return BOOKMARK_URL; 037 } 038 039 @Override 040 protected void navigate() throws Exception { 041 waitAndClickById("Demo-LibraryLink", ""); 042 } 043 044 protected void navigationMenu() throws Exception { 045 waitAndClickByLinkText("Containers"); 046 waitAndClickByLinkText("Group"); 047 } 048 049 public void testBasicGroupNav(Failable failable) throws Exception { 050 testBasicGroupBookmark(this); 051 } 052 053 /** 054 * Asserts basic group elements are present: header, validation messages, 055 * instructional text, and the actual items 056 * 057 * @param failable 058 * @throws Exception 059 */ 060 public void testBasicGroupBookmark(Failable failable) throws Exception { 061 navigationMenu(); 062 063 WebElement element = driver.findElement(By.id("Demo-Group-Example1")); 064 element.findElement(By.tagName("h3")); 065 066 getElementByDataAttributeValue(UifConstants.DataAttributes.MESSAGES_FOR, "Demo-Group-Example1"); 067 068 element.findElement(By.className("uif-instructionalMessage")); 069 070 List<WebElement> inputFields = element.findElements(By.className("uif-inputField")); 071 SeleneseTestBase.assertTrue("group does not contain correct number of items", inputFields.size() == 4); 072 passed(); 073 } 074 075 @Test 076 public void testBasicGroupBookmark() throws Exception { 077 testBasicGroupBookmark(this); 078 } 079 080 @Test 081 public void testBasicGroupNav() throws Exception { 082 testBasicGroupNav(this); 083 } 084}