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.krad.demo.uif.library;
017    
018    import com.thoughtworks.selenium.SeleneseTestBase;
019    import edu.samplu.common.Failable;
020    import org.junit.Test;
021    
022    /**
023     * @author Kuali Rice Team (rice.collab@kuali.org)
024     */
025    public class DemoLibraryNavigationSmokeTest extends DemoLibraryNavigationBase {
026    
027        /**
028         * /kr-krad/kradsampleapp?viewId=ComponentLibraryHome
029         */
030        public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-NavigationGroup-View";
031    
032        @Override
033        public String getBookmarkUrl() {
034            return BOOKMARK_URL;
035        }
036    
037        @Override
038        protected void navigate() throws Exception {
039            navigateToExample("Demo-NavigationGroup-Example1");
040        }
041    
042        protected void testNavigationTabs() throws Exception {
043            waitAndClickByLinkText("Navigation Group Tab Example");
044            try {
045                selectWindow(driver.getWindowHandles().toArray()[1].toString());
046            } catch (Throwable t) {
047                fail("Expected another window to be opened " + t.getCause());
048            }
049            waitForElementPresentByClassName("uif-headerText-span");
050            SeleneseTestBase.assertTrue(driver.getTitle().contains("Kuali :: Navigation View"));
051            assertTextPresent("Navigation View");
052        }
053    
054        public void testNavigationMenuBookmark(Failable failable) throws Exception {
055            testNavigationTabs();
056            testNavigationView();
057            passed();
058        }
059    
060        public void testNavigationMenuNav(Failable failable) throws Exception {
061            navigateToLibraryDemo("Navigation", "Navigation Group");
062            testNavigationTabs();
063            testNavigationView();
064            passed();
065        }
066    
067        @Test
068        public void testNavigationMenuBookmark() throws Exception {
069            testNavigationMenuBookmark(this);
070        }
071    
072        @Test
073        public void testNavigationMenuNav() throws Exception {
074            testNavigationMenuNav(this);
075        }
076    }