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