1 /**
2 * Copyright 2005-2013 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/ecl2.php
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package edu.samplu.common;
17
18 import org.openqa.selenium.By;
19
20 /**
21 * @author Kuali Rice Team (rice.collab@kuali.org)
22 */
23 public abstract class NavTemplateMethodSTBase extends WebDriverLegacyITBase {
24
25 @Override
26 public String getTestUrl() {
27 return ITUtil.PORTAL;
28 }
29
30 /**
31 * TODO when the UpgradedSelenium tests have been converted over, rename this to getMenuLinkText
32 * Override to return menu click selector (e.g. "Main Menu")
33 * @return selenium locator to click on
34 */
35 protected abstract String getMenuLinkLocator();
36
37 /**
38 * TODO when the UpgradedSelenium tests have been converted over, rename this to getLinkText
39 * Override to return main menu click selector (e.g. "Agenda lookup")
40 * @return selenium locator to click on
41 */
42 protected abstract String getLinkLocator();
43
44
45 /**
46 * Override to return main menu click selector (e.g. "//img[@alt='create new']")
47 * @return selenium locator to click on
48 */
49 protected abstract String getCreateNewLinkLocator();
50
51 /**
52 * go to the getMenuLinkLocator() Menu and click the getLinkLocator()
53 */
54 protected void gotoMenuLinkLocator(String message) throws Exception {
55 waitForTitleToEqualKualiPortalIndex();
56 selectTopFrame();
57 waitAndClickByLinkText(getMenuLinkLocator(), message);
58 waitForTitleToEqualKualiPortalIndex();
59 waitAndClickByLinkText(getLinkLocator(), message);
60 waitForTitleToEqualKualiPortalIndex(message);
61 selectFrameIframePortlet();
62 checkForIncidentReport(getLinkLocator(), message);
63 }
64
65 protected void gotoMenuLinkLocator() throws Exception {
66 gotoMenuLinkLocator("");
67 }
68
69 /**
70 * go to having clicked create new of the getLinkLocator()
71 */
72 protected void gotoCreateNew() throws Exception {
73 gotoMenuLinkLocator();
74 waitAndClick(By.xpath(getCreateNewLinkLocator()));
75 // selectFrame("relative=up");
76 checkForIncidentReport(getCreateNewLinkLocator());
77 }
78 }