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