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