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