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.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          waitForProgressLoading();
50          waitForElementPresent(DATA_TABLE_TR_CSS);
51          assertEquals("Wrong number of search results", 10, getCssCount(DATA_TABLE_TR_CSS));
52  
53          setParameter(KRADConstants.KRAD_NAMESPACE, KRADConstants.DetailTypes.LOOKUP_PARM_DETAIL_TYPE,
54                  KRADConstants.SystemGroupParameterNames.MULTIPLE_VALUE_LOOKUP_RESULTS_LIMIT, "1");
55  
56          navigate();
57          waitAndClickSearch3();
58          waitForProgressLoading();
59          waitForElementPresent(DATA_TABLE_TR_CSS);
60          assertEquals("Wrong number of search results", 1, getCssCount(DATA_TABLE_TR_CSS));
61  
62          setParameter(KRADConstants.KRAD_NAMESPACE, KRADConstants.DetailTypes.LOOKUP_PARM_DETAIL_TYPE,
63                  KRADConstants.SystemGroupParameterNames.MULTIPLE_VALUE_LOOKUP_RESULTS_LIMIT, "100");
64  
65          navigate();
66          waitAndClickSearch3();
67          waitForProgressLoading();
68          waitForElementPresent(DATA_TABLE_TR_CSS);
69          assertEquals("Wrong number of search results", 10, getCssCount(DATA_TABLE_TR_CSS));
70      }
71  
72      private void setParameter(String namespaceCode, String componentCode, String parameterName, String parameterValue)
73              throws Exception {
74  
75          driver.get(AutomatedFunctionalTestUtils.LABS_URL);
76          waitAndClickByLinkText("Parameter Updater");
77  
78          waitAndTypeByName("namespaceCode", namespaceCode);
79          waitAndTypeByName("componentCode", componentCode);
80          waitAndTypeByName("parameterName", parameterName);
81          waitAndTypeByName("parameterValue", parameterValue);
82          waitAndClickButtonByText("Update Parameter");
83  
84          waitForPageToLoad();
85      }
86  
87      @Test
88      public void testTravelAccountMultivalueParameterRestrictionLookUpSearchSelectBookmark() throws Exception {
89          testParameterRestrictionSearchSelect();
90          passed();
91      }
92  
93      @Test
94      public void testTravelAccountMultivalueParameterRestrictionLookUpSearchSelectNav() throws Exception {
95          testParameterRestrictionSearchSelect();
96          passed();
97      }
98  }