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.lookupviews.lookup; 017 018 import edu.samplu.common.Failable; 019 import edu.samplu.common.SmokeTestBase; 020 import org.junit.Test; 021 022 /** 023 * @author Kuali Rice Team (rice.collab@kuali.org) 024 */ 025 public class DemoLookUpSmokeTest extends SmokeTestBase { 026 027 /** 028 * /kr-krad/lookup?methodToCall=start&viewId=LookupSampleView&hideReturnLink=true 029 */ 030 public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=start&viewId=LookupSampleView&hideReturnLink=true"; 031 032 /** 033 * lookupCriteria[number] 034 */ 035 private static final String LOOKUP_CRITERIA_NUMBER_NAME="lookupCriteria[number]"; 036 037 /** 038 * Search 039 */ 040 private static final String SEARCH="Search"; 041 042 /** 043 * Clear Values 044 */ 045 private static final String CLEAR_VALUES="Clear Values"; 046 047 @Override 048 public String getBookmarkUrl() { 049 return BOOKMARK_URL; 050 } 051 052 @Override 053 protected void navigate() throws Exception { 054 waitAndClickById("Demo-DemoLink", ""); 055 waitAndClickByLinkText("Lookup"); 056 } 057 058 protected void testLookUp() throws InterruptedException { 059 waitAndTypeByName(LOOKUP_CRITERIA_NUMBER_NAME,"a1"); 060 waitAndClickButtonByText(SEARCH); 061 Thread.sleep(3000); 062 assertElementPresentByXpath("//a[contains(text(), 'a1')]"); 063 waitAndClickButtonByText(CLEAR_VALUES); 064 waitAndClickButtonByText(SEARCH); 065 Thread.sleep(3000); 066 assertElementPresentByXpath("//a[contains(text(), 'a1')]"); 067 assertElementPresentByXpath("//a[contains(text(), 'a2')]"); 068 } 069 070 @Test 071 public void testLookUpBookmark() throws Exception { 072 testLookUp(); 073 passed(); 074 } 075 076 @Test 077 public void testLookUpNav() throws Exception { 078 testLookUp(); 079 passed(); 080 } 081 }