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 org.junit.Test;
019 import org.openqa.selenium.By;
020 import org.openqa.selenium.WebElement;
021
022 /**
023 * @author Kuali Rice Team (rice.collab@kuali.org)
024 */
025 public class DemoLibraryWidgetsGrowlSmokeTest extends DemoLibraryBase {
026
027 /**
028 * /kr-krad/kradsampleapp?viewId=Demo-Growls-View&methodToCall=start
029 */
030 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-Growls-View&methodToCall=start";
031
032 @Override
033 protected String getBookmarkUrl() {
034 return BOOKMARK_URL;
035 }
036
037 @Override
038 protected void navigate() throws Exception {
039 navigateToLibraryDemo("Widgets", "Growls");
040 }
041
042 protected void testWidgetsGrowlDefault() throws Exception {
043
044 //check if growl text is present
045 assertTextNotPresent("Sample Message Text. Data passed: none");
046
047 //create growl
048 waitAndClickButtonByText("Growl");
049
050 //give it a second to display
051 Thread.sleep(1000);
052
053 //check growl text is present
054 assertTextPresent("Sample Message Text. Data passed: none");
055 }
056
057 protected void testWidgetsDatePickerWidget() throws Exception {
058 waitAndClickByLinkText(">> Open Library Navigation");
059 waitAndClickByLinkText("Suggest");
060 waitAndClickByLinkText("Tooltip");
061 select(By.id("Demo-LargeExampleDropdown_control"), "Tooltip On Focus");
062
063 //focus label
064 fireMouseOverEvent(By.id("u100101_label"));
065 Thread.sleep(1000);
066 WebElement tooltipFocusLabel = driver.findElement(By.xpath("//div[@data-for=\"u100101_label\"]")).findElement(
067 By.className("jquerybubblepopup-innerHtml"));
068 if (!tooltipFocusLabel.isDisplayed()) {
069 fail("Tooltip help for label not displayed.");
070 }
071 if (!tooltipFocusLabel.getText().equals("Click on the text box for a tool tip")) {
072 fail("Incorrect inner html text for label focus tooltip.");
073 }
074
075 //focus control
076 waitAndClickById("u100101_control");
077 Thread.sleep(1000);
078 WebElement tooltipFocusControl = driver.findElement(By.xpath("//div[@data-for=\"u100101_control\"]"))
079 .findElement(By.className("jquerybubblepopup-innerHtml"));
080 if (!tooltipFocusControl.isDisplayed()) {
081 fail("Tooltip help for control not displayed.");
082 }
083 if (!tooltipFocusControl.getText().equals("This tooltip appears when the field receives focus")) {
084 fail("Incorrect inner html text for tooltip focus control.");
085 }
086 }
087
088 @Test
089 public void testWidgetsGrowlBookmark() throws Exception {
090 testWidgetsGrowlDefault();
091 passed();
092 }
093
094 @Test
095 public void testWidgetsGrowlNav() throws Exception {
096 testWidgetsGrowlDefault();
097 passed();
098 }
099 }