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 edu.sampleu.admin;
17  
18  import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
19  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
20  import org.kuali.rice.testtools.selenium.WebDriverUtils;
21  import org.junit.Test;
22  
23  /**
24   * Tests whether the ENABLE_FIELD_LEVEL_HELP_IND parameter is being considered and loaded on each request.
25   *
26   * @author Kuali Rice Team (rice.collab@kuali.org)
27   */
28  public class DetailedDocSearchAft extends WebDriverLegacyITBase {
29      /*
30       * AutomatedFunctionalTestUtils.PORTAL + "?channelTitle=Document%20Search&channelUrl=" + WebDriverUtils
31       * .getBaseUrlString() + "/kew/DocumentSearch.do?docFormKey=88888888&returnLocation=" + AutomatedFunctionalTestUtils.PORTAL_URL + AutomatedFunctionalTestUtils.HIDE_RETURN_LINK;
32       */
33      
34      public static String BOOKMARK_URL = AutomatedFunctionalTestUtils.PORTAL + "?channelTitle=Document%20Search&channelUrl=" + WebDriverUtils
35              .getBaseUrlString() + "/kew/DocumentSearch.do?docFormKey=88888888&returnLocation=" + AutomatedFunctionalTestUtils.PORTAL_URL + AutomatedFunctionalTestUtils.HIDE_RETURN_LINK;
36  
37      @Override
38      protected String getBookmarkUrl() {
39          return BOOKMARK_URL;
40      }
41  
42      @Override
43      protected void navigate() throws Exception {
44         waitAndClickByXpath("//img[@alt='doc search']"); 
45      }
46  
47      @Test
48      public void testAdvancedDocSearchNav() throws Exception {
49          advancedDocSearchAll();
50      }
51      
52      @Test
53      public void testAdvancedDocSearchBookmark() throws Exception {
54          advancedDocSearchAll();
55      }
56      
57      private void advancedDocSearchAll() throws Exception{
58          selectFrameIframePortlet();
59          waitAndClickByName("toggleAdvancedSearch");
60          searchByDocumentType();
61          searchByInitiator();
62          searchByApprover();
63          searchByViewer();
64          searchByGroupViewer();
65          searchByDocumentId();
66          searchByApplicationDocumentId();
67          searchByDocumentStatus();
68          searchByDateCreatedFrom();
69          searchByDateCreatedTo();
70          searchByDateApprovedFrom();
71          searchByDateApprovedTo();
72          searchByDateLastModifiedFrom();
73          searchByDateLastModifiedTo();
74          searchByDateLastFinalizedFrom();
75          searchByDateLastFinalizedTo();
76          searchByTitle();
77      }
78  
79      private void searchByDocumentType() throws Exception {
80          selectFrameIframePortlet();
81          waitAndTypeByName("documentTypeName","ParameterMaintenanceDocument");
82          waitAndTypeByName("rangeLowerBoundKeyPrefix_dateCreated","03/24/2000");
83          waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
84          acceptAlertIfPresent();
85          waitForTextPresent("Parameter Maintenance Document");
86          waitAndClickByName("methodToCall.clearValues");
87      }
88      
89      private void searchByInitiator() throws Exception {
90          selectFrameIframePortlet();
91          waitAndTypeByName("initiatorPrincipalName","admin");
92          waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
93          waitForTextPresent("items retrieved");
94          waitForElementPresentByXpath("//a[contains(text(),'admin, admin')]");
95          waitAndClickByName("methodToCall.clearValues");
96      }
97  
98      private void searchByApprover() throws Exception {
99          selectFrameIframePortlet();
100         waitAndTypeByName("approverPrincipalName","admin");
101         waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
102         waitForTextPresent("items retrieved");
103         waitForElementPresentByXpath("//a[contains(text(),'admin, admin')]");
104         waitAndClickByName("methodToCall.clearValues");
105     }
106 
107     private void searchByViewer() throws Exception {
108         waitAndTypeByName("viewerPrincipalName","admin");
109         waitAndTypeByName("rangeLowerBoundKeyPrefix_dateCreated","03/24/2000");
110         waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
111         waitForTextPresent("items retrieved");
112         waitForElementPresentByXpath("//a[contains(text(),'admin, admin')]");
113         waitAndClickByName("methodToCall.clearValues");
114     }
115     
116     private void searchByGroupViewer() throws Exception {
117         waitAndClickByXpath("//input[@type='image' and @alt='Search Group Viewer Id']");
118         selectFrameIframePortlet();
119         waitAndTypeByName("id","2009");
120         waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
121         waitAndClickLinkContainingText("return value");
122         selectFrameIframePortlet();
123         waitAndTypeByName("rangeLowerBoundKeyPrefix_dateCreated","03/24/2000");
124         waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
125         waitForTextPresent("Component Maintenance Document");
126         waitForElementPresentByXpath("//a[contains(text(),'admin, admin')]");
127         waitAndClickByName("methodToCall.clearValues");
128     }
129     
130     private void searchByDocumentId() throws Exception {
131         waitAndTypeByName("documentId","2700");
132         waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
133         waitForElementPresentByXpath("//a[contains(text(),'2700')]");
134         waitAndClickByName("methodToCall.clearValues");
135     }
136     
137     private void searchByApplicationDocumentId() throws Exception {
138         waitAndTypeByName("applicationDocumentId","7777777");
139         waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
140         waitForElementPresentByXpath("//a[contains(text(),'3221')]");
141         waitAndClickByName("methodToCall.clearValues");
142     }
143     
144     private void searchByDocumentStatus() throws Exception {
145         selectByName("statusCode","Successful Statuses");
146         waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
147         waitForTextPresent("FINAL");
148         waitAndClickByName("methodToCall.clearValues");
149     }
150     
151     private void searchByDateCreatedFrom() throws Exception {
152         waitAndTypeByName("rangeLowerBoundKeyPrefix_dateCreated","04/17/2005");
153         waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
154         waitForTextPresent("items retrieved");
155         waitAndClickByName("methodToCall.clearValues");
156     }
157     
158     private void searchByDateCreatedTo() throws Exception {
159         waitAndTypeByName("dateCreated","04/17/2014");
160         waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
161         waitForTextPresent("items retrieved");
162         waitAndClickByName("methodToCall.clearValues");
163     }
164     
165     private void searchByDateApprovedFrom() throws Exception {
166         waitAndTypeByName("rangeLowerBoundKeyPrefix_dateApproved","04/17/2005");
167         waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
168         waitForTextPresent("items retrieved");
169         waitAndClickByName("methodToCall.clearValues");
170     }
171     
172     private void searchByDateApprovedTo() throws Exception {
173         waitAndTypeByName("dateApproved","04/17/2014");
174         waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
175         waitForTextPresent("items retrieved");
176         waitAndClickByName("methodToCall.clearValues");
177     }
178     
179     private void searchByDateLastModifiedFrom() throws Exception {
180         waitAndTypeByName("rangeLowerBoundKeyPrefix_dateLastModified","04/17/2005");
181         waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
182         waitForTextPresent("items retrieved");
183         waitAndClickByName("methodToCall.clearValues");
184     }
185  
186     private void searchByDateLastModifiedTo() throws Exception {
187         waitAndTypeByName("dateLastModified","04/17/2014");
188         waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
189         waitForTextPresent("items retrieved");
190         waitAndClickByName("methodToCall.clearValues");
191     }
192     
193     private void searchByDateLastFinalizedFrom() throws Exception {
194         waitAndTypeByName("rangeLowerBoundKeyPrefix_dateFinalized","04/17/2005");
195         waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
196         waitForTextPresent("items retrieved");
197         waitAndClickByName("methodToCall.clearValues");
198     }
199 
200     private void searchByDateLastFinalizedTo() throws Exception {
201         waitAndTypeByName("dateFinalized","04/17/2014");
202         waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
203         waitForTextPresent("items retrieved");
204         waitAndClickByName("methodToCall.clearValues");
205     }
206     
207     private void searchByTitle() throws Exception {
208         waitAndTypeByName("title","Travel Doc 2 - dfads");
209         waitAndTypeByName("rangeLowerBoundKeyPrefix_dateCreated","03/24/2000");
210         waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']");
211         waitForTextPresent("Travel Doc 2 - dfads");
212         waitAndClickByName("methodToCall.clearValues");
213     }
214 }