001 /**
002 * Copyright 2005-2014 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.sampleu.krad.compview;
017
018 import org.kuali.rice.testtools.common.JiraAwareFailable;
019 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
020 import org.openqa.selenium.By;
021
022 /**
023 * Tests the Component section in Rice.
024 *
025 * @author Kuali Rice Team (rice.collab@kuali.org)
026 */
027 public abstract class UifTooltipAftBase extends WebDriverLegacyITBase {
028
029 /**
030 * /kr-krad/uicomponents?viewId=UifCompView&methodToCall=start&pageId=UifCompView-Page10
031 */
032 public static final String BOOKMARK_URL = "/kr-krad/uicomponents?viewId=UifCompView&methodToCall=start&pageId=UifCompView-Page10";
033
034 private static final String NAME_FIELD_1 = "field1";
035 private static final String NAME_FIELD_2 = "field2";
036
037 @Override
038 protected String getBookmarkUrl() {
039 return BOOKMARK_URL;
040 }
041
042 protected void navigation() throws Exception {
043 waitAndClickKRAD();
044 waitAndClickByXpath(KITCHEN_SINK_XPATH);
045 switchToWindow(KUALI_UIF_COMPONENTS_WINDOW_XPATH);
046 }
047
048 protected void testUifTooltipByName(String nameField1, String nameField2) throws Exception {
049 findElement(By.name(nameField2)); // fields must be in view for tooltips to be displayed
050
051 // check if tooltip opens on focus
052 fireEvent(nameField1, "focus");
053 fireMouseOverEventByName(nameField1);
054
055 assertEquals("This tooltip is triggered by focus or and mouse over.", getText(
056 "td.jquerybubblepopup-innerHtml"));
057 fireEvent(nameField1, "blur");
058
059 fireEvent(nameField2, "focus");
060 Thread.sleep(5000);
061
062 // check if tooltip opens on mouse over
063 fireMouseOverEventByName(nameField2);
064 assertTrue("unable to detect tooltip", isVisibleByXpath("//td[contains(.,\"This is a tool-tip with different position and tail options\")]"));
065
066 // check if tooltip closed on mouse out of nameField2
067 fireEvent(nameField2, "blur");
068 waitAndTypeByName(nameField1, "");
069 Thread.sleep(5000);
070 assertFalse("able to detect tooltip", isVisibleByXpath(
071 "//td[contains(.,\"This is a tool-tip with different position and tail options\")]"));
072
073 // check that default tooltip does not display when there are an error message on the field
074 waitAndTypeByName(nameField1, "1");
075 fireEvent(nameField1, "blur");
076 fireMouseOverEventByName(nameField1);
077 Thread.sleep(10000);
078 }
079
080 protected void testUifTooltipNav(JiraAwareFailable failable) throws Exception {
081 navigation();
082 waitAndClickByLinkText("Other Examples");
083 testUifTooltipByName(NAME_FIELD_1, NAME_FIELD_2);
084 passed();
085 }
086
087 protected void testUifTooltipBookmark(JiraAwareFailable failable) throws Exception {
088 testUifTooltipByName(NAME_FIELD_1, NAME_FIELD_2);
089 passed();
090 }
091 }