1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.sampleu.krad.configview;
17
18 import org.kuali.rice.testtools.common.JiraAwareFailable;
19 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
20
21
22
23
24 public abstract class HelpAftBase extends WebDriverLegacyITBase {
25
26
27
28
29 public static final String BOOKMARK_URL = "/kr-krad/configuration-test-view-uif-controller?viewId=ConfigurationTestView&methodToCall=start&pageId=ConfigurationTestView-Help-Page";
30
31 @Override
32 protected String getBookmarkUrl() {
33 return BOOKMARK_URL;
34 }
35
36 protected void navigation() throws Exception {
37 waitAndClickKRAD();
38 waitAndClickByXpath(CONFIGURATION_VIEW_XPATH);
39 switchToWindow(CONFIGURATION_VIEW_WINDOW_TITLE);
40 waitAndClickByLinkText("Help");
41 Thread.sleep(5000);
42 }
43
44 protected void testHelpNav(JiraAwareFailable failable) throws Exception {
45 navigation();
46 testViewHelp();
47 testPageHelp();
48 testTooltipHelp();
49 testDisplayOnlyTooltipHelp();
50 testMissingTooltipHelp();
51 passed();
52 }
53
54 protected void testHelpBookmark(JiraAwareFailable failable) throws Exception {
55 testViewHelp();
56 testPageHelp();
57 testTooltipHelp();
58 testDisplayOnlyTooltipHelp();
59 testMissingTooltipHelp();
60 passed();
61 }
62
63
64
65
66
67 protected void testPageHelp() throws Exception {
68
69 fireMouseOverEventByXpath("//a/span[@class='uif-headerText-span']");
70 waitForTextPresent("Sample text for section help - tooltip help");
71
72
73 waitAndClickByXpath("//input[@alt='Help for Configuration Test View']");
74 Thread.sleep(5000);
75 switchToWindow("Kuali Foundation");
76 Thread.sleep(5000);
77 switchToWindow(CONFIGURATION_VIEW_WINDOW_TITLE);
78 }
79
80
81
82
83 protected void testTooltipHelp() throws Exception {
84
85 if (isElementPresentByXpath("//td[contains(text(),'Sample text for section help - tooltip help')]")) {
86 assertFalse(isVisibleByXpath("//td[contains(text(),'Sample text for section help - tooltip help')]"));
87 }
88
89 if (isElementPresentByXpath("//td[contains(text(),'Sample text for field help - label left')]")) {
90 assertFalse(isVisibleByXpath("//td[contains(text(),'Sample text for field help - label left')]"));
91 }
92
93 if (isElementPresentByXpath("//td[contains(text(),'Sample text for field help - label right')]")) {
94 assertFalse(isVisibleByXpath("//td[contains(text(),'Sample text for field help - label right')]"));
95 }
96
97 if (isElementPresentByXpath("//td[contains(text(),'Sample text for field help - label top')]")) {
98 assertFalse(isVisibleByXpath("//td[contains(text(),'Sample text for field help - label top')]"));
99 }
100
101 if (isElementPresentByXpath("//td[contains(text(),'Sample text for standalone help widget tooltip which will never be rendered')]")) {
102 assertFalse(isVisibleByXpath("//td[contains(text(),'Sample text for standalone help widget tooltip which will never be rendered')]"));
103 }
104
105 if (isElementPresentByXpath("//td[contains(text(),'Sample text for field help - there is also a tooltip on the label but it is overridden by the help tooltip')]")) {
106 assertFalse(isVisibleByXpath("//td[contains(text(),'Sample text for field help - there is also a tooltip on the label but it is overridden by the help tooltip')]"));
107 }
108
109 if (isElementPresentByXpath("//td[contains(text(),'Sample text for label tooltip - this will not be rendered as it is overridden by the help tooltip')]")) {
110 assertFalse(isVisibleByXpath("//td[contains(text(),'Sample text for label tooltip - this will not be rendered as it is overridden by the help tooltip')]"));
111 }
112
113 if (isElementPresentByXpath("//td[contains(text(),'Sample text for field help - there is also an on-focus tooltip')]")) {
114 assertFalse(isVisibleByXpath("//td[contains(text(),'Sample text for field help - there is also an on-focus tooltip')]"));
115 }
116
117 if (isElementPresentByXpath("//td[contains(text(),'Sample text for on-focus event tooltip')]")) {
118 assertFalse(isVisibleByXpath("//td[contains(text(),'Sample text for on-focus event tooltip')]"));
119 }
120
121 if (isElementPresentByXpath("//td[contains(text(),'Sample text for check box help')]")) {
122 assertFalse(isVisibleByXpath("//td[contains(text(),'Sample text for check box help')]"));
123 }
124
125
126 fireMouseOverEventByXpath("//section[@id='ConfigurationTestView-Help-Section1']/header/h3[@class='uif-headerText']");
127 Thread.sleep(500);
128 assertTrue(isVisibleByXpath("//td[contains(text(),'Sample text for section help - tooltip help')]"));
129
130
131 assertFalse(isElementPresent("#ConfigurationTestView-Help-Section1 input.uif-helpImage"));
132
133
134 fireMouseOverEventByXpath("//label[@id='field-label-left_label']");
135 Thread.sleep(3000);
136 assertTrue(isVisibleByXpath("//td[contains(text(),'Sample text for field help - label left')]"));
137
138
139 fireMouseOverEventByXpath("//label[@id='field-label-right_label']");
140 Thread.sleep(3000);
141 assertTrue(isVisibleByXpath("//td[contains(text(),'Sample text for field help - label right')]"));
142
143
144 fireMouseOverEventByXpath("//label[@id='field-label-top_label']");
145 Thread.sleep(3000);
146 assertTrue(isVisibleByXpath("//td[contains(text(),'Sample text for field help - label top')]"));
147
148
149 assertFalse(isElementPresentByXpath("//*[@id='standalone-help-not-rendered']"));
150
151
152 fireMouseOverEventByXpath("//label[@id='override-tooltip_label']");
153 Thread.sleep(3000);
154 assertTrue(isVisibleByXpath("//td[contains(text(),'Sample text for field help - there is also a tooltip on the label but it is overridden by the help tooltip')]"));
155 if (isElementPresentByXpath("//td[contains(text(),'Sample text for label tooltip - this will not be rendered as it is overridden by the help tooltip')]")) {
156 assertFalse(isVisibleByXpath("//td[contains(text(),'Sample text for label tooltip - this will not be rendered as it is overridden by the help tooltip')]"));
157 }
158
159
160 fireMouseOverEventByXpath("//input[@id='on-focus-tooltip_control']");
161 assertTrue(isVisibleByXpath("//td[contains(text(),'Sample text for on-focus event tooltip')]"));
162 fireMouseOverEventByXpath("//label[@id='on-focus-tooltip_label']");
163 assertTrue(isVisibleByXpath("//td[contains(text(),'Sample text for field help - there is also an on-focus tooltip')]"));
164
165
166 fireMouseOverEventByXpath("//label[@id='checkbox_label']");
167 assertTrue(isVisibleByXpath("//td[contains(text(),'Sample text for check box help')]"));
168 }
169
170
171
172
173 protected void testDisplayOnlyTooltipHelp() throws Exception {
174
175
176 fireMouseOverEventByXpath("//section[@data-parent='ConfigurationTestView-Help-Section1']/header/h4");
177 waitForElementPresentByXpath("//td[contains(text(),'Sample text for sub-section help')]");
178
179
180 fireMouseOverEventByXpath("//label[@for='display-field_control']");
181 waitForElementPresentByXpath("//td[contains(text(),'Sample text for read only field help')]");
182 }
183
184
185
186
187 protected void testMissingTooltipHelp() throws Exception {
188
189
190 fireMouseOverEventByXpath("//section[@id='ConfigurationTestView-Help-Section2']/div");
191 assertFalse(isElementPresentByXpath("//div[@class='jquerybubblepopup jquerybubblepopup-black' and @style='opacity: 0; top: 627px; left: 2px; position: absolute; display: block;']"));
192
193
194 fireMouseOverEventByXpath("//label[@id='missing-tooltip-help_label']");
195 assertFalse(isElementPresentByXpath("//div[@class='jquerybubblepopup jquerybubblepopup-black' and @style='opacity: 0; top: 627px; left: 2px; position: absolute; display: block;']"));
196 }
197
198
199
200
201 protected void testViewHelp() throws Exception {
202
203 fireEvent("field102", "blur");
204 fireMouseOverEventByXpath("//label[@id='field-label-left_label']");
205 waitForTextPresent("Sample text for field help - label left");
206
207
208 waitAndClickByXpath("//input[@alt='Help for Configuration Test View']");
209 Thread.sleep(5000);
210 switchToWindow("Kuali Foundation");
211 Thread.sleep(5000);
212 switchToWindow(CONFIGURATION_VIEW_WINDOW_TITLE);
213 }
214 }