1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.samplu.krad.configview;
17
18 import edu.samplu.common.UpgradedSeleniumITBase;
19 import org.junit.After;
20 import org.junit.Before;
21 import org.junit.Ignore;
22 import org.junit.Test;
23
24 import com.thoughtworks.selenium.DefaultSelenium;
25 import com.thoughtworks.selenium.Selenium;
26
27 import static org.junit.Assert.*;
28
29
30
31
32
33
34
35
36
37
38
39
40 public class HelpIT extends UpgradedSeleniumITBase {
41
42
43
44 private long HELP_WINDOW_LOAD_DELAY = 3000;
45
46 @Override
47 public String getTestUrl() {
48 return "/kr-krad/configuration-test-view-uif-controller?viewId=ConfigurationTestView-Help&methodToCall=start";
49 }
50
51
52
53
54 @Test
55 public void testViewHelp() throws Exception {
56
57 selenium.mouseOver("css=h1 .uif-headerText-span");
58 assertEquals("Sample text for view help", selenium.getText("css=td.jquerybubblepopup-innerHtml"));
59
60
61 selenium.click("css=input[title=\"Help for Configuration Test View - Help\"]");
62 selenium.waitForPopUp("HelpWindow", "30000");
63 selenium.selectPopUp("HelpWindow");
64 assertEquals("http://www.kuali.org/?view", selenium.getLocation());
65 selenium.deselectPopUp();
66 }
67
68
69
70
71 @Test
72 public void testPageHelp() throws Exception {
73
74 selenium.mouseOver("css=h2 .uif-headerText-span");
75 assertEquals("Sample text for page help", selenium.getText("css=td.jquerybubblepopup-innerHtml"));
76
77
78 selenium.click("css=input[title=\"Help for Help Page\"]");
79 selenium.waitForPopUp("HelpWindow", "30000");
80 selenium.selectPopUp("HelpWindow");
81 assertEquals("http://www.kuali.org/?page", selenium.getLocation());
82 selenium.deselectPopUp();
83 }
84
85
86
87
88 @Test
89 public void testTooltipHelp() throws Exception {
90
91 if (selenium.isElementPresent("css=td:contains(\"Sample text for section help - tooltip help\")")) {
92 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for section help - tooltip help\")"));
93 }
94 if (selenium.isElementPresent("css=td:contains(\"Sample text for field help - label left\")")) {
95 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for field help - label left\")"));
96 }
97 if (selenium.isElementPresent("css=td:contains(\"Sample text for field help - label right\")")) {
98 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for field help - label right\")"));
99 }
100 if (selenium.isElementPresent("css=td:contains(\"Sample text for field help - label top\")")) {
101 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for field help - label top\")"));
102 }
103 if (selenium.isElementPresent("css=td:contains(\"Sample text for standalone help widget tooltip which will never be rendered\")")) {
104 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for standalone help widget tooltip which will never be rendered\")"));
105 }
106 if (selenium.isElementPresent("css=td:contains(\"Sample text for field help - there is also a tooltip on the label but it is overridden by the help tooltip\")")) {
107 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for field help - there is also a tooltip on the label but it is overridden by the help tooltip\")"));
108 }
109 if (selenium.isElementPresent("css=td:contains(\"Sample text for label tooltip - this will not be rendered as it is overridden by the help tooltip\")")) {
110 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for label tooltip - this will not be rendered as it is overridden by the help tooltip\")"));
111 }
112 if (selenium.isElementPresent("css=td:contains(\"Sample text for field help - there is also an on-focus tooltip\")")) {
113 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for field help - there is also an on-focus tooltip\")"));
114 }
115 if (selenium.isElementPresent("css=td:contains(\"Sample text for on-focus event tooltip\")")) {
116 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for on-focus event tooltip\")"));
117 }
118 if (selenium.isElementPresent("css=td:contains(\"Sample text for check box help\")")) {
119 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for check box help\")"));
120 }
121
122
123 selenium.mouseOver("css=#ConfigurationTestView-Help-Section1 h3 .uif-headerText-span");
124 assertTrue(selenium.isVisible("css=td:contains(\"Sample text for section help - tooltip help\")"));
125 selenium.mouseOut("css=#ConfigurationTestView-Help-Section1 h3 .uif-headerText-span");
126 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for section help - tooltip help\")"));
127
128
129 assertFalse(selenium.isElementPresent("css=#ConfigurationTestView-Help-Section1 input.uif-helpImage"));
130
131
132 selenium.mouseOver("id=field-label-left_label");
133 assertTrue(selenium.isVisible("css=td:contains(\"Sample text for field help - label left\")"));
134 selenium.mouseOut("id=field-label-left_label");
135 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for field help - label left\")"));
136
137
138 selenium.mouseOver("id=field-label-right_label");
139 assertTrue(selenium.isVisible("css=td:contains(\"Sample text for field help - label righ\")"));
140 selenium.mouseOut("id=field-label-right_label");
141 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for field help - label right\")"));
142
143
144 selenium.mouseOver("id=field-label-top_label");
145 assertTrue(selenium.isVisible("css=td:contains(\"Sample text for field help - label top\")"));
146 selenium.mouseOut("id=field-label-top_label");
147 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for field help - label top\")"));
148
149
150 assertFalse(selenium.isElementPresent("id=standalone-help-not-rendered"));
151
152
153 selenium.mouseOver("id=override-tooltip_label");
154 assertTrue(selenium.isVisible("css=td:contains(\"Sample text for field help - there is also a tooltip on the label but it is overridden by the help tooltip\")"));
155 if (selenium.isElementPresent("css=td:contains(\"Sample text for label tooltip - this will not be rendered as it is overridden by the help tooltip\")")) {
156 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for label tooltip - this will not be rendered as it is overridden by the help tooltip\")"));
157 }
158 selenium.mouseOut("id=override-tooltip_label");
159 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for field help - there is also a tooltip on the label but it is overridden by the help tooltip\")"));
160
161
162 selenium.mouseOver("id=on-focus-tooltip_control");
163 assertTrue(selenium.isVisible("css=td:contains(\"Sample text for on-focus event tooltip\")"));
164 selenium.mouseOver("id=on-focus-tooltip_label");
165 assertTrue(selenium.isVisible("css=td:contains(\"Sample text for field help - there is also an on-focus tooltip\")"));
166 selenium.mouseOut("id=on-focus-tooltip_control");
167 selenium.mouseOut("id=on-focus-tooltip_label");
168 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for field help - there is also an on-focus tooltip\")"));
169 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for on-focus event tooltip\")"));
170
171
172 selenium.mouseOver("id=checkbox_label");
173 assertTrue(selenium.isVisible("css=td:contains(\"Sample text for check box help\")"));
174 selenium.mouseOut("id=checkbox_label");
175 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for check box help\")"));
176 }
177
178
179
180
181 @Test
182 public void testDisplayOnlyTooltipHelp() throws Exception {
183
184 if (selenium.isElementPresent("css=td:contains(\"Sample text for sub-section help\")")) {
185 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for sub-section help\")"));
186 }
187 if (selenium.isElementPresent("css=td:contains(\"Sample text for read only field help\")")) {
188 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for read only field help\")"));
189 }
190
191
192 selenium.mouseOver("css=h4 .uif-headerText-span");
193 assertTrue(selenium.isVisible("css=td:contains(\"Sample text for sub-section help\")"));
194 selenium.mouseOut("css=h4 .uif-headerText-span");
195 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for sub-section help\")"));
196
197
198 selenium.mouseOver("css=#display-field label");
199 assertTrue(selenium.isVisible("css=td:contains(\"Sample text for read only field help\")"));
200 selenium.mouseOut("css=#display-field label");
201 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for read only field help\")"));
202 }
203
204
205
206
207 @Test
208 public void testMissingTooltipHelp() throws Exception {
209
210 assertFalse(selenium.isElementPresent("css=.jquerybubblepopup"));
211
212
213 assertFalse(selenium.isElementPresent("css=#ConfigurationTestView-Help-Section2 input.uif-helpImage"));
214
215
216 selenium.mouseOver("css=#ConfigurationTestView-Help-Section2 h3 .uif-headerText-span");
217 assertFalse(selenium.isElementPresent("css=.jquerybubblepopup"));
218 selenium.mouseOut("css=#ConfigurationTestView-Help-Section1 h3 .uif-headerText-span");
219 assertFalse(selenium.isElementPresent("css=.jquerybubblepopup"));
220
221
222 selenium.mouseOver("id=missing-tooltip-help_label");
223 assertFalse(selenium.isElementPresent("css=.jquerybubblepopup"));
224 selenium.mouseOut("id=missing-tooltip-help_label");
225 assertFalse(selenium.isElementPresent("css=.jquerybubblepopup"));
226 }
227 }