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