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.navigation; 017 018 import com.thoughtworks.selenium.SeleneseTestBase; 019 import edu.samplu.common.Failable; 020 import edu.samplu.common.ITUtil; 021 import edu.samplu.common.WebDriverLegacyITBase; 022 import edu.samplu.krad.demo.uif.library.DemoLibraryITBase; 023 024 /** 025 * @author Kuali Rice Team (rice.collab@kuali.org) 026 */ 027 public abstract class DemoLibraryNavigationSmokeTestBase extends DemoLibraryITBase { 028 029 /** 030 * /kr-krad/kradsampleapp?viewId=ComponentLibraryHome 031 */ 032 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-NavigationGroup-View"; 033 034 /** 035 * /kr-krad/kradsampleapp?viewId=NavigationGroup-NavigationView&methodToCall=start 036 */ 037 public static final String BOOKMARK_VIEW_URL = "/kr-krad/kradsampleapp?viewId=NavigationGroup-NavigationView&methodToCall=start"; 038 039 @Override 040 public String getTestUrl() { 041 return ITUtil.KRAD_PORTAL; 042 } 043 044 protected void testNavigationTabs() throws Exception { 045 navigateToExample("Demo-NavigationGroup-Example1"); 046 047 waitAndClickByLinkText("Navigation Group Tab Example"); 048 selectWindow(driver.getWindowHandles().toArray()[1].toString()); 049 waitForElementPresentByClassName("uif-headerText-span"); 050 SeleneseTestBase.assertTrue(driver.getTitle().contains("Kuali :: Navigation View")); 051 assertTextPresent("Navigation View"); 052 } 053 054 protected void testNavigationView() throws Exception { 055 assertNavigationView("Page 2", "Test Course 2"); 056 assertNavigationView("Page 3", "Test Course 3"); 057 assertNavigationView("Page 1", "Test Course 1"); 058 } 059 060 protected void assertNavigationView(String linkText, String supportTitleText) throws Exception { 061 waitAndClickByLinkText(linkText); 062 waitForElementPresentByClassName("uif-viewHeader-supportTitle"); 063 SeleneseTestBase.assertTrue(getTextByClassName("uif-viewHeader-supportTitle").contains(supportTitleText)); 064 } 065 066 public void testNavigationMenuBookmark(Failable failable) throws Exception { 067 testNavigationTabs(); 068 testNavigationView(); 069 passed(); 070 } 071 072 public void testNavigationMenuNav(Failable failable) throws Exception { 073 navigateToLibraryDemo("Navigation", "Navigation Group"); 074 testNavigationTabs(); 075 testNavigationView(); 076 passed(); 077 } 078 079 public void testNavigationViewBookmark(Failable failable) throws Exception { 080 testNavigationView(); 081 passed(); 082 } 083 }