001 /*
002 * Copyright 2006-2012 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.compview;
017
018 import edu.samplu.common.UpgradedSeleniumITBase;
019 import junit.framework.Assert;
020 import org.junit.Test;
021
022 /**
023 * Selenium test that tests that tooltips are rendered on mouse over and focus events
024 * and hidden on mouse out and blur events
025 *
026 * @author Kuali Rice Team (rice.collab@kuali.org)
027 */
028 public class UifTooltipIT extends UpgradedSeleniumITBase {
029 @Override
030 public String getTestUrl() {
031 // open Other Examples page in kitchen sink view
032 return "/kr-krad/uicomponents?viewId=UifCompView&methodToCall=start&pageId=UifCompView-Page10";
033 }
034
035 @Test
036 public void testTooltip() throws Exception {
037 // check if tooltip opens on focus
038 selenium.fireEvent("name=field1", "focus");
039 Assert.assertTrue(selenium.isVisible(
040 "//td[contains(.,\"This tooltip is triggered by focus or and mouse over.\")]"));
041 // check if tooltip closed on blur
042 selenium.fireEvent("name=field1", "blur");
043 Assert.assertFalse(selenium.isVisible(
044 "//td[contains(.,\"This tooltip is triggered by focus or and mouse over.\")]"));
045 // check if tooltip opens on mouse over
046 selenium.mouseOver("name=field2");
047 Assert.assertTrue(selenium.isVisible(
048 "//td[contains(.,\"This is a tool-tip with different position and tail options\")]"));
049 // check if tooltip closed on mouse out
050 selenium.mouseOut("name=field2");
051 Assert.assertFalse(selenium.isVisible(
052 "//td[contains(.,\"This is a tool-tip with different position and tail options\")]"));
053 // check that default tooltip does not display when there are an error message on the field
054 selenium.type("name=field1", "1");
055 selenium.fireEvent("name=field1", "blur");
056 selenium.fireEvent("name=field1", "focus");
057 Assert.assertFalse(selenium.isVisible(
058 "//td[contains(.,\"This tooltip is triggered by focus or and mouse over.\")]"));
059 }
060 }