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 org.kuali.rice.testtools.selenium.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            Thread.sleep(1000);
045            try {
046                selectWindow(driver.getWindowHandles().toArray()[1].toString());
047            } catch (Throwable t) {
048                fail("Expected another window to be opened " + t.getCause());
049            }
050            waitForElementPresentByClassName("uif-headerText-span");
051            SeleneseTestBase.assertTrue(driver.getTitle().contains("Kuali :: Navigation View"));
052            assertTextPresent("Navigation View");
053        }
054    
055        public void testNavigationMenuBookmark(Failable failable) throws Exception {
056            testNavigationTabs();
057            testNavigationView();
058            passed();
059        }
060    
061        public void testNavigationMenuNav(Failable failable) throws Exception {
062            navigateToLibraryDemo("Navigation", "Navigation Group");
063            testNavigationTabs();
064            testNavigationView();
065            passed();
066        }
067    
068        @Test
069        public void testNavigationMenuBookmark() throws Exception {
070            testNavigationMenuBookmark(this);
071        }
072    
073        @Test
074        public void testNavigationMenuNav() throws Exception {
075            testNavigationMenuNav(this);
076        }
077    }