1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
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  
23  
24  public class DemoTravelExpenseItemLookUpAft extends ViewDemoAftBase {
25  
26      
27  
28  
29      public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=start&dataObjectClassName=edu.sampleu.travel.dataobject.TravelExpenseItem";
30  
31      
32  
33  
34      public static final String SEARCH = "Search";
35      
36      
37  
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      	
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      	
61      	waitAndTypeByName("lookupCriteria[travelAuthorizationDocumentId]","10000");
62      	waitAndClickButtonByText(SEARCH);
63      	waitForTextPresent("One item retrieved.");
64      	waitAndClickButtonByText(CLEAR_VALUES);
65      	
66      	
67      	waitAndTypeByName("lookupCriteria[travelCompanyName]","Discount Travel");
68      	waitAndClickButtonByText(SEARCH);
69      	waitForTextPresent("Discount Travel");
70      	waitAndClickButtonByText(CLEAR_VALUES);
71      	
72      	
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      	
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 }