1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.demo.uif.library.clientresponsiveness;
17
18 import org.junit.Test;
19 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
20
21
22
23
24 public class LibraryClientResponsivenessProgressiveDisclosureAft extends WebDriverLegacyITBase {
25
26
27
28
29 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-ProgressiveDisclosureView&methodToCall=start";
30
31 @Override
32 protected String getBookmarkUrl() {
33 return BOOKMARK_URL;
34 }
35
36
37
38
39 private static final String CWGR_GENERIC_XPATH= "//div[@data-parent='Demo-ProgressiveDisclosure-Example9']/div[@data-role='disclosureContent']";
40
41 @Override
42 protected void navigate() throws Exception {
43 waitAndClickLibraryLink();
44 waitAndClickByLinkText("Client Responsiveness");
45 waitAndClickByLinkText("Progressive Disclosure");
46 }
47
48 protected void testClientResponsivenessProgressiveDisclosure() throws Exception {
49
50 waitAndClickByLinkText("Default");
51 assertIsNotVisibleByXpath("//input[@name='inputField1']", "Is Visible");
52 waitAndClickByName("booleanField1");
53 waitIsVisibleByXpath("//input[@name='inputField1']","Not Visible");
54 waitAndClickByName("booleanField1");
55 assertIsNotVisibleByXpath("//input[@name='inputField1']", "Is Visible");
56 jiraAwareTypeByName("inputField2", "show");
57 waitForElementPresentByXpath("//input[@name='inputField3' and @disabled]");
58 waitAndClickByLinkText("Documentation");
59 waitForElementPresentByXpath("//input[@name='inputField3']");
60 }
61
62 protected void testClientResponsivenessProgressiveDisclosureAjaxRetrieval() throws Exception {
63 waitAndClickByLinkText("Ajax Retrieval");
64 checkForIncidentReport("LibraryClientResponsivenessProgressiveDisclosureAft Ajax Retrieval");
65 assertIsNotVisibleByXpath("//input[@name='inputField18']", "element");
66 waitAndClickByName("booleanField2");
67 waitIsVisibleByXpath("//input[@name='inputField18']", "element");
68 }
69
70 protected void testClientResponsivenessProgressiveDisclosureRefreshWhenShown() throws Exception {
71 waitAndClickByLinkText("Refresh when Shown");
72 assertIsNotVisibleByXpath("//input[@name='inputField5']", "element");
73 waitAndClickByName("booleanField3");
74 waitIsVisibleByXpath("//input[@name='inputField5']", "element");
75 }
76
77 protected void testClientResponsivenessProgressiveDisclosureShowFieldThroughMatching() throws Exception {
78 waitAndClickByLinkText("Show Field Through Matching");
79
80
81 waitAndTypeByName("inputField6","A");
82 waitAndClickByLinkText("Documentation");
83 waitForElementPresentByXpath("//input[@name='inputField7']");
84 waitAndTypeByName("inputField6","B");
85 waitAndClickByLinkText("Documentation");
86 waitForElementPresentByXpath("//input[@name='inputField8']");
87 }
88
89 protected void testClientResponsivenessProgressiveDisclosureOfGroup() throws Exception {
90 waitAndClickByLinkText("Progressive Disclosure of Groups");
91 waitForElementPresentByXpath("//input[@name='inputField10' and @disabled]");
92 waitForElementPresentByXpath("//input[@name='inputField11' and @disabled]");
93 waitForElementPresentByXpath("//input[@name='inputField12' and @disabled]");
94 waitAndClickByXpath("//input[@name='inputField9' and @value='show1']");
95 waitForElementPresentByXpath("//input[@name='inputField10']");
96 waitForElementPresentByXpath("//input[@name='inputField11']");
97 waitForElementPresentByXpath("//input[@name='inputField12']");
98 waitAndClickByXpath("//input[@name='inputField9' and @value='show2']");
99 waitForProgressLoading();
100 waitForElementPresentByXpath("//input[@name='inputField13']");
101 waitForElementPresentByXpath("//input[@name='inputField14']");
102 }
103
104 protected void testClientResponsivenessProgressiveDisclosureConditionalRefresh() throws Exception {
105 waitAndClickByXpath("//li[@data-tabfor='Demo-ProgressiveDisclosure-Example6']/a[contains(text(),'Conditional Refresh')]");
106 waitAndClickByXpath("//input[@name='inputField15' and @value='show1']");
107 waitForProgressLoading();
108 waitAndTypeByName("inputField16","Hello World!");
109 waitAndTypeByName("inputField17","Hello Deep!");
110 waitAndClickByXpath("//input[@name='inputField15' and @value='show2']");
111 waitForProgressLoading();
112 waitForTextPresent("Hello Deep!");
113 }
114
115 protected void testClientResponsivenessProgressiveDisclosureConditionalOptions() throws Exception {
116 waitAndClickByLinkText("Conditional Options");
117 selectByName("inputField19","Apples");
118 waitAndClickButtonByText("Refresh Group");
119 waitForProgressLoading(15);
120 selectByName("inputField4","Vegetables");
121
122 waitAndClickButtonByText("Refresh Field");
123 waitForProgressLoading(15);
124 waitAndClickButtonByText("Refresh Field but with Server Errors");
125 waitForTextPresent("Field 1: This field caused a server test error");
126 waitAndClickButtonByText("Refresh Page");
127 waitForProgressLoading(60);
128 waitForTextNotPresent("Field 1: This field caused a server test error");
129 }
130
131 protected void testClientResponsivenessProgressiveDisclosureRefreshBasedOnTimer() throws Exception {
132 waitAndClickByLinkText("Refresh Based on Timer");
133
134 checkForIncidentReport();
135 }
136
137 protected void testClientResponsivenessProgressiveDisclosureCollectionWithGroupRefresh() throws Exception {
138 waitAndClickByLinkText("Collection Group With Refresh");
139 acceptAlertIfPresent();
140 waitAndTypeByName("newCollectionLines['collection1'].field2", "ref");
141 fireEvent("focus", "collection1[0].field1");
142 waitForProgressLoading();
143
144 checkForIncidentReport();
145 }
146
147 protected void testClientResponsivenessProgressiveDisclosureFieldWithCheckBoxFieldset() throws Exception {
148 waitAndClickByLinkText("Field Within a Checkbox Field Set");
149 waitForElementPresentByXpath("//input[@name='inputField21' and @disabled]");
150 waitAndClickByXpath("//input[@name='checkboxesField1' and @value='1']");
151 waitForElementPresentByXpath("//input[@name='inputField21']");
152 checkForIncidentReport();
153 }
154
155 protected void testClientResponsivenessProgressiveDisclosureFieldWithRadioFieldset() throws Exception {
156 waitAndClickByLinkText("Field Within a Radio Field Set");
157 waitForElementPresentByXpath("//input[@name='inputField23' and @disabled]");
158 waitAndClickByXpath("//input[@name='checkboxesField2' and @value='X']");
159 waitForElementPresentByXpath("//input[@name='inputField23']");
160 checkForIncidentReport();
161 }
162
163 @Test
164 public void testClientResponsivenessProgressiveDisclosureBookmark() throws Exception {
165 testClientResponsivenessProgressiveDisclosureAll();
166 passed();
167 }
168
169 @Test
170 public void testClientResponsivenessProgressiveDisclosureNav() throws Exception {
171 testClientResponsivenessProgressiveDisclosureAll();
172 passed();
173 }
174
175 @Test
176 public void testClientResponsivenessProgressiveDisclosureConditionalOptionsBookmark() throws Exception {
177 testClientResponsivenessProgressiveDisclosureConditionalOptions();
178 passed();
179 }
180
181 @Test
182 public void testClientResponsivenessProgressiveDisclosureConditionalOptionsNav() throws Exception {
183 testClientResponsivenessProgressiveDisclosureConditionalOptions();
184 passed();
185 }
186
187 @Test
188 public void testClientResponsivenessProgressiveDisclosureCollectionWithGroupRefreshBookmark() throws Exception {
189 testClientResponsivenessProgressiveDisclosureCollectionWithGroupRefresh();
190 passed();
191 }
192
193 @Test
194 public void testClientResponsivenessProgressiveDisclosureCollectionWithGroupRefreshNav() throws Exception {
195 testClientResponsivenessProgressiveDisclosureCollectionWithGroupRefresh();
196 passed();
197 }
198
199 @Test
200 public void testClientResponsivenessProgressiveDisclosureConditionalRefreshBookmark() throws Exception {
201 testClientResponsivenessProgressiveDisclosureConditionalRefresh();
202 passed();
203 }
204
205 @Test
206 public void testClientResponsivenessProgressiveDisclosureConditionalRefreshNav() throws Exception {
207 testClientResponsivenessProgressiveDisclosureConditionalRefresh();
208 passed();
209 }
210
211 private void testClientResponsivenessProgressiveDisclosureAll() throws Exception {
212 testClientResponsivenessProgressiveDisclosure();
213 testClientResponsivenessProgressiveDisclosureAjaxRetrieval();
214 testClientResponsivenessProgressiveDisclosureRefreshWhenShown();
215 testClientResponsivenessProgressiveDisclosureOfGroup();
216 testClientResponsivenessProgressiveDisclosureRefreshBasedOnTimer();
217 testClientResponsivenessProgressiveDisclosureShowFieldThroughMatching();
218
219
220
221 testClientResponsivenessProgressiveDisclosureFieldWithCheckBoxFieldset();
222 testClientResponsivenessProgressiveDisclosureFieldWithRadioFieldset();
223 }
224 }