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