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