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.lookup.view;
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 DemoLookUpActionsGroupedInHierarchyAft extends ViewDemoAftBase {
25  
26      /**
27       * /kr-krad/lookup?methodToCall=start&viewId=LookupSampleViewActionsHierarchy
28       */
29      public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=start&viewId=LookupSampleViewActionsHierarchy";
30  
31      /**
32       *	lookupCriteria[number] 
33       */
34      private static final String TRAVEL_ACCOUNT_NUMBER="lookupCriteria[number]";
35      
36      /**
37       *	lookupCriteria[name]
38       */
39      private static final String TRAVEL_ACCOUNT_NAME="lookupCriteria[name]";
40      
41      /**
42       *	Search 
43       */
44      private static final String SEARCH_BUTTON_TEXT="Search";
45      
46      /**
47       *	Clear Values 
48       */
49      private static final String CLEAR_VALUES_BUTTON_TEXT="Clear Values";
50      
51      /**
52       * lookupCriteria[fiscalOfficer.principalName]
53       */
54      private static final String PRINCIPAL_NAME="lookupCriteria[fiscalOfficer.principalName]";
55      
56      @Override
57      public String getBookmarkUrl() {
58          return BOOKMARK_URL;
59      }
60  
61      @Override
62      protected void navigate() throws Exception {
63          waitAndClickDemoLink();
64          waitAndClickByLinkText("Lookup actions grouped into a hierarchy");
65      }
66  
67      protected void testLookUpActionsGroupedInHierarchy() throws InterruptedException {
68      	//Search By Number 
69      	waitAndTypeByName(TRAVEL_ACCOUNT_NUMBER,"A139638996");
70      	waitAndClickButtonByText(SEARCH_BUTTON_TEXT);
71      	waitForElementPresentByXpath("//a[contains(text(),'A139638996')]");
72      	assertActionsGroupedInHierarchy();
73      	waitAndClickButtonByText(CLEAR_VALUES_BUTTON_TEXT);
74      	
75      	//Search By Name
76      	waitAndTypeByName(TRAVEL_ACCOUNT_NAME,"A1396389962525av");
77      	waitAndClickButtonByText(SEARCH_BUTTON_TEXT);
78          waitForProgressLoading();
79          waitForTextPresent("A1396389962525av");
80      	assertActionsGroupedInHierarchy();
81      	waitAndClickButtonByText(CLEAR_VALUES_BUTTON_TEXT);
82      	
83      	//Search By Fiscal Officer
84      	waitAndTypeByName(PRINCIPAL_NAME,"fran");
85      	waitAndClickButtonByText(SEARCH_BUTTON_TEXT);
86      	waitForTextPresent("fran");
87      	assertActionsGroupedInHierarchy();
88      	waitAndClickButtonByText(CLEAR_VALUES_BUTTON_TEXT);
89      }
90      
91      private void assertActionsGroupedInHierarchy() throws InterruptedException{
92      	waitForElementPresentByXpath("//a[contains(text(),'edit')]");
93      	waitForElementPresentByXpath("//a[contains(text(),'loan')]");
94      	waitForElementPresentByXpath("//a[contains(text(),'renew')]");
95      	waitForElementPresentByXpath("//a[contains(text(),'return')]");
96      	waitForElementPresentByXpath("//a[contains(text(),'copy')]");
97      	waitForElementPresentByXpath("//a[contains(text(),'merge')]");
98      	waitForElementPresentByXpath("//a[contains(text(),'separate')]");
99      	waitForElementPresentByXpath("//a[contains(text(),'transfer')]");
100     }
101 
102     @Test
103     public void testLookUpActionsGroupedInHierarchyBookmark() throws Exception {
104         testLookUpActionsGroupedInHierarchy();
105         passed();
106     }
107 
108     @Test
109     public void testLookUpActionsGroupedInHierarchyNav() throws Exception {
110         testLookUpActionsGroupedInHierarchy();
111         passed();
112     }
113 }