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