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.multivalue;
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 DemoLookUpMultiValueAbstractSmokeTestBase extends SmokeTestBase {
25  
26      /**
27       * /kr-krad/lookup?methodToCall=start&viewId=LookupSampleViewMultipleValuesSelectLimit&hideReturnLink=true
28       */
29      public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=start&viewId=LookupSampleViewMultipleValuesSelectLimit&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      /**
47       * table table-condensed table-bordered uif-tableCollectionLayout dataTable
48       */
49      private static final String TABLE_ROW_SIX_XPATH="//table[@class='table table-condensed table-bordered uif-tableCollectionLayout dataTable']/tbody/tr[6]";
50      
51      /**
52       * Clear Values
53       */
54      private static final String FAILURE_MESSAGE="Results are not restricted to 5 rows.";
55      
56      @Override
57      public String getBookmarkUrl() {
58          return BOOKMARK_URL;
59      }
60  
61      @Override
62      protected void navigate() throws Exception {
63          waitAndClickById("Demo-DemoLink", "");
64          waitAndClickByLinkText("Lookup Multi Value");
65      }
66  
67      protected void testLookUpMultiValue() throws InterruptedException {
68          waitAndTypeByName(LOOKUP_CRITERIA_NUMBER_NAME,"a1");
69          waitAndClickButtonByText(SEARCH);
70          Thread.sleep(3000);
71          assertElementPresentByXpath("//a[contains(text(), 'a1')]");
72          waitAndClickButtonByText(CLEAR_VALUES);
73          waitAndClickButtonByText(SEARCH);
74          Thread.sleep(3000);
75          if(isElementPresentByXpath(TABLE_ROW_SIX_XPATH)){
76              fail(FAILURE_MESSAGE);
77          }
78      }
79  
80      public void testLookUpMultiValueBookmark(Failable failable) throws Exception {
81          testLookUpMultiValue();
82          passed();
83      }
84  
85      public void testLookUpMultiValueNav(Failable failable) throws Exception {
86          testLookUpMultiValue();
87          passed();
88      }
89  }