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
34
35
36
37
38
39 public class HelpIT {
40 private Selenium selenium;
41
42
43
44 private long HELP_WINDOW_LOAD_DELAY = 3000;
45
46 @Before
47 public void setUp() throws Exception {
48 System.setProperty("remote.public.url", "http://localhost:8080/kr-dev/kr-krad/configuration-test-view-uif-controller?viewId=ConfigurationTestView-Help&methodToCall=start");
49 selenium = new DefaultSelenium("localhost", 4444, "*firefox", System.getProperty("remote.public.url"));
50 selenium.start();
51
52
53 selenium.open(System.getProperty("remote.public.url"));
54 assertEquals("Login", selenium.getTitle());
55 selenium.type("__login_user", "admin");
56 selenium.click("//input[@value='Login']");
57 selenium.waitForPageToLoad("30000");
58 }
59
60
61
62
63 @Test
64 public void testViewHelp() throws Exception {
65
66 selenium.mouseOver("css=h1 .uif-headerText-span");
67 assertEquals("Sample text for view help", selenium.getText("css=td.jquerybubblepopup-innerHtml"));
68
69
70 selenium.click("css=input[title=\"Help for Configuration Test View - Help\"]");
71 selenium.waitForPopUp("HelpWindow", "30000");
72 selenium.selectPopUp("HelpWindow");
73 assertEquals("http://www.kuali.org/?view", selenium.getLocation());
74 selenium.deselectPopUp();
75 }
76
77
78
79
80 @Test
81 public void testPageHelp() throws Exception {
82
83 selenium.mouseOver("css=h2 .uif-headerText-span");
84 assertEquals("Sample text for page help", selenium.getText("css=td.jquerybubblepopup-innerHtml"));
85
86
87 selenium.click("css=input[title=\"Help for Help Page\"]");
88 selenium.waitForPopUp("HelpWindow", "30000");
89 selenium.selectPopUp("HelpWindow");
90 assertEquals("http://www.kuali.org/?page", selenium.getLocation());
91 selenium.deselectPopUp();
92 }
93
94
95
96
97 @Test
98 public void testTooltipHelp() throws Exception {
99
100 if (selenium.isElementPresent("css=td:contains(\"Sample text for section help - tooltip help\")")) {
101 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for section help - tooltip help\")"));
102 }
103 if (selenium.isElementPresent("css=td:contains(\"Sample text for field help - label left\")")) {
104 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for field help - label left\")"));
105 }
106 if (selenium.isElementPresent("css=td:contains(\"Sample text for field help - label right\")")) {
107 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for field help - label right\")"));
108 }
109 if (selenium.isElementPresent("css=td:contains(\"Sample text for field help - label top\")")) {
110 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for field help - label top\")"));
111 }
112 if (selenium.isElementPresent("css=td:contains(\"Sample text for standalone help widget tooltip which will never be rendered\")")) {
113 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for standalone help widget tooltip which will never be rendered\")"));
114 }
115 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\")")) {
116 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\")"));
117 }
118 if (selenium.isElementPresent("css=td:contains(\"Sample text for label tooltip - this will not be rendered as it is overridden by the help tooltip\")")) {
119 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for label tooltip - this will not be rendered as it is overridden by the help tooltip\")"));
120 }
121 if (selenium.isElementPresent("css=td:contains(\"Sample text for field help - there is also an on-focus tooltip\")")) {
122 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for field help - there is also an on-focus tooltip\")"));
123 }
124 if (selenium.isElementPresent("css=td:contains(\"Sample text for on-focus event tooltip\")")) {
125 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for on-focus event tooltip\")"));
126 }
127 if (selenium.isElementPresent("css=td:contains(\"Sample text for check box help\")")) {
128 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for check box help\")"));
129 }
130
131
132 selenium.mouseOver("css=#ConfigurationTestView-Help-Section1 h3 .uif-headerText-span");
133 assertTrue(selenium.isVisible("css=td:contains(\"Sample text for section help - tooltip help\")"));
134 selenium.mouseOut("css=#ConfigurationTestView-Help-Section1 h3 .uif-headerText-span");
135 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for section help - tooltip help\")"));
136
137
138 assertFalse(selenium.isElementPresent("css=#ConfigurationTestView-Help-Section1 input.uif-helpImage"));
139
140
141 selenium.mouseOver("id=field-label-left_label");
142 assertTrue(selenium.isVisible("css=td:contains(\"Sample text for field help - label left\")"));
143 selenium.mouseOut("id=field-label-left_label");
144 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for field help - label left\")"));
145
146
147 selenium.mouseOver("id=field-label-right_label");
148 assertTrue(selenium.isVisible("css=td:contains(\"Sample text for field help - label righ\")"));
149 selenium.mouseOut("id=field-label-right_label");
150 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for field help - label right\")"));
151
152
153 selenium.mouseOver("id=field-label-top_label");
154 assertTrue(selenium.isVisible("css=td:contains(\"Sample text for field help - label top\")"));
155 selenium.mouseOut("id=field-label-top_label");
156 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for field help - label top\")"));
157
158
159 assertFalse(selenium.isElementPresent("id=standalone-help-not-rendered"));
160
161
162 selenium.mouseOver("id=override-tooltip_label");
163 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\")"));
164 if (selenium.isElementPresent("css=td:contains(\"Sample text for label tooltip - this will not be rendered as it is overridden by the help tooltip\")")) {
165 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for label tooltip - this will not be rendered as it is overridden by the help tooltip\")"));
166 }
167 selenium.mouseOut("id=override-tooltip_label");
168 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\")"));
169
170
171 selenium.mouseOver("id=on-focus-tooltip_control");
172 assertTrue(selenium.isVisible("css=td:contains(\"Sample text for on-focus event tooltip\")"));
173 selenium.mouseOver("id=on-focus-tooltip_label");
174 assertTrue(selenium.isVisible("css=td:contains(\"Sample text for field help - there is also an on-focus tooltip\")"));
175 selenium.mouseOut("id=on-focus-tooltip_control");
176 selenium.mouseOut("id=on-focus-tooltip_label");
177 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for field help - there is also an on-focus tooltip\")"));
178 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for on-focus event tooltip\")"));
179
180
181 selenium.mouseOver("id=checkbox_label");
182 assertTrue(selenium.isVisible("css=td:contains(\"Sample text for check box help\")"));
183 selenium.mouseOut("id=checkbox_label");
184 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for check box help\")"));
185 }
186
187
188
189
190 @Test
191 public void testDisplayOnlyTooltipHelp() throws Exception {
192
193 if (selenium.isElementPresent("css=td:contains(\"Sample text for sub-section help\")")) {
194 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for sub-section help\")"));
195 }
196 if (selenium.isElementPresent("css=td:contains(\"Sample text for read only field help\")")) {
197 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for read only field help\")"));
198 }
199
200
201 selenium.mouseOver("css=h4 .uif-headerText-span");
202 assertTrue(selenium.isVisible("css=td:contains(\"Sample text for sub-section help\")"));
203 selenium.mouseOut("css=h4 .uif-headerText-span");
204 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for sub-section help\")"));
205
206
207 selenium.mouseOver("css=#display-field label");
208 assertTrue(selenium.isVisible("css=td:contains(\"Sample text for read only field help\")"));
209 selenium.mouseOut("css=#display-field label");
210 assertFalse(selenium.isVisible("css=td:contains(\"Sample text for read only field help\")"));
211 }
212
213
214
215
216 @Test
217 public void testMissingTooltipHelp() throws Exception {
218
219 assertFalse(selenium.isElementPresent("css=.jquerybubblepopup"));
220
221
222 assertFalse(selenium.isElementPresent("css=#ConfigurationTestView-Help-Section2 input.uif-helpImage"));
223
224
225 selenium.mouseOver("css=#ConfigurationTestView-Help-Section2 h3 .uif-headerText-span");
226 assertFalse(selenium.isElementPresent("css=.jquerybubblepopup"));
227 selenium.mouseOut("css=#ConfigurationTestView-Help-Section1 h3 .uif-headerText-span");
228 assertFalse(selenium.isElementPresent("css=.jquerybubblepopup"));
229
230
231 selenium.mouseOver("id=missing-tooltip-help_label");
232 assertFalse(selenium.isElementPresent("css=.jquerybubblepopup"));
233 selenium.mouseOut("id=missing-tooltip-help_label");
234 assertFalse(selenium.isElementPresent("css=.jquerybubblepopup"));
235 }
236
237 @After
238 public void tearDown() throws Exception {
239 selenium.stop();
240 }
241
242 }