View Javadoc
1   /**
2    * Copyright 2005-2016 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.stackedresults;
17  
18  import org.junit.Test;
19  import org.kuali.rice.krad.demo.ViewDemoAftBase;
20  
21  /**
22   * This class performs simple tests on the stacked results lookup
23   *
24   * @author Kuali Rice Team (rice.collab@kuali.org)
25   */
26  public class DemoLookUpStackedResultsAft extends ViewDemoAftBase {
27  
28      /**
29       * /kr-krad/lookup?methodToCall=start&viewId=LookupSampleViewMultipleValuesSelectLimit&hideReturnLink=true
30       */
31      public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=start&viewId=LookupSampleViewStackedResults&hideReturnLink=true";
32  
33      /**
34       *  lookupCriteria[number]
35       */
36      private static final String LOOKUP_CRITERIA_NUMBER_NAME="lookupCriteria[number]";
37      private static final String LOOKUP_CRITERIA_DATE="lookupCriteria[createDate]";
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      @Override
51      public String getBookmarkUrl() {
52          return BOOKMARK_URL;
53      }
54  
55      @Override
56      protected void navigate() throws Exception {
57          waitAndClickDemoLink();
58          waitAndClickByLinkText("Lookup with Stacked Results");
59      }
60  
61      protected void testLookUpStackedResults() throws InterruptedException {
62          waitAndTypeByName(LOOKUP_CRITERIA_NUMBER_NAME, "a1");
63          waitAndClickButtonByText(SEARCH);
64          waitForElementPresentByXpath("//a[contains(text(), 'a1')]");
65          waitAndClickButtonByText(CLEAR_VALUES);
66          waitAndClickButtonByText(SEARCH);
67          waitForElementPresentByXpath("//table[@class='table table-condensed table-bordered uif-gridLayout uif-table-fixed']/tbody/tr/td/div/span/a[contains(text(),'a1')]");
68          assertTextPresent(new String[]{"Travel Account Number: Required"});
69          waitAndClickButtonByText(CLEAR_VALUES);
70          waitAndTypeByName(LOOKUP_CRITERIA_NUMBER_NAME, "");
71          waitAndTypeByName(LOOKUP_CRITERIA_DATE, "234");
72          fireMouseOverEventByName(LOOKUP_CRITERIA_NUMBER_NAME);
73          waitForElementPresentByXpath("//div[@class='popover top in uif-tooltip-error-cs']");
74          waitAndTypeByName(LOOKUP_CRITERIA_NUMBER_NAME, "");
75          fireMouseOverEventByName(LOOKUP_CRITERIA_DATE);
76          waitForElementPresentByXpath("//div[@class='popover top in uif-tooltip-error-cs']");
77          waitAndClickButtonByText(SEARCH);
78          assertTextPresent(new String[]{
79              "Date Created: Must be a date in the following format(s): MM/dd/yy, MM/dd/yyyy, MM-dd-yy, MM-dd-yyyy, yyyy-MM-dd","This page has 2 errors","Travel Account Number: Required"});
80          waitAndTypeByName(LOOKUP_CRITERIA_NUMBER_NAME, "a1");
81          waitAndTypeByName(LOOKUP_CRITERIA_DATE, "08/23/2012");
82          waitAndClickButtonByText(SEARCH);
83      }
84  
85      @Test
86      public void testLookUpMultiValueBookmark() throws Exception {
87          testLookUpStackedResults();
88          passed();
89      }
90  
91      @Test
92      public void testLookUpMultiValueNav() throws Exception {
93          testLookUpStackedResults();
94          passed();
95      }
96  }