001/** 002 * Copyright 2005-2014 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package edu.sampleu.admin; 017 018import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils; 019import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase; 020import org.kuali.rice.testtools.selenium.WebDriverUtils; 021import org.junit.Test; 022 023/** 024 * Tests whether the ENABLE_FIELD_LEVEL_HELP_IND parameter is being considered and loaded on each request. 025 * 026 * @author Kuali Rice Team (rice.collab@kuali.org) 027 */ 028public class DetailedDocSearchAft extends WebDriverLegacyITBase { 029 /* 030 * AutomatedFunctionalTestUtils.PORTAL + "?channelTitle=Document%20Search&channelUrl=" + WebDriverUtils 031 * .getBaseUrlString() + "/kew/DocumentSearch.do?docFormKey=88888888&returnLocation=" + AutomatedFunctionalTestUtils.PORTAL_URL + AutomatedFunctionalTestUtils.HIDE_RETURN_LINK; 032 */ 033 034 public static String BOOKMARK_URL = AutomatedFunctionalTestUtils.PORTAL + "?channelTitle=Document%20Search&channelUrl=" + WebDriverUtils 035 .getBaseUrlString() + "/kew/DocumentSearch.do?docFormKey=88888888&returnLocation=" + AutomatedFunctionalTestUtils.PORTAL_URL + AutomatedFunctionalTestUtils.HIDE_RETURN_LINK; 036 037 @Override 038 protected String getBookmarkUrl() { 039 return BOOKMARK_URL; 040 } 041 042 @Override 043 protected void navigate() throws Exception { 044 waitAndClickByXpath("//img[@alt='doc search']"); 045 } 046 047 @Test 048 public void testAdvancedDocSearchNav() throws Exception { 049 advancedDocSearchAll(); 050 } 051 052 @Test 053 public void testAdvancedDocSearchBookmark() throws Exception { 054 advancedDocSearchAll(); 055 } 056 057 private void advancedDocSearchAll() throws Exception{ 058 selectFrameIframePortlet(); 059 waitAndClickByName("toggleAdvancedSearch"); 060 searchByDocumentType(); 061 searchByInitiator(); 062 searchByApprover(); 063 searchByViewer(); 064 searchByGroupViewer(); 065 searchByDocumentId(); 066 searchByApplicationDocumentId(); 067 searchByDocumentStatus(); 068 searchByDateCreatedFrom(); 069 searchByDateCreatedTo(); 070 searchByDateApprovedFrom(); 071 searchByDateApprovedTo(); 072 searchByDateLastModifiedFrom(); 073 searchByDateLastModifiedTo(); 074 searchByDateLastFinalizedFrom(); 075 searchByDateLastFinalizedTo(); 076 searchByTitle(); 077 } 078 079 private void searchByDocumentType() throws Exception { 080 selectFrameIframePortlet(); 081 waitAndTypeByName("documentTypeName","ParameterMaintenanceDocument"); 082 waitAndTypeByName("rangeLowerBoundKeyPrefix_dateCreated","03/24/2000"); 083 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']"); 084 acceptAlertIfPresent(); 085 waitForTextPresent("Parameter Maintenance Document"); 086 waitAndClickByName("methodToCall.clearValues"); 087 } 088 089 private void searchByInitiator() throws Exception { 090 selectFrameIframePortlet(); 091 waitAndTypeByName("initiatorPrincipalName","admin"); 092 waitAndClickByXpath("//td/input[@type='image' and @name='methodToCall.search']"); 093 waitForTextPresent("items retrieved"); 094 waitForElementPresentByXpath("//a[contains(text(),'admin, admin')]"); 095 waitAndClickByName("methodToCall.clearValues"); 096 } 097 098 private void searchByApprover() throws Exception { 099 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}