View Javadoc
1   /**
2    * Copyright 2005-2016 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.krad.demo.ViewDemoAftBase;
19  import org.junit.Test;
20  
21  /**
22   * @author Kuali Rice Team (rice.collab@kuali.org)
23   */
24  public class DemoTravelExpenseItemLookUpAft extends ViewDemoAftBase {
25  
26      /**
27       * /kr-krad/lookup?methodToCall=start&dataObjectClassName=edu.sampleu.travel.dataobject.TravelExpenseItem
28       */
29      public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=start&dataObjectClassName=edu.sampleu.travel.dataobject.TravelExpenseItem";
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          waitAndClickDemoLink();
49          waitAndClickByLinkText("Travel Expense Item Lookup");
50      }
51  
52      protected void testTravelExpenseItemLookUp() throws Exception {
53      	//Search with primary key
54      	waitAndTypeByName("lookupCriteria[travelExpenseItemId]","10000");
55      	waitAndClickButtonByText(SEARCH);
56      	waitForTextPresent("One item retrieved.");
57      	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.");
58      	waitAndClickButtonByText(CLEAR_VALUES);
59      	
60      	//Search with document ID
61      	waitAndTypeByName("lookupCriteria[travelAuthorizationDocumentId]","10000");
62      	waitAndClickButtonByText(SEARCH);
63      	waitForTextPresent("One item retrieved.");
64      	waitAndClickButtonByText(CLEAR_VALUES);
65      	
66      	//Search with Company Name
67      	waitAndTypeByName("lookupCriteria[travelCompanyName]","Discount Travel");
68      	waitAndClickButtonByText(SEARCH);
69      	waitForTextPresent("Discount Travel");
70      	waitAndClickButtonByText(CLEAR_VALUES);
71      	
72      	//Search with Expense Type & Description
73      	waitAndTypeByName("lookupCriteria[travelExpenseTypeCd]","ME");
74      	waitAndTypeByName("lookupCriteria[expenseDesc]","Family Related");
75      	waitAndClickButtonByText(SEARCH);
76      	String assertResultForExpenseTypeAndDesc [] ={"ME","Family Related"};
77      	assertTextPresent(assertResultForExpenseTypeAndDesc);
78      	waitAndClickButtonByText(CLEAR_VALUES);
79      	
80      	//Search with Expense Amount Reimbursable and Taxable
81      	waitAndTypeByName("lookupCriteria[expenseAmount]","1,278.97");
82      	waitAndClickByXpath("//input[@name='lookupCriteria[reimbursable]' and @value='Y']");
83      	waitAndClickByXpath("//input[@name='lookupCriteria[taxable]' and @value='Y']");
84      	String assertResultForExpenseAmount [] ={"1,278.97","true","true"};
85      	assertTextPresent(assertResultForExpenseAmount);
86      	waitAndClickButtonByText(CLEAR_VALUES);
87      }
88  
89      @Test
90      public void testTravelExpenseItemLookUpBookmark() throws Exception {
91          testTravelExpenseItemLookUp();
92          passed();
93      }
94  
95      @Test
96      public void testTravelExpenseItemLookUpNav() throws Exception {
97          testTravelExpenseItemLookUp();
98          passed();
99      }
100 }