001/** 002 * Copyright 2005-2013 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package edu.samplu.admin.test; 017 018import edu.samplu.common.ITUtil; 019import edu.samplu.common.SmokeTestBase; 020import org.junit.Test; 021import org.kuali.rice.krad.util.KRADConstants; 022 023import static org.junit.Assert.assertFalse; 024import static org.junit.Assert.assertTrue; 025 026/** 027 * Tests whether the ENABLE_FIELD_LEVEL_HELP_IND parameter is being considered and loaded on each request. 028 * 029 * @author Kuali Rice Team (rice.collab@kuali.org) 030 */ 031public class ParameterEnableFieldLevelHelpIndSmokeTest extends SmokeTestBase { 032 033 @Override 034 protected String getBookmarkUrl() { 035 return ITUtil.PORTAL; 036 } 037 038 @Override 039 protected void navigate() throws Exception { 040 waitAndClickAdministration(this); 041 waitForPageToLoad(); 042 } 043 044 /** 045 * Sets the ENABLE_FIELD_LEVEL_HELP_IND parameter to 'Y', checks whether the field level help links are enabled 046 * on the Person document, then sets ENABLE_FIELD_LEVEL_HELP_IND to 'N' and checks the opposite. 047 * 048 * @throws Exception 049 */ 050 @Test 051 public void testEnableFieldLevelHelpIndParameterNav() throws Exception { 052 setParameter(KRADConstants.SystemGroupParameterNames.ENABLE_FIELD_LEVEL_HELP_IND, "Y"); 053 054 waitAndClickByLinkText("Person"); 055 waitForPageToLoad(); 056 selectFrameIframePortlet(); 057 assertTrue("The help field did not appear", isElementPresent("img[alt='[Help]Principal Name']")); 058 059 setParameter(KRADConstants.SystemGroupParameterNames.ENABLE_FIELD_LEVEL_HELP_IND, "N"); 060 061 waitAndClickByLinkText("Person"); 062 waitForPageToLoad(); 063 selectFrameIframePortlet(); 064 assertFalse("The help field appeared", isElementPresent("img[alt='[Help]Principal Name']")); 065 066 passed(); 067 } 068 069 private void setParameter(String parameterName, String parameterValue) throws Exception { 070 selectTopFrame(); 071 waitAndClickAdministration(this); 072 waitAndClickByLinkText("Parameter"); 073 074 selectFrameIframePortlet(); 075 waitAndType("input#name", parameterName); 076 waitAndClickSearch(); 077 waitAndClickByLinkText(EDIT_LINK_TEXT); 078 079 waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Setting Field Level Help Indicator to " + parameterValue); 080 clearTextByXpath("//textarea[@id='document.newMaintainableObject.value']"); 081 waitAndTypeByXpath("//textarea[@id='document.newMaintainableObject.value']", parameterValue); 082 waitAndClickByName(BLANKET_APPROVE_NAME); 083 } 084 085 086}