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