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     */
016    package edu.samplu.krad.configview;
017    
018    import edu.samplu.common.ITUtil;
019    import edu.samplu.common.WebDriverLegacyITBase;
020    
021    import org.junit.Test;
022    
023    /**
024     * Test the help widget
025     * 
026     * <p>
027     * Selenium RC does not allow us to test the external help popup windows due to an error on
028     * JavaScrips window.close method when selenium is running. To test the external help we use the
029     * {@link HelpWDIT2} test which utilizes WebDriver. Unfortunately due to a WebDriver bug/feature we
030     * can't test the tooltip help there.
031     * </p>
032     * 
033     * @author Kuali Rice Team (rice.collab@kuali.org)
034     */
035    public class HelpNavIT extends WebDriverLegacyITBase {
036    
037        // Delay in milliseconds used to allow the help window reload the new help page.
038        // waitForPopUp will not work since the window already exists.
039        //    private long HELP_WINDOW_LOAD_DELAY = 3000;
040    
041        @Override
042        public String getTestUrl() {
043            return ITUtil.PORTAL;
044        }
045    
046        /**
047         * Test the tooltip and external help on the view
048         */
049        @Test
050        public void testViewHelp() throws Exception {
051            navigateToHelp();
052            super.testViewHelp();
053            passed();
054        }
055    
056        /**
057         * Test the tooltip and external help on the page
058         */
059        @Test
060        public void testPageHelp() throws Exception {
061            navigateToHelp();
062            super.testPageHelp();
063            passed();
064        }
065    
066        /**
067         * Test the tooltip help on the section and fields
068         */
069        @Test
070        public void testTooltipHelp() throws Exception {
071            navigateToHelp();
072            super.testTooltipHelp();
073            passed();
074        }
075    
076        /**
077         * Test the tooltip help on the sub-section and fields that are display only
078         */
079        @Test
080        public void testDisplayOnlyTooltipHelp() throws Exception {
081            navigateToHelp();
082            super.testDisplayOnlyTooltipHelp();
083            passed();
084        }
085    
086        /**
087         * Test the tooltip help on the section and fields with no content
088         */
089        @Test
090        public void testMissingTooltipHelp() throws Exception {
091            navigateToHelp();
092            super.testMissingTooltipHelp();
093            passed();
094        }
095    
096        private void navigateToHelp() throws Exception
097        {
098            waitAndClickKRAD();
099            waitAndClickByXpath(CONFIGURATION_VIEW_XPATH);
100            switchToWindow(CONFIGURATION_VIEW_WINDOW_TITLE);
101            waitAndClickByLinkText("Help");
102            Thread.sleep(5000);
103            selectFrameIframePortlet();
104        }
105    }