1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.samplu.krad.demo.uif.library;
17
18 import com.thoughtworks.selenium.SeleneseTestBase;
19 import edu.samplu.krad.demo.uif.library.DemoLibraryBase;
20 import org.junit.Test;
21 import edu.samplu.common.SmokeTestBase;
22 import org.kuali.rice.krad.uif.UifConstants;
23 import org.openqa.selenium.By;
24 import org.openqa.selenium.WebElement;
25 import org.openqa.selenium.interactions.Actions;
26
27 import java.util.List;
28
29
30
31
32 public class DemoLibraryWidgetsTooltipSmokeTest extends DemoLibraryBase {
33
34
35
36
37 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-Tooltip-View&methodToCall=start";
38
39 @Override
40 protected String getBookmarkUrl() {
41 return BOOKMARK_URL;
42 }
43
44 @Override
45 protected void navigate() throws Exception {
46 waitAndClickById("Demo-LibraryLink", "");
47 waitAndClickByLinkText("Widgets");
48 waitAndClickByLinkText("Tooltip");
49 }
50
51 protected void testWidgetsTooltipHover() throws Exception {
52
53
54 Thread.sleep(1000);
55 fireMouseOverEvent(By.id("u100085_label"));
56 Thread.sleep(1000);
57 WebElement tooltipHoverLabel = driver.findElement(By.xpath("//div[@data-for=\"u100085_label\"]")).findElement(
58 By.className("jquerybubblepopup-innerHtml"));
59 if (!tooltipHoverLabel.isDisplayed()) {
60 fail("Tooltip help for label not displayed.");
61 }
62 if (!tooltipHoverLabel.getText().equals("Sample text for label tooltip")) {
63 fail("Incorrect inner html text for label tooltip hover.");
64 }
65
66
67 fireMouseOverEvent(By.id("u100085_control"));
68 Thread.sleep(1000);
69 WebElement tooltipHoverControl = driver.findElement(By.xpath("//div[@data-for=\"u100085_control\"]"))
70 .findElement(By.className("jquerybubblepopup-innerHtml"));
71 if (!tooltipHoverControl.isDisplayed()) {
72 fail("Tooltip help for control not displayed.");
73 }
74 if (!tooltipHoverControl.getText().equals("This is a helpful tooltip about this field")) {
75 fail("Incorrect inner html text for tooltip hover control.");
76 }
77 }
78
79 protected void testWidgetsTooltipFocus() throws Exception {
80 waitAndClickByLinkText(">> Open Library Navigation");
81 waitAndClickByLinkText("Suggest");
82 waitAndClickByLinkText("Tooltip");
83 select(By.id("Demo-LargeExampleDropdown_control"), "Tooltip On Focus");
84
85
86 fireMouseOverEvent(By.id("u100101_label"));
87 Thread.sleep(1000);
88 WebElement tooltipFocusLabel = driver.findElement(By.xpath("//div[@data-for=\"u100101_label\"]")).findElement(
89 By.className("jquerybubblepopup-innerHtml"));
90 if (!tooltipFocusLabel.isDisplayed()) {
91 fail("Tooltip help for label not displayed.");
92 }
93 if (!tooltipFocusLabel.getText().equals("Click on the text box for a tool tip")) {
94 fail("Incorrect inner html text for label focus tooltip.");
95 }
96
97
98 waitAndClickById("u100101_control");
99 Thread.sleep(1000);
100 WebElement tooltipFocusControl = driver.findElement(By.xpath("//div[@data-for=\"u100101_control\"]"))
101 .findElement(By.className("jquerybubblepopup-innerHtml"));
102 if (!tooltipFocusControl.isDisplayed()) {
103 fail("Tooltip help for control not displayed.");
104 }
105 if (!tooltipFocusControl.getText().equals("This tooltip appears when the field receives focus")) {
106 fail("Incorrect inner html text for tooltip focus control.");
107 }
108 }
109
110 @Test
111 public void testWidgetsTooltipBookmark() throws Exception {
112 testWidgetsTooltipHover();
113 testWidgetsTooltipFocus();
114 driver.close();
115 passed();
116 }
117
118 @Test
119 public void testWidgetsTooltipNav() throws Exception {
120 testWidgetsTooltipHover();
121 testWidgetsTooltipFocus();
122 driver.close();
123 passed();
124 }
125 }