View Javadoc
1   /**
2    * Copyright 2005-2015 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.labs;
17  
18  import org.junit.Test;
19  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
20  
21  /**
22   * @author Kuali Rice Team (rice.collab@kuali.org)
23   */
24  public class LabsConfigurationAft extends WebDriverLegacyITBase {
25  
26      /**
27       * /kr-krad/labs?viewId=LabsConfigurationView&formKey=b553a5b1-9748-4d86-bd9a-5cb3829f74d2&cacheKey=ge1ddsklfoqa7454h9j07e
28       */
29      public static final String BOOKMARK_URL = "/kr-krad/labs?viewId=LabsConfigurationView&formKey=b553a5b1-9748-4d86-bd9a-5cb3829f74d2&cacheKey=ge1ddsklfoqa7454h9j07e";
30      
31      /**
32       *	lookupCriteria[number]
33       */
34      private static final String TRAVEL_ACCOUNT_NUMBER_NAME="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      protected String getBookmarkUrl() {
58          return BOOKMARK_URL;
59      }
60  
61      @Override
62      protected void navigate() throws Exception {
63      }
64  
65      private void testLabsConfigurationWithClassInstantiation() throws InterruptedException {
66      	waitAndClickByLinkText("Configuration with Class Instantiation");
67      	
68      	//Search By Number
69      	waitAndTypeByName(TRAVEL_ACCOUNT_NUMBER_NAME,"a2");
70      	waitAndClickButtonByText(SEARCH_BUTTON_TEXT);
71      	waitForTextPresent("a2");
72      	waitAndClickButtonByText(CLEAR_VALUES_BUTTON_TEXT);
73      	
74      	//Search By Name
75      	waitAndTypeByName(TRAVEL_ACCOUNT_NAME,"Travel Account 2");
76      	waitAndClickButtonByText(SEARCH_BUTTON_TEXT);
77      	waitForTextPresent("Travel Account 2");
78      	waitAndClickButtonByText(CLEAR_VALUES_BUTTON_TEXT);
79      	
80      	//Search By Principal Name
81      	waitAndTypeByName(PRINCIPAL_NAME,"fran");
82      	waitAndClickButtonByText(SEARCH_BUTTON_TEXT);
83      	waitForTextPresent("Travel Account");
84      	waitAndClickButtonByText(CLEAR_VALUES_BUTTON_TEXT);
85      	
86      	//Search By Date
87      	waitAndTypeByName("lookupCriteria[rangeLowerBoundKeyPrefix_createDate]","06/01/2000");
88      	waitAndTypeByName("lookupCriteria[createDate]","06/01/2050");
89      	waitAndClickButtonByText(SEARCH_BUTTON_TEXT);
90      	waitForTextPresent("Travel Account");
91      }
92      
93      private void testConfigurationWithSpringServiceExpression() throws InterruptedException {
94      	//Waiting for Incident report to fix.
95          waitAndClickByLinkText("Configuration with Spring Service Expression");
96  
97          //Search By Number
98          waitAndTypeByName(TRAVEL_ACCOUNT_NUMBER_NAME,"a2");
99          waitAndClickButtonByText(SEARCH_BUTTON_TEXT);
100         waitForTextPresent("a2");
101         waitAndClickButtonByText(CLEAR_VALUES_BUTTON_TEXT);
102 
103         //Search By Name
104         waitAndTypeByName(TRAVEL_ACCOUNT_NAME,"Travel Account 2");
105         waitAndClickButtonByText(SEARCH_BUTTON_TEXT);
106         waitForTextPresent("Travel Account 2");
107         waitAndClickButtonByText(CLEAR_VALUES_BUTTON_TEXT);
108 
109         //Search By Date
110         waitAndTypeByName("lookupCriteria[rangeLowerBoundKeyPrefix_createDate]","06/01/2000");
111         waitAndTypeByName("lookupCriteria[createDate]","06/01/2050");
112         waitAndClickButtonByText(SEARCH_BUTTON_TEXT);
113         waitForTextPresent("Travel Account");
114 
115         //Search By Principal Name
116         waitAndTypeByName(PRINCIPAL_NAME,"fran");
117         waitAndClickButtonByText(SEARCH_BUTTON_TEXT);
118         waitForTextPresent("Travel Account");
119         waitAndClickButtonByText(CLEAR_VALUES_BUTTON_TEXT);
120     }
121     
122     @Test
123     public void testLabsConfigurationWithClassInstantiationBookmark() throws Exception {
124         testLabsConfigurationWithClassInstantiation();
125         passed();
126     }
127 
128     @Test
129     public void testLabsConfigurationWithSpringServiceExpressionBookmark() throws Exception {
130         testConfigurationWithSpringServiceExpression();
131         passed();
132     }
133 }