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 SmokeTestBase {
24
25 @Override
26 protected String getBookmarkUrl() {
27 return testUrl;
28 }
29
30 @Override
31 public String getTestUrl() {
32 return testUrl;
33 }
34
35 /**
36 * TODO when the UpgradedSelenium tests have been converted over, rename this to getMenuLinkText
37 * Override to return menu click selector (e.g. "Main Menu")
38 * @return selenium locator to click on
39 */
40 protected abstract String getMenuLinkLocator();
41
42 /**
43 * TODO when the UpgradedSelenium tests have been converted over, rename this to getLinkText
44 * Override to return main menu click selector (e.g. "Agenda lookup")
45 * @return selenium locator to click on
46 */
47 protected abstract String getLinkLocator();
48
49
50 /**
51 * Override to return main menu click selector (e.g. "//img[@alt='create new']")
52 * @return selenium locator to click on
53 */
54 protected abstract String getCreateNewLinkLocator();
55
56 /**
57 * go to the getMenuLinkLocator() Menu and click the getLinkLocator()
58 */
59 protected void gotoMenuLinkLocator(String message) throws Exception {
60 waitForTitleToEqualKualiPortalIndex();
61 selectTopFrame();
62 waitAndClickByLinkText(getMenuLinkLocator(), message);
63 waitForTitleToEqualKualiPortalIndex();
64 waitAndClickByLinkText(getLinkLocator(), message);
65 waitForTitleToEqualKualiPortalIndex(message);
66 selectFrameIframePortlet();
67 checkForIncidentReport(getLinkLocator(), message);
68 }
69
70
71 protected void navigate() throws Exception {
72 gotoMenuLinkLocator("");
73 }
74
75 /**
76 * go to having clicked create new of the getLinkLocator()
77 */
78 protected void gotoCreateNew() throws Exception {
79 navigate();
80 waitAndClick(By.xpath(getCreateNewLinkLocator()));
81 // selectFrame("relative=up");
82 checkForIncidentReport(getCreateNewLinkLocator());
83 }
84 }