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.travel.account;
17  
18  import org.junit.Test;
19  import org.kuali.rice.krad.demo.ViewDemoAftBase;
20  import org.kuali.rice.krad.util.KRADConstants;
21  import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
22  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
23  
24  import static org.junit.Assert.assertEquals;
25  
26  /**
27   * @author Kuali Rice Team (rice.collab@kuali.org)
28   */
29  public class DemoTravelAccountMultivalueParameterRestrictionLookUpAft extends ViewDemoAftBase {
30  
31      /**
32       * /kr-krad/lookup?methodToCall=start&dataObjectClassName=org.kuali.rice.krad.demo.travel.dataobject.TravelAccount&hideReturnLink=true&multipleValuesSelect=true&lookupCollectionName=travelAccounts&suppressActions=true&conversionFields=number:foo,name:foo
33       */
34      public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=start&dataObjectClassName=org.kuali.rice.krad.demo.travel.dataobject.TravelAccount&hideReturnLink=true&multipleValuesSelect=true&lookupCollectionName=travelAccounts&suppressActions=true&conversionFields=number:foo,name:foo";
35  
36      @Override
37      public String getBookmarkUrl() {
38          return BOOKMARK_URL;
39      }
40  
41      @Override
42      protected void navigate() throws Exception {
43          waitAndClickDemoLink();
44          waitAndClickByLinkText("Account Multi-Value Lookup");
45      }
46  
47      private void testParameterRestrictionSearchSelect() throws Exception {
48          waitAndClickSearch3();
49          waitForElementPresent(DATA_TABLE_TR_CSS);
50          assertEquals("Wrong number of search results", 10, getCssCount(DATA_TABLE_TR_CSS));
51  
52          setParameter(KRADConstants.KRAD_NAMESPACE, KRADConstants.DetailTypes.LOOKUP_PARM_DETAIL_TYPE,
53                  KRADConstants.SystemGroupParameterNames.MULTIPLE_VALUE_LOOKUP_RESULTS_LIMIT, "1");
54  
55          navigate();
56          waitAndClickSearch3();
57          waitForElementPresent(DATA_TABLE_TR_CSS);
58          assertEquals("Wrong number of search results", 1, getCssCount(DATA_TABLE_TR_CSS));
59  
60          setParameter(KRADConstants.KRAD_NAMESPACE, KRADConstants.DetailTypes.LOOKUP_PARM_DETAIL_TYPE,
61                  KRADConstants.SystemGroupParameterNames.MULTIPLE_VALUE_LOOKUP_RESULTS_LIMIT, "100");
62  
63          navigate();
64          waitAndClickSearch3();
65          waitForElementPresent(DATA_TABLE_TR_CSS);
66          assertEquals("Wrong number of search results", 10, getCssCount(DATA_TABLE_TR_CSS));
67      }
68  
69      private void setParameter(String namespaceCode, String componentCode, String parameterName, String parameterValue)
70              throws Exception {
71  
72          driver.get(AutomatedFunctionalTestUtils.LABS_URL);
73          waitAndClickByLinkText("Parameter Updater");
74  
75          waitAndTypeByName("namespaceCode", namespaceCode);
76          waitAndTypeByName("componentCode", componentCode);
77          waitAndTypeByName("parameterName", parameterName);
78          waitAndTypeByName("parameterValue", parameterValue);
79          waitAndClickButtonByText("Update Parameter");
80  
81          waitForPageToLoad();
82      }
83  
84      @Test
85      public void testTravelAccountMultivalueParameterRestrictionLookUpSearchSelectBookmark() throws Exception {
86          testParameterRestrictionSearchSelect();
87          passed();
88      }
89  
90      @Test
91      public void testTravelAccountMultivalueParameterRestrictionLookUpSearchSelectNav() throws Exception {
92          testParameterRestrictionSearchSelect();
93          passed();
94      }
95  }