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.lookupviews.lookup;
17  
18  import edu.samplu.common.Failable;
19  import edu.samplu.common.SmokeTestBase;
20  
21  /**
22   * @author Kuali Rice Team (rice.collab@kuali.org)
23   */
24  public class DemoLookUpAbstractSmokeTestBase extends SmokeTestBase {
25  
26      /**
27       * /kr-krad/lookup?methodToCall=start&viewId=LookupSampleView&hideReturnLink=true
28       */
29      public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=start&viewId=LookupSampleView&hideReturnLink=true";
30  
31      /**
32       *  lookupCriteria[number]
33       */
34      private static final String LOOKUP_CRITERIA_NUMBER_NAME="lookupCriteria[number]";
35      
36      /**
37       *  Search
38       */
39      private static final String SEARCH="Search";
40      
41      /**
42       * Clear Values
43       */
44      private static final String CLEAR_VALUES="Clear Values";
45      
46      @Override
47      public String getBookmarkUrl() {
48          return BOOKMARK_URL;
49      }
50  
51      @Override
52      protected void navigate() throws Exception {
53          waitAndClickById("Demo-DemoLink", "");
54          waitAndClickByLinkText("Lookup");
55      }
56  
57      protected void testLookUp() throws InterruptedException {
58          waitAndTypeByName(LOOKUP_CRITERIA_NUMBER_NAME,"a1");
59          waitAndClickButtonByText(SEARCH);
60          Thread.sleep(3000);
61          assertElementPresentByXpath("//a[contains(text(), 'a1')]");
62          waitAndClickButtonByText(CLEAR_VALUES);
63          waitAndClickButtonByText(SEARCH);
64          Thread.sleep(3000);
65          assertElementPresentByXpath("//a[contains(text(), 'a1')]");
66          assertElementPresentByXpath("//a[contains(text(), 'a2')]");
67      }
68  
69      public void testLookUpBookmark(Failable failable) throws Exception {
70          testLookUp();
71          passed();
72      }
73  
74      public void testLookUpNav(Failable failable) throws Exception {
75          testLookUp();
76          passed();
77      }
78  }