001/**
002 * Copyright 2005-2014 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.sampleu.admin;
017
018import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
019import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
020import org.junit.Test;
021import org.kuali.rice.krad.util.KRADConstants;
022
023/**
024 * Tests whether the ENABLE_FIELD_LEVEL_HELP_IND parameter is being considered and loaded on each request.
025 *
026 * @author Kuali Rice Team (rice.collab@kuali.org)
027 */
028public class ParameterEnableFieldLevelHelpIndAft extends WebDriverLegacyITBase {
029
030    @Override
031    protected String getBookmarkUrl() {
032        return AutomatedFunctionalTestUtils.PORTAL;
033    }
034
035    @Override
036    protected void navigate() throws Exception {
037        waitAndClickAdministration();
038        waitForPageToLoad();
039    }
040
041    /**
042     * Sets the ENABLE_FIELD_LEVEL_HELP_IND parameter to 'Y', checks whether the field level help links are enabled
043     * on the Person document, then sets ENABLE_FIELD_LEVEL_HELP_IND to 'N' and checks the opposite.
044     *
045     * @throws Exception
046     */
047    @Test
048    public void testEnableFieldLevelHelpIndParameterNav() throws Exception {
049        setParameter(KRADConstants.SystemGroupParameterNames.ENABLE_FIELD_LEVEL_HELP_IND, "Y");
050
051        waitAndClickByLinkText("Person");
052        waitForPageToLoad();
053        selectFrameIframePortlet();
054        assertTrue("The help field did not appear", isElementPresent("img[alt='[Help]Principal Name']"));
055
056        setParameter(KRADConstants.SystemGroupParameterNames.ENABLE_FIELD_LEVEL_HELP_IND, "N");
057
058        waitAndClickByLinkText("Person");
059        waitForPageToLoad();
060        selectFrameIframePortlet();
061        assertFalse("The help field appeared", isElementPresent("img[alt='[Help]Principal Name']"));
062
063        passed();
064    }
065
066    private void setParameter(String parameterName, String parameterValue) throws Exception {
067        selectTopFrame();
068        waitAndClickAdministration();
069        waitAndClickByLinkText("Parameter");
070
071        selectFrameIframePortlet();
072        waitAndType("input#name", parameterName);
073        waitAndClickSearch();
074        waitAndClickByLinkText(EDIT_LINK_TEXT);
075
076        waitAndTypeByXpath(DOC_DESCRIPTION_XPATH, "Setting Field Level Help Indicator to " + parameterValue);
077        clearTextByXpath("//textarea[@id='document.newMaintainableObject.value']");
078        waitAndTypeByXpath("//textarea[@id='document.newMaintainableObject.value']", parameterValue);
079        waitAndClickByName(BLANKET_APPROVE_NAME);
080    }
081
082
083}