View Javadoc

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