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 {@link edu.samplu.common.Failable}.
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 ITUtil#PORTAL} for both navigation and bookmark tests so it will not be overridden by subclasses.
035         * @return {@link 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 LoginLogoutAbstractSmokeTestBase#waitAndClickLogout(edu.samplu.common.Failable)}
049         *
050         * @param failable {@link edu.samplu.common.Failable}
051         * @throws Exception
052         */
053        public void testLogoutNav(Failable failable) throws Exception {
054            navigate(failable);
055            testLogout(failable);
056        }
057    
058        /**
059         * Click Logout on the current page.  {@link LoginLogoutAbstractSmokeTestBase#waitAndClickLogout(edu.samplu.common.Failable)}
060         *
061         * @param failable {@link edu.samplu.common.Failable}
062         * @throws Exception
063         */
064        public void testLogoutBookmark(Failable failable) throws Exception {
065            testLogout(failable);
066        }
067    
068        private void testLogout(Failable failable) throws InterruptedException {
069            jGrowl("Logging Out");
070            waitAndClickLogout(failable);
071            passed();
072        }
073    }