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.ITUtil;
20  import edu.samplu.common.WebDriverLegacyITBase;
21  
22  /**
23   * Abstract base class for LoginLogout Smoke Tests.  Framework specific classes should not be depended upon in this
24   * class but abstracted behind the {@link edu.samplu.common.Failable} interface.
25   *
26   * @see edu.samplu.common.Failable
27   * @see LoginLogoutSTNGBase
28   * @see LoginLogoutSTJUnitBase
29   * @author Kuali Rice Team (rice.collab@kuali.org)
30   */
31  public abstract class LoginLogoutAbstractSmokeTestBase extends WebDriverLegacyITBase {
32  
33      /**
34       * LoginLogout can use {@link edu.samplu.common.ITUtil#PORTAL} for both navigation and bookmark tests so it will not be overridden by subclasses.
35       * @return {@link edu.samplu.common.ITUtil#PORTAL}
36       */
37      @Override
38      public String getTestUrl() {
39          return ITUtil.PORTAL;
40      }
41  
42      private void navigate(Failable failable) throws InterruptedException {
43          waitAndClickMainMenu(failable);
44          waitForPageToLoad();
45      }
46  
47      /**
48       * Navigate to the page under test click logout.  {@link edu.samplu.mainmenu.test.LoginLogoutAbstractSmokeTestBase#waitAndClickLogout(edu.samplu.common.Failable)}
49       *
50       * @param failable {@link edu.samplu.common.Failable}
51       * @throws {@link Exception}
52       */
53      public void testLogoutNav(Failable failable) throws Exception {
54          navigate(failable);
55          testLogout(failable);
56          passed();
57      }
58  
59      /**
60       * Click Logout on the current page. {@link edu.samplu.mainmenu.test.LoginLogoutAbstractSmokeTestBase#waitAndClickLogout(edu.samplu.common.Failable)}
61       *
62       * @param failable {@link edu.samplu.common.Failable}
63       * @throws Exception
64       */
65      public void testLogoutBookmark(Failable failable) throws Exception {
66          testLogout(failable);
67          passed();
68      }
69  
70      private void testLogout(Failable failable) throws InterruptedException {
71          jGrowl("Logging Out");
72          waitAndClickLogout(failable);
73      }
74  }