001    /**
002     * Copyright 2005-2013 The Kuali Foundation
003     *
004     * Licensed under the Educational Community License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     * http://www.opensource.org/licenses/ecl2.php
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package edu.samplu.mainmenu.test;
017    
018    import edu.samplu.common.Failable;
019    import edu.samplu.common.ITUtil;
020    import edu.samplu.common.WebDriverLegacyITBase;
021    
022    /**
023     * Abstract base class for LoginLogout Smoke Tests.  Framework specific classes should not be depended upon in this
024     * class but abstracted behind the {@link edu.samplu.common.Failable} interface.
025     *
026     * @see edu.samplu.common.Failable
027     * @see LoginLogoutSTNGBase
028     * @see LoginLogoutSTJUnitBase
029     * @author Kuali Rice Team (rice.collab@kuali.org)
030     */
031    public abstract class LoginLogoutAbstractSmokeTestBase extends WebDriverLegacyITBase {
032    
033        /**
034         * LoginLogout can use {@link edu.samplu.common.ITUtil#PORTAL} for both navigation and bookmark tests so it will not be overridden by subclasses.
035         * @return {@link edu.samplu.common.ITUtil#PORTAL}
036         */
037        @Override
038        public String getTestUrl() {
039            return ITUtil.PORTAL;
040        }
041    
042        private void navigate(Failable failable) throws InterruptedException {
043            waitAndClickMainMenu(failable);
044            waitForPageToLoad();
045        }
046    
047        /**
048         * Navigate to the page under test click logout.  {@link edu.samplu.mainmenu.test.LoginLogoutAbstractSmokeTestBase#waitAndClickLogout(edu.samplu.common.Failable)}
049         *
050         * @param failable {@link edu.samplu.common.Failable}
051         * @throws {@link Exception}
052         */
053        public void testLogoutNav(Failable failable) throws Exception {
054            navigate(failable);
055            testLogout(failable);
056            passed();
057        }
058    
059        /**
060         * Click Logout on the current page. {@link edu.samplu.mainmenu.test.LoginLogoutAbstractSmokeTestBase#waitAndClickLogout(edu.samplu.common.Failable)}
061         *
062         * @param failable {@link edu.samplu.common.Failable}
063         * @throws Exception
064         */
065        public void testLogoutBookmark(Failable failable) throws Exception {
066            testLogout(failable);
067            passed();
068        }
069    
070        private void testLogout(Failable failable) throws InterruptedException {
071            jGrowl("Logging Out");
072            waitAndClickLogout(failable);
073        }
074    }