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