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.common;
017    
018    import org.openqa.selenium.By;
019    
020    /**
021     * @author Kuali Rice Team (rice.collab@kuali.org)
022     */
023    public abstract class NavTemplateMethodSTBase extends WebDriverLegacyITBase {
024    
025        @Override
026        public String getTestUrl() {
027            return ITUtil.PORTAL;
028        }
029    
030        /**
031         * TODO when the UpgradedSelenium tests have been converted over, rename this to getMenuLinkText
032         * Override to return menu click selector (e.g. "Main Menu")
033         * @return selenium locator to click on
034         */
035        protected abstract String getMenuLinkLocator();
036    
037        /**
038         * TODO when the UpgradedSelenium tests have been converted over, rename this to getLinkText
039         * Override to return main menu click selector (e.g. "Agenda lookup")
040         * @return selenium locator to click on
041         */
042        protected abstract String getLinkLocator();
043    
044    
045        /**
046         * Override to return main menu click selector (e.g. "//img[@alt='create new']")
047         * @return selenium locator to click on
048         */
049        protected abstract String getCreateNewLinkLocator();
050    
051        /**
052         * go to the getMenuLinkLocator() Menu and click the getLinkLocator()
053         */
054        protected void gotoMenuLinkLocator(String message) throws Exception {
055            waitForTitleToEqualKualiPortalIndex();
056            selectTopFrame();
057            waitAndClickByLinkText(getMenuLinkLocator(), message);
058            waitForTitleToEqualKualiPortalIndex();
059            waitAndClickByLinkText(getLinkLocator(), message);
060            waitForTitleToEqualKualiPortalIndex(message);
061            selectFrameIframePortlet();
062            checkForIncidentReport(getLinkLocator(), message);
063        }
064    
065        protected void gotoMenuLinkLocator() throws Exception {
066            gotoMenuLinkLocator("");
067        }
068    
069        /**
070         * go to having clicked create new of the getLinkLocator()
071         */
072        protected void gotoCreateNew() throws Exception {
073            gotoMenuLinkLocator();
074            waitAndClick(By.xpath(getCreateNewLinkLocator()));
075            //        selectFrame("relative=up");
076            checkForIncidentReport(getCreateNewLinkLocator());
077        }
078    }