View Javadoc
1   /**
2    * Copyright 2005-2014 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 org.kuali.rice.krad.demo.lookup.multivalue;
17  
18  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
19  import org.junit.Test;
20  import org.openqa.selenium.By;
21  
22  /**
23   * No Nav test, there is no link to this page.
24   *
25   * @author Kuali Rice Team (rice.collab@kuali.org)
26   */
27  public class DemoLookUpMultiValueAft extends WebDriverLegacyITBase {
28  
29      /**
30       * /kr-krad/lookup?methodToCall=start&viewId=LookupSampleViewMultipleValuesSelectLimit&hideReturnLink=true
31       */
32      public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=start&viewId=LookupSampleViewMultipleValuesSelectLimit&hideReturnLink=true";
33      
34      /**
35       *  lookupCriteria[number]
36       */
37      private static final String LOOKUP_CRITERIA_NUMBER_NAME="lookupCriteria[number]";
38      
39      /**
40       *  Search
41       */
42      private static final String SEARCH="Search";
43      
44      /**
45       * Clear Values
46       */
47      private static final String CLEAR_VALUES="Clear Values";
48      
49      /**
50       * table table-condensed table-bordered uif-tableCollectionLayout dataTable
51       */
52      private static final String TABLE_ROW_SIX_XPATH="//table[@class='table table-condensed table-bordered uif-tableCollectionLayout dataTable']/tbody/tr[6]";
53      
54      /**
55       * Clear Values
56       */
57      private static final String FAILURE_MESSAGE="Results are not restricted to 5 rows.";
58      
59      @Override
60      public String getBookmarkUrl() {
61          return BOOKMARK_URL;
62      }
63  
64      @Override
65      protected void navigate() throws Exception {
66          waitAndClickById("Demo-DemoLink", "");
67          waitAndClickByLinkText("Lookup Multi Value");
68      }
69  
70      protected void testLookUpMultiValue() throws InterruptedException {
71          waitAndTypeByName(LOOKUP_CRITERIA_NUMBER_NAME, "a1");
72          waitAndClickButtonByText(SEARCH);
73          waitForElementPresentByXpath("//a[contains(text(), 'a1')]");
74          waitAndClickButtonByText(CLEAR_VALUES);
75          waitAndClickButtonByText(SEARCH);
76          waitForElementNotPresent(By.xpath(TABLE_ROW_SIX_XPATH));
77      }
78  
79      // No Nav test, there is no link to this page
80      @Test
81      public void testLookUpMultiValueBookmark() throws Exception {
82          testLookUpMultiValue();
83          passed();
84      }
85  }