View Javadoc
1   /**
2    * Copyright 2005-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.krad.demo.travel.application;
17  
18  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
19  import org.junit.Test;
20  
21  /**
22   * @author Kuali Rice Team (rice.collab@kuali.org)
23   */
24  public class DemoTravelMileageLookUpAft extends WebDriverLegacyITBase {
25  
26      /**
27       * /kr-krad/lookup?methodToCall=start&dataObjectClassName=edu.sampleu.travel.dataobject.TravelMileageRate
28       */
29      public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=start&dataObjectClassName=edu.sampleu.travel.dataobject.TravelMileageRate";
30  
31      /**
32       * Search
33       */
34      public static final String SEARCH = "Search";
35      
36      /**
37       * Clear Values
38       */
39      public static final String CLEAR_VALUES = "Clear Values";
40      
41      @Override
42      public String getBookmarkUrl() {
43          return BOOKMARK_URL;
44      }
45  
46      @Override
47      protected void navigate() throws Exception {
48          waitAndClickById("Demo-DemoLink", "");
49          waitAndClickByLinkText("Travel Mileage Lookup");
50      }
51  
52      protected void testTravelMileageLookUp() throws Exception {
53      	waitAndTypeByName("lookupCriteria[mileageRateId]","1");
54      	waitAndTypeByName("lookupCriteria[mileageRateCd]","a*");
55      	waitAndTypeByName("lookupCriteria[mileageRateName]","a*");
56      	waitAndClickButtonByText(SEARCH);
57      	waitForTextPresent("No values match this search.");
58      	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.");
59      	waitAndClickButtonByText(CLEAR_VALUES);
60      	waitAndClickByXpath("//input[@name='lookupCriteria[active]' and @value='Y']");
61      	waitAndClickButtonByText(SEARCH);
62      	String activeResults [] ={"10000","DO","Domestic","0.305","true"};
63      	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.
64      	assertTextPresent(activeResults);
65      	waitAndClickButtonByText(CLEAR_VALUES);
66      	waitAndClickByXpath("//input[@name='lookupCriteria[active]' and @value='N']");
67      	waitAndClickButtonByText(SEARCH);
68      	waitForTextPresent("No values match this search.");
69      	//No value present so asserting the message.
70  		//    	String activeResults [] ={"10000","DO","Domestic","0.305","true"};
71  		//    	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.
72  		//    	assertTextPresent(activeResults);
73      }
74  
75      @Test
76      public void testTravelMileageLookUpBookmark() throws Exception {
77          testTravelMileageLookUp();
78          passed();
79      }
80  
81      @Test
82      public void testTravelMileageLookUpNav() throws Exception {
83          testTravelMileageLookUp();
84          passed();
85      }
86  }