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 edu.sampleu.admin;
17  
18  import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
19  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
20  import org.junit.Test;
21  import org.kuali.rice.krad.util.KRADConstants;
22  
23  /**
24   * Tests whether the ENABLE_FIELD_LEVEL_HELP_IND parameter is being considered and loaded on each request.
25   *
26   * @author Kuali Rice Team (rice.collab@kuali.org)
27   */
28  public class ParameterEnableFieldLevelHelpIndAft extends WebDriverLegacyITBase {
29  
30      @Override
31      protected String getBookmarkUrl() {
32          return AutomatedFunctionalTestUtils.PORTAL;
33      }
34  
35      @Override
36      protected void navigate() throws Exception {
37          waitAndClickAdministration();
38          waitForPageToLoad();
39      }
40  
41      /**
42       * Sets the ENABLE_FIELD_LEVEL_HELP_IND parameter to 'Y', checks whether the field level help links are enabled
43       * on the Person document, then sets ENABLE_FIELD_LEVEL_HELP_IND to 'N' and checks the opposite.
44       *
45       * @throws Exception
46       */
47      @Test
48      public void testEnableFieldLevelHelpIndParameterNav() throws Exception {
49          setParameter(KRADConstants.SystemGroupParameterNames.ENABLE_FIELD_LEVEL_HELP_IND, "Y");
50  
51          waitAndClickByLinkText("Person");
52          waitForPageToLoad();
53          selectFrameIframePortlet();
54          assertTrue("The help field did not appear", isElementPresent("img[alt='[Help]Principal Name']"));
55  
56          setParameter(KRADConstants.SystemGroupParameterNames.ENABLE_FIELD_LEVEL_HELP_IND, "N");
57  
58          waitAndClickByLinkText("Person");
59          waitForPageToLoad();
60          selectFrameIframePortlet();
61          assertFalse("The help field appeared", isElementPresent("img[alt='[Help]Principal Name']"));
62  
63          passed();
64      }
65  
66      private void setParameter(String parameterName, String parameterValue) throws Exception {
67          selectTopFrame();
68          waitAndClickAdministration();
69          waitAndClickByLinkText("Parameter");
70  
71          selectFrameIframePortlet();
72          waitAndType("input#name", parameterName);
73          waitAndClickSearch();
74          waitAndClickByLinkText(EDIT_LINK_TEXT);
75  
76          waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Setting Field Level Help Indicator to " + parameterValue);
77          clearTextByXpath("//textarea[@id='document.newMaintainableObject.value']");
78          waitAndTypeByXpath("//textarea[@id='document.newMaintainableObject.value']", parameterValue);
79          waitAndClickByName(BLANKET_APPROVE_NAME);
80      }
81  
82  
83  }