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