1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.demo.uif.library.collections;
17
18 import org.junit.Test;
19
20 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
21 import org.kuali.rice.testtools.selenium.WebDriverUtils;
22 import org.openqa.selenium.By;
23
24
25
26
27 public class LibraryCollectionFeaturesAddLineAft extends WebDriverLegacyITBase {
28
29
30
31
32 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-CollectionAddLineView";
33
34 @Override
35 protected String getBookmarkUrl() {
36 return BOOKMARK_URL;
37 }
38
39 @Override
40 protected void navigate() throws Exception {
41 waitAndClickLibraryLink();
42 waitAndClickByLinkText("Collection Features");
43 waitAndClickByLinkText("Add Line");
44 }
45
46 protected void testCollectionFeaturesAddLine() throws Exception {
47 selectByName("exampleShown", "Collection Default Add Line");
48
49
50 waitAndTypeByName("newCollectionLines['collection1'].field1", "12");
51 waitAndTypeByName("newCollectionLines['collection1'].field2", "5");
52 jGrowl("Click Add button.");
53 waitAndClickByXpath("//section[@id = 'Demo-CollectionAddLine-Example1']//button[contains(text(), 'Add')]");
54
55
56 waitForElementPresent("input[name = 'collection1[0].field1'][value = '12']");
57 waitForElementPresent("input[name = 'collection1[0].field2'][value = '5']");
58 }
59
60 protected void testCollectionFeaturesAddLineWithDuplicatePropertyName() throws Exception {
61 selectByName("exampleShown", "Collection Add Line with duplicateLinePropertyNames");
62
63
64 waitAndTypeByName("newCollectionLines['collection1_2'].field1", "13");
65 waitAndTypeByName("newCollectionLines['collection1_2'].field2", "14");
66 jGrowl("Click Add button.");
67 waitAndClickByXpath("//section[@id = 'Demo-CollectionAddLine-Example2']//button[contains(text(), 'Add')]");
68
69
70 waitForProgressAddingLine(WebDriverUtils.configuredImplicityWait() * 3);
71 waitForTextPresent("Duplicate Default Add Line with duplicateLinePropertyNames property configured");
72 }
73
74 protected void testCollectionFeaturesAddLineWithDialog() throws Exception {
75 selectByName("exampleShown", "Collection Add Line with Dialog");
76
77
78 jGrowl("Click Add Line button.");
79 waitAndClickByXpath("//section[@id = 'Demo-CollectionAddLine-Example3']//button[contains(text(), 'Add Line')]");
80
81
82 waitForElementPresentByName("newCollectionLines['collection1_3'].field1");
83 jGrowl("Click Add button.");
84 waitAndClickByXpath("//div[@id = 'Uif-Dialogs']//button[contains(text(), 'Add')]");
85
86
87 waitIsVisible("div[data-label = 'Field 1'] li[class = 'uif-errorMessageItem-field']");
88
89
90 waitAndTypeByName("newCollectionLines['collection1_3'].field1", "42");
91 waitAndTypeByName("newCollectionLines['collection1_3'].field2", "55");
92 jGrowl("Click Add button.");
93 waitAndClickByXpath("//div[@id = 'Uif-Dialogs']//button[contains(text(), 'Add')]");
94
95
96 waitForProgressAddingLine(WebDriverUtils.configuredImplicityWait() * 3);
97 assertEquals("42", waitForElementVisibleBy(By.name("collection1_3[0].field1")).getAttribute("value"));
98 assertEquals("55", waitForElementVisibleBy(By.name("collection1_3[0].field2")).getAttribute("value"));
99 }
100
101 protected void testCollectionFeaturesAddBlankLine() throws Exception {
102 selectByName("exampleShown", "Collection Add Blank Line");
103
104
105 jGrowl("Click Add Line button.");
106 waitAndClickByXpath("//section[@id = 'Demo-CollectionAddLine-Example4']//button[contains(text(), 'Add Line')]");
107
108
109 waitForElementPresent("input[name = 'collection1_7[0].field1'][value = '']");
110 waitForElementPresent("input[name = 'collection1_7[0].field2'][value = '']");
111 }
112
113 protected void testCollectionFeaturesAddLineWithCustomActions() throws Exception {
114 selectByName("exampleShown", "Collection Add Line with Custom Actions");
115
116
117 waitAndTypeByName("newCollectionLines['collection1_8'].field1", "999");
118 waitAndTypeByName("newCollectionLines['collection1_8'].field2", "998");
119 jGrowl("Click Add button.");
120 waitAndClickByXpath("//section[@data-parent='Demo-CollectionAddLine-Example5']//button[contains(text(),'Add')]");
121
122
123 waitForProgressAddingLine(WebDriverUtils.configuredImplicityWait() * 3);
124 assertEquals("999", waitForElementVisibleBy(By.name("collection1_8[0].field1")).getAttribute("value"));
125 assertEquals("998", waitForElementVisibleBy(By.name("collection1_8[0].field2")).getAttribute("value"));
126
127
128 jGrowl("Click Trash button.");
129 waitAndClick("#Demo-CollectionAddLine-Example5 button.icon-trash");
130 waitForProgressDeletingLine();
131
132
133 assertFalse("999".equals(waitForElementVisibleBy(By.name("collection1_8[0].field1")).getAttribute("value")));
134 assertFalse("998".equals(waitForElementVisibleBy(By.name("collection1_8[0].field2")).getAttribute("value")));
135 waitForTextPresent("You have deleted an item from Project Income.");
136 }
137
138 protected void testCollectionFeaturesAddLineWithDialogAndCustomActions() throws Exception {
139 selectByName("exampleShown", "Collection Add Line with Dialog and Custom Actions");
140
141
142 waitAndClickByXpath("//section[@id = 'Demo-CollectionAddLine-Example6']//button/text()[contains(., 'Add Income')]/..");
143 waitAndTypeByName("newCollectionLines['collection1_9'].field1", "999");
144 waitAndTypeByName("newCollectionLines['collection1_9'].field2", "999");
145 waitAndClickByXpath("//section[@id = 'Demo-CollectionAddLine-Example6-AddLineDialog']//button[contains(text(),'Cancel')]");
146
147
148 waitForElementNotPresent(By.cssSelector("input[name = 'collection1_9[0].field1'][value = '999']"));
149 waitForElementNotPresent(By.cssSelector("input[name = 'collection1_9[0].field2'][value = '999']"));
150
151
152 waitAndClickByXpath("//section[@id = 'Demo-CollectionAddLine-Example6']//button/text()[contains(., 'Add Income')]/..");
153 waitForElementPresentByName("newCollectionLines['collection1_9'].field1");
154 clearTextByName("newCollectionLines['collection1_9'].field1");
155 waitAndTypeByName("newCollectionLines['collection1_9'].field1", "9996");
156 waitForElementPresentByName("newCollectionLines['collection1_9'].field2");
157 clearTextByName("newCollectionLines['collection1_9'].field2");
158 waitAndTypeByName("newCollectionLines['collection1_9'].field2", "9996");
159 jGrowl("Click Add Income button.");
160 waitAndClickByXpath("//section[@id = 'Demo-CollectionAddLine-Example6-AddLineDialog']//button[contains(text(), 'Add Income')]");
161 waitForProgressAddingLine(WebDriverUtils.configuredImplicityWait() * 3);
162
163
164 waitForElementVisibleBy(By.cssSelector("input[name = 'collection1_9[0].field1'][value = '9996']"));
165 waitForElementVisibleBy(By.cssSelector("input[name = 'collection1_9[0].field2'][value = '9996']"));
166
167
168 jGrowl("Click Trash button.");
169 waitAndClickByXpath("//section[@id = 'Demo-CollectionAddLine-Example6']//button[contains(@class,'icon-trash')]");
170 waitForProgressDeletingLine();
171
172
173 waitForElementNotPresent(By.cssSelector("input[name = 'collection1_9[0].field1'][value = '9996']"));
174 waitForElementNotPresent(By.cssSelector("input[name = 'collection1_9[0].field2'][value = '9996']"));
175 waitForTextPresent("You have deleted an item from Project Income.");
176 }
177
178 protected void testCollectionFeaturesAddRefreshingDialog() throws Exception {
179 selectByName("exampleShown", "Collection Add Line with Refreshing Dialog");
180
181
182 jGrowl("Click Add Income button.");
183 waitAndClickByXpath("//section[@id = 'Demo-CollectionAddLine-Example7']//button/text()[contains(., 'Add Income')]/..");
184
185
186 waitForElementNotPresent(By.xpath("//section[@id = 'Demo-CollectionAddLine-Example7-AddLineDialog']//button[contains(text(), 'Add Income')]"));
187
188
189 waitAndTypeByName("newCollectionLines['collection1_10'].field1", "77");
190 waitAndTypeByName("newCollectionLines['collection1_10'].field2", "");
191 waitForProgressLoading();
192
193
194 waitForElementVisibleBy(By.xpath(
195 "//section[@id = 'Demo-CollectionAddLine-Example7-AddLineDialog']//button[contains(text(), 'Add Income')]"));
196 }
197
198 @Test
199 public void testCollectionFeaturesAddLineBookmark() throws Exception {
200 testCollectionFeaturesAddLine();
201 passed();
202 }
203
204 @Test
205 public void testCollectionFeaturesAddLineWithDuplicatePropertyNameBookmark() throws Exception {
206 testCollectionFeaturesAddLineWithDuplicatePropertyName();
207 passed();
208 }
209
210 @Test
211 public void testCollectionFeaturesAddLineWithDialogBookmark() throws Exception {
212 testCollectionFeaturesAddLineWithDialog();
213 passed();
214 }
215
216 @Test
217 public void testCollectionFeaturesAddBlankLineBookmark() throws Exception {
218 testCollectionFeaturesAddBlankLine();
219 passed();
220 }
221
222 @Test
223 public void testCollectionFeaturesAddLineWithCustomActionsBookmark() throws Exception {
224 testCollectionFeaturesAddLineWithCustomActions();
225 passed();
226 }
227
228 @Test
229 public void testCollectionFeaturesAddLineWithDialogAndCustomActionsBookmark() throws Exception {
230 testCollectionFeaturesAddLineWithDialogAndCustomActions();
231 passed();
232 }
233
234 @Test
235 public void testCollectionFeaturesAddRefreshingDialogBookmark() throws Exception {
236 testCollectionFeaturesAddRefreshingDialog();
237 passed();
238 }
239
240 @Test
241 public void testCollectionFeaturesAddLineNav() throws Exception {
242 testCollectionFeaturesAddLine();
243 passed();
244 }
245
246 @Test
247 public void testCollectionFeaturesAddLineWithDuplicatePropertyNameNav() throws Exception {
248 testCollectionFeaturesAddLineWithDuplicatePropertyName();
249 passed();
250 }
251
252 @Test
253 public void testCollectionFeaturesAddLineWithDialogNav() throws Exception {
254 testCollectionFeaturesAddLineWithDialog();
255 passed();
256 }
257
258 @Test
259 public void testCollectionFeaturesAddBlankLineNav() throws Exception {
260 testCollectionFeaturesAddBlankLine();
261 passed();
262 }
263
264 @Test
265 public void testCollectionFeaturesAddLineWithCustomActionsNav() throws Exception {
266 testCollectionFeaturesAddLineWithCustomActions();
267 passed();
268 }
269
270 @Test
271 public void testCollectionFeaturesAddLineWithDialogAndCustomActionsNav() throws Exception {
272 testCollectionFeaturesAddLineWithDialogAndCustomActions();
273 passed();
274 }
275
276 @Test
277 public void testCollectionFeaturesAddRefreshingDialogNav() throws Exception {
278 testCollectionFeaturesAddRefreshingDialog();
279 passed();
280 }
281 }