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.krad.demo.ViewDemoAftBase;
19  import org.junit.Test;
20  
21  /**
22   * @author Kuali Rice Team (rice.collab@kuali.org)
23   */
24  public class DemoLookUpAdvancedLookUpFeaturesAft extends ViewDemoAftBase {
25  
26      /**
27       * /kr-krad/lookup?methodToCall=start&viewId=LookupAdvancedFeaturesView
28       */
29      public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=start&viewId=LookupAdvancedFeaturesView";
30      
31      /**
32       *	lookupCriteria[name]
33       */
34      private static final String TRAVEL_ACCOUNT_NAME="lookupCriteria[name]";
35      
36      /**
37       *	Search 
38       */
39      private static final String SEARCH_BUTTON_TEXT="Search";
40      
41      /**
42       *	Clear Values 
43       */
44      private static final String CLEAR_VALUES_BUTTON_TEXT="Clear Values";
45      
46      /**
47       * lookupCriteria[accountTypeCode]
48       */
49      private static final String TYPE_CODE_NAME="lookupCriteria[accountTypeCode]";
50      
51      @Override
52      public String getBookmarkUrl() {
53          return BOOKMARK_URL;
54      }
55  
56      @Override
57      protected void navigate() throws Exception {
58          waitAndClickDemoLink();
59          waitAndClickByLinkText("Advanced lookup features");
60      }
61  
62      protected void testLookUpAdvancedLookUpFeatures() throws InterruptedException {
63      	//Search By Name
64      	waitAndTypeByName(TRAVEL_ACCOUNT_NAME,"Travel Account 9");
65      	waitAndClickButtonByText(SEARCH_BUTTON_TEXT);
66      	waitForTextPresent("Travel Account 9");
67      	waitAndClickButtonByText(CLEAR_VALUES_BUTTON_TEXT);
68      	
69      	//Search By Account Type Code
70      	waitAndClickByXpath("//input[@name='"+TYPE_CODE_NAME+"' and @value='CAT']");
71      	waitAndClickButtonByText(SEARCH_BUTTON_TEXT);
72      	waitForTextPresent("Travel Account 9");
73      	waitAndClickButtonByText(CLEAR_VALUES_BUTTON_TEXT);
74      }
75     
76      @Test
77      public void testLookUpAdvancedLookUpFeaturesBookmark() throws Exception {
78          testLookUpAdvancedLookUpFeatures();
79          passed();
80      }
81  
82      @Test
83      public void testLookUpAdvancedLookUpFeaturesNav() throws Exception {
84          testLookUpAdvancedLookUpFeatures();
85          passed();
86      }
87  }