View Javadoc

1   /**
2    * Copyright 2005-2013 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.samplu.krad.demo.travel.account.lookup.autosearch;
17  
18  import edu.samplu.common.ITUtil;
19  import edu.samplu.common.SmokeTestBase;
20  import edu.samplu.common.WebDriverLegacyITBase;
21  import org.junit.Test;
22  
23  /**
24   * @author Kuali Rice Team (rice.collab@kuali.org)
25   */
26  public abstract class DemoTravelAccountLookUpAutoSearchSmokeTest extends SmokeTestBase {
27  
28      /**
29       * /kr-krad/lookup?methodToCall=search&dataObjectClassName=org.kuali.rice.krad.demo.travel.account.TravelAccount&lookupCriteria['number']=a*&readOnlyFields=number&hideReturnLink=true&showMaintenanceLinks=true
30       */
31      public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=search&dataObjectClassName=org.kuali.rice.krad.demo.travel.account.TravelAccount&lookupCriteria['number']=a*&readOnlyFields=number&hideReturnLink=true&showMaintenanceLinks=true";
32      
33      /**
34       * Search
35       */
36      public static final String SEARCH = "Search";
37      
38      /**
39       * Clear Values
40       */
41      public static final String CLEAR_VALUES = "Clear Values";
42      
43      @Override
44      public String getBookmarkUrl() {
45          return BOOKMARK_URL;
46      }
47  
48      protected void navigation() throws Exception {
49          waitAndClickById("Demo-DemoLink", "");
50          waitAndClickByLinkText("Account Lookup Auto Search");
51      }
52  
53      protected void testDemoTravelAccountLookUpAutoSearch() throws Exception {
54          assertElementPresentByXpath("//a[contains(text(), 'a1')]");
55          assertElementPresentByXpath("//a[contains(text(), 'a2')]");
56          assertElementPresentByXpath("//a[contains(text(), 'a3')]");
57          waitAndTypeByName("lookupCriteria[foId]","1");
58          waitAndClickButtonByText(SEARCH);
59          Thread.sleep(3000);
60          assertElementPresentByXpath("//a[contains(text(), 'a1')]");
61          if(isElementPresentByLinkText("a2") || isElementPresentByLinkText("a3")) {
62              fail("Search Functionality not working properly.");
63          }
64      }
65  
66      @Test
67      public void testDemoTravelAccountLookUpAutoSearchNav() throws Exception {
68          testDemoTravelAccountLookUpAutoSearch();
69          passed();
70      }
71  
72      @Test
73      public void testDemoTravelAccountLookUpAutoSearchBookmark() throws Exception {
74          testDemoTravelAccountLookUpAutoSearch();
75          passed();
76      }
77  }