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.mainmenu.test;
17  
18  import edu.samplu.common.Failable;
19  import edu.samplu.common.NavTemplateMethodSTBase;
20  import org.openqa.selenium.By;
21  
22  /**
23   * @author Kuali Rice Team (rice.collab@kuali.org)
24   */
25  public abstract class MainTmplMthdSTNavBase extends NavTemplateMethodSTBase {
26  
27      public static final String DATA_TABLES_INFO = "dataTables_info";
28  
29      @Override
30      protected String getCreateNewLinkLocator() {
31          return "Create New";
32      }
33  
34      @Override
35      protected String getMenuLinkLocator() {
36          return "Main Menu";
37      }
38  
39      protected void testSearchEditBack(Failable failable) throws Exception {
40          waitAndClickSearch3();
41          waitForElementPresentByClassName(DATA_TABLES_INFO);
42          String pageBannerText = getText(By.className(DATA_TABLES_INFO));
43          waitAndClickEdit();
44          waitForElementPresentByClassName("uif-headerText-span");
45          back();
46          waitForElementPresentByClassName(DATA_TABLES_INFO);
47          if (!pageBannerText.equals(getText(By.className(DATA_TABLES_INFO)))) {
48              failable.fail("Going back from Search to Edit results not available");
49          }
50      }
51  
52      protected void testSearchSearchBack(Failable failable, String fieldName, String searchText) throws Exception {
53          waitAndClickSearch3();
54          waitForElementPresentByClassName(DATA_TABLES_INFO);
55          String pageBannerText = getText(By.className(DATA_TABLES_INFO));
56          waitAndTypeByName(fieldName, searchText);
57          waitAndClickSearch3();
58          waitForElementPresentByClassName(DATA_TABLES_INFO, "Problem with second search");
59          back();
60          waitForElementsPresentByClassName(DATA_TABLES_INFO, "Going back from Search to Search results not available");
61          assertTextPresent("Going back from Search to Search results not available", pageBannerText);
62      }
63  }