1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.samplu.krad.configview;
17
18 import org.junit.After;
19 import org.junit.Before;
20 import org.junit.Ignore;
21 import org.junit.Test;
22
23 import com.thoughtworks.selenium.DefaultSelenium;
24 import com.thoughtworks.selenium.Selenium;
25
26 import static org.junit.Assert.*;
27
28
29
30
31
32
33 public class HelpIT {
34 private Selenium selenium;
35
36
37
38 private long HELP_WINDOW_LOAD_DELAY = 3000;
39
40 @Before
41 public void setUp() throws Exception {
42 System.setProperty("remote.public.url", "http://localhost:8080/kr-dev/kr-krad/configuration-test-view-uif-controller?viewId=ConfigurationTestView-Help&methodToCall=start");
43 selenium = new DefaultSelenium("localhost", 4444, "*firefox", System.getProperty("remote.public.url"));
44 selenium.start();
45
46
47 selenium.open(System.getProperty("remote.public.url"));
48 assertEquals("Login", selenium.getTitle());
49 selenium.type("__login_user", "admin");
50 selenium.click("//input[@value='Login']");
51 selenium.waitForPageToLoad("30000");
52 }
53
54
55
56
57 @Test
58 public void testViewHelp() throws Exception {
59
60 selenium.mouseOver("css=h1 .uif-headerText-span");
61 assertEquals("Sample text for view help", selenium.getText("css=td.jquerybubblepopup-innerHtml"));
62
63
64 selenium.click("css=input[title=\"Help for Configuration Test View - Help\"]");
65 selenium.waitForPopUp("HelpWindow", "30000");
66 selenium.selectPopUp("HelpWindow");
67 assertEquals("http://www.kuali.org/?view", selenium.getLocation());
68 selenium.deselectPopUp();
69 }
70
71
72
73
74 @Test
75 public void testPageHelp() throws Exception {
76
77 selenium.mouseOver("css=h2 .uif-headerText-span");
78 assertEquals("Sample text for page help", selenium.getText("css=td.jquerybubblepopup-innerHtml"));
79
80
81 selenium.click("css=input[title=\"Help for Help Page\"]");
82 selenium.waitForPopUp("HelpWindow", "30000");
83 selenium.selectPopUp("HelpWindow");
84 assertEquals("http://www.kuali.org/?page", selenium.getLocation());
85 selenium.deselectPopUp();
86 }
87
88
89
90
91 @Test
92 public void testTooltipHelp() throws Exception {
93
94 if (selenium.isElementPresent("css=td:contains(\"Sample text for section help - tooltip help\")")) {
95 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for section help - tooltip help\")"));
96 }
97 if (selenium.isElementPresent("css=td:contains(\"Sample text for field help - label left\")")) {
98 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for field help - label left\")"));
99 }
100 if (selenium.isElementPresent("css=td:contains(\"Sample text for field help - label right\")")) {
101 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for field help - label right\")"));
102 }
103 if (selenium.isElementPresent("css=td:contains(\"Sample text for field help - label top\")")) {
104 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for field help - label top\")"));
105 }
106 if (selenium.isElementPresent("css=td:contains(\"Sample text for standalone help widget tooltip which will never be rendered\")")) {
107 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for standalone help widget tooltip which will never be rendered\")"));
108 }
109 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\")")) {
110 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\")"));
111 }
112 if (selenium.isElementPresent("css=td:contains(\"Sample text for label tooltip - this will not be rendered as it is overridden by the help tooltip\")")) {
113 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for label tooltip - this will not be rendered as it is overridden by the help tooltip\")"));
114 }
115 if (selenium.isElementPresent("css=td:contains(\"Sample text for field help - there is also an on-focus tooltip\")")) {
116 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for field help - there is also an on-focus tooltip\")"));
117 }
118 if (selenium.isElementPresent("css=td:contains(\"Sample text for on-focus event tooltip\")")) {
119 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for on-focus event tooltip\")"));
120 }
121 if (selenium.isElementPresent("css=td:contains(\"Sample text for check box help\")")) {
122 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for check box help\")"));
123 }
124
125
126 selenium.mouseOver("css=#ConfigurationTestView-Help-Section1 h3 .uif-headerText-span");
127 assertTrue(selenium.isVisible("css=td:contains(\"Sample text for section help - tooltip help\")"));
128 selenium.mouseOut("css=#ConfigurationTestView-Help-Section1 h3 .uif-headerText-span");
129 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for section help - tooltip help\")"));
130
131
132 assertFalse(selenium.isElementPresent("css=#ConfigurationTestView-Help-Section1 input.uif-helpImage"));
133
134
135 selenium.mouseOver("id=field-label-left_label");
136 assertTrue(selenium.isVisible("css=td:contains(\"Sample text for field help - label left\")"));
137 selenium.mouseOut("id=field-label-left_label");
138 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for field help - label left\")"));
139
140
141 selenium.mouseOver("id=field-label-right_label");
142 assertTrue(selenium.isVisible("css=td:contains(\"Sample text for field help - label righ\")"));
143 selenium.mouseOut("id=field-label-right_label");
144 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for field help - label right\")"));
145
146
147 selenium.mouseOver("id=field-label-top_label");
148 assertTrue(selenium.isVisible("css=td:contains(\"Sample text for field help - label top\")"));
149 selenium.mouseOut("id=field-label-top_label");
150 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for field help - label top\")"));
151
152
153 assertFalse(selenium.isElementPresent("id=standalone-help-not-rendered"));
154
155
156 selenium.mouseOver("id=override-tooltip_label");
157 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\")"));
158 if (selenium.isElementPresent("css=td:contains(\"Sample text for label tooltip - this will not be rendered as it is overridden by the help tooltip\")")) {
159 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for label tooltip - this will not be rendered as it is overridden by the help tooltip\")"));
160 }
161 selenium.mouseOut("id=override-tooltip_label");
162 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\")"));
163
164
165 selenium.mouseOver("id=on-focus-tooltip_control");
166 assertTrue(selenium.isVisible("css=td:contains(\"Sample text for on-focus event tooltip\")"));
167 selenium.mouseOver("id=on-focus-tooltip_label");
168 assertTrue(selenium.isVisible("css=td:contains(\"Sample text for field help - there is also an on-focus tooltip\")"));
169 selenium.mouseOut("id=on-focus-tooltip_control");
170 selenium.mouseOut("id=on-focus-tooltip_label");
171 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for field help - there is also an on-focus tooltip\")"));
172 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for on-focus event tooltip\")"));
173
174
175 selenium.mouseOver("id=checkbox_label");
176 assertTrue(selenium.isVisible("css=td:contains(\"Sample text for check box help\")"));
177 selenium.mouseOut("id=checkbox_label");
178 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for check box help\")"));
179 }
180
181
182
183
184 @Test
185 public void testDisplayOnlyTooltipHelp() throws Exception {
186
187 if (selenium.isElementPresent("css=td:contains(\"Sample text for sub-section help\")")) {
188 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for sub-section help\")"));
189 }
190 if (selenium.isElementPresent("css=td:contains(\"Sample text for read only field help\")")) {
191 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for read only field help\")"));
192 }
193
194
195 selenium.mouseOver("css=h4 .uif-headerText-span");
196 assertTrue(selenium.isVisible("css=td:contains(\"Sample text for sub-section help\")"));
197 selenium.mouseOut("css=h4 .uif-headerText-span");
198 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for sub-section help\")"));
199
200
201 selenium.mouseOver("css=#display-field label");
202 assertTrue(selenium.isVisible("css=td:contains(\"Sample text for read only field help\")"));
203 selenium.mouseOut("css=#display-field label");
204 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for read only field help\")"));
205 }
206
207
208
209
210 @Test
211 public void testMissingTooltipHelp() throws Exception {
212
213 assertFalse(selenium.isElementPresent("css=.jquerybubblepopup"));
214
215
216 assertFalse(selenium.isElementPresent("css=#ConfigurationTestView-Help-Section2 input.uif-helpImage"));
217
218
219 selenium.mouseOver("css=#ConfigurationTestView-Help-Section2 h3 .uif-headerText-span");
220 assertFalse(selenium.isElementPresent("css=.jquerybubblepopup"));
221 selenium.mouseOut("css=#ConfigurationTestView-Help-Section1 h3 .uif-headerText-span");
222 assertFalse(selenium.isElementPresent("css=.jquerybubblepopup"));
223
224
225 selenium.mouseOver("id=missing-tooltip-help_label");
226 assertFalse(selenium.isElementPresent("css=.jquerybubblepopup"));
227 selenium.mouseOut("id=missing-tooltip-help_label");
228 assertFalse(selenium.isElementPresent("css=.jquerybubblepopup"));
229 }
230
231
232
233
234
235
236
237
238
239 @Ignore
240 @Test
241 public void testExternalHelp() throws Exception {
242
243
244 selenium.click("css=input[title=\"Help for External Help\"]");
245 selenium.waitForPopUp("HelpWindow", "30000");
246 selenium.selectPopUp("HelpWindow");
247 assertEquals("http://www.kuali.org/?section", selenium.getLocation());
248 selenium.deselectPopUp();
249
250
251 selenium.click("css=#field-label-left-external-help .uif-helpImage");
252 selenium.waitForPopUp("HelpWindow", "30000");
253 Thread.sleep(HELP_WINDOW_LOAD_DELAY);
254 selenium.selectPopUp("HelpWindow");
255 assertEquals("http://www.kuali.org/?label_left", selenium.getLocation());
256 selenium.deselectPopUp();
257
258
259 selenium.click("css=#field-label-right-external-help .uif-helpImage");
260 selenium.waitForPopUp("HelpWindow", "30000");
261 Thread.sleep(HELP_WINDOW_LOAD_DELAY);
262 selenium.selectPopUp("HelpWindow");
263 assertEquals("http://www.kuali.org/?label_right", selenium.getLocation());
264 selenium.deselectPopUp();
265
266
267
268
269
270
271
272
273
274
275
276 selenium.click("css=#standalone-external-help .uif-helpImage");
277 selenium.waitForPopUp("HelpWindow", "30000");
278 Thread.sleep(HELP_WINDOW_LOAD_DELAY);
279 selenium.selectPopUp("HelpWindow");
280 assertEquals("http://www.kuali.org/?label_top", selenium.getLocation());
281 selenium.deselectPopUp();
282 }
283
284
285
286
287 @Ignore
288 @Test
289 public void testDisplayOnlyExternalHelp() throws Exception {
290
291 }
292
293
294
295
296 @Ignore
297 @Test
298 public void testMissingExternalHelp() throws Exception {
299
300 }
301
302
303
304
305 @Ignore
306 @Test
307 public void testTooltipExternalHelp() throws Exception {
308
309 }
310
311 @After
312 public void tearDown() throws Exception {
313 selenium.stop();
314 }
315
316 }