001 /**
002 * Copyright 2005-2014 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 org.kuali.rice.krad.demo.travel.application;
017
018 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
019 import org.junit.Test;
020
021 /**
022 * @author Kuali Rice Team (rice.collab@kuali.org)
023 */
024 public class DemoTravelDestinationLookUpAft extends WebDriverLegacyITBase {
025
026 /**
027 * /kr-krad/lookup?methodToCall=start&dataObjectClassName=edu.sampleu.travel.dataobject.TravelDestination
028 */
029 public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=start&dataObjectClassName=edu.sampleu.travel.dataobject.TravelDestination";
030
031 /**
032 * Search
033 */
034 public static final String SEARCH = "Search";
035
036 /**
037 * Clear Values
038 */
039 public static final String CLEAR_VALUES = "Clear Values";
040
041 /**
042 * lookupCriteria[travelDestinationId]
043 */
044 public static final String DESTINATION_ID = "lookupCriteria[travelDestinationId]";
045
046 /**
047 * lookupCriteria[travelDestinationName]
048 */
049 public static final String DESTINATION_NAME = "lookupCriteria[travelDestinationName]";
050
051 @Override
052 public String getBookmarkUrl() {
053 return BOOKMARK_URL;
054 }
055
056 @Override
057 protected void navigate() throws Exception {
058 waitAndClickById("Demo-DemoLink", "");
059 waitAndClickByLinkText("Travel Destination Lookup");
060 }
061
062 protected void testTravelDestinationLookUp() throws Exception {
063 waitAndTypeByName(DESTINATION_ID,"1");
064 waitAndTypeByName(DESTINATION_NAME,"a*");
065 waitAndClickButtonByText(SEARCH);
066 waitForTextPresent("No values match this search.");
067 waitForTextPresent("You have entered the primary key for this table (Id) in the search criteria. Since these fields can be used to uniquely identify a row in this table, the other search criteria entered will be ignored.");
068 waitAndClickButtonByText(CLEAR_VALUES);
069 waitAndClickByXpath("//input[@name='lookupCriteria[active]' and @value='Y']");
070 waitAndClickButtonByText(SEARCH);
071 String activeResults [] ={"10000","Colorado","United States","Colorado","true"};
072 Thread.sleep(1000); //Required as the below method "only waits for first element" in array. Here first element gets loaded and second takes a while.
073 assertTextPresent(activeResults);
074 }
075
076 @Test
077 public void testTravelDestinationLookUpBookmark() throws Exception {
078 testTravelDestinationLookUp();
079 passed();
080 }
081
082 @Test
083 public void testTravelDestinationLookUpNav() throws Exception {
084 testTravelDestinationLookUp();
085 passed();
086 }
087 }