View Javadoc

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