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.admin.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 AdminTmplMthdSTNavBase extends NavTemplateMethodSTBase {
26  
27      public static final String CREATE_NEW_LOCATOR = "//img[contains(@alt,'create new')]";
28  //    public static final String CREATE_NEW_LOCATOR = "//a[contains(@href,'command=initiate')]"; // not with IE8
29  //    public static final String CREATE_NEW_LOCATOR = "//a[@title='Create a new record']"; // not with IE8
30      public static final String ADMIN_LOCATOR = "Administration";
31      public static final String LABEL_KUALI_KUALI_SYSTEMS = "KUALI - Kuali Systems";
32      public static final String LABEL_KUALI_DEFAULT = "KUALI : Default";
33      public static final String SPAN_CLASS_PAGEBANNER = "//span[@class='pagebanner']";
34  
35      @Override
36      protected String getCreateNewLinkLocator() {
37          return CREATE_NEW_LOCATOR;
38      }
39  
40      @Override
41      protected String getMenuLinkLocator() {
42          return ADMIN_LOCATOR;
43      }
44  
45      /**
46       * tests that a getLinkLocator maintenance document can be cancelled
47       */
48      public void testCreateNewCancelNav() throws Exception {
49          gotoCreateNew();
50          testCancelConfirmation();
51      }
52  
53      /**
54       * tests that a getLinkLocator maintenance document is created for an edit operation originating from a lookup screen
55       */
56      public void testEditCancel() throws Exception {
57          testSearchEditCancel();
58      }
59  
60      public void testSearchEditBack(Failable failable) throws Exception {
61          waitAndClickSearch2();
62          String pageBannerText = getTextByXpath(SPAN_CLASS_PAGEBANNER);
63          waitAndClickByLinkText("edit");
64          waitFor(By.name(BLANKET_APPROVE_NAME));
65          back();
66          checkForIncidentReport();
67          assertTextPresent("Going back from Edit Search results not available", pageBannerText);
68      }
69  
70      public void testSearchSearchBack(Failable failable, String fieldName, String searchText) throws Exception {
71          waitAndClickSearch2();
72          String pageBannerText = getTextByXpath(SPAN_CLASS_PAGEBANNER);
73          waitAndTypeByName(fieldName, searchText);
74          waitAndClickSearch2();
75          back();
76          assertTextPresent("Going back from Search to Search results not available", pageBannerText);
77      }
78  }