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 */ 016 package edu.samplu.krad.demo.travel.account.lookup.autosearch; 017 018 import org.kuali.rice.testtools.selenium.ITUtil; 019 import org.kuali.rice.testtools.selenium.SmokeTestBase; 020 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase; 021 import org.junit.Test; 022 023 /** 024 * @author Kuali Rice Team (rice.collab@kuali.org) 025 */ 026 public abstract class DemoTravelAccountLookUpAutoSearchSmokeTest extends SmokeTestBase { 027 028 /** 029 * /kr-krad/lookup?methodToCall=search&dataObjectClassName=org.kuali.rice.krad.demo.travel.dataobject.TravelAccount&lookupCriteria['number']=a*&readOnlyFields=number&hideReturnLink=true&showMaintenanceLinks=true 030 */ 031 public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=search&dataObjectClassName=org.kuali.rice.krad.demo.travel.dataobject.TravelAccount&lookupCriteria['number']=a*&readOnlyFields=number&hideReturnLink=true&showMaintenanceLinks=true"; 032 033 /** 034 * Search 035 */ 036 public static final String SEARCH = "Search"; 037 038 /** 039 * Clear Values 040 */ 041 public static final String CLEAR_VALUES = "Clear Values"; 042 043 @Override 044 public String getBookmarkUrl() { 045 return BOOKMARK_URL; 046 } 047 048 protected void navigation() throws Exception { 049 waitAndClickById("Demo-DemoLink", ""); 050 waitAndClickByLinkText("Account Lookup Auto Search"); 051 } 052 053 protected void testDemoTravelAccountLookUpAutoSearch() throws Exception { 054 assertElementPresentByXpath("//a[contains(text(), 'a1')]"); 055 assertElementPresentByXpath("//a[contains(text(), 'a2')]"); 056 assertElementPresentByXpath("//a[contains(text(), 'a3')]"); 057 waitAndTypeByName("lookupCriteria[foId]","1"); 058 waitAndClickButtonByText(SEARCH); 059 Thread.sleep(3000); 060 assertElementPresentByXpath("//a[contains(text(), 'a1')]"); 061 if(isElementPresentByLinkText("a2") || isElementPresentByLinkText("a3")) { 062 fail("Search Functionality not working properly."); 063 } 064 } 065 066 @Test 067 public void testDemoTravelAccountLookUpAutoSearchNav() throws Exception { 068 testDemoTravelAccountLookUpAutoSearch(); 069 passed(); 070 } 071 072 @Test 073 public void testDemoTravelAccountLookUpAutoSearchBookmark() throws Exception { 074 testDemoTravelAccountLookUpAutoSearch(); 075 passed(); 076 } 077 }