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