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