1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package edu.samplu.krad.compview;
18
19 import edu.samplu.common.UpgradedSeleniumITBase;
20 import junit.framework.Assert;
21 import org.junit.Test;
22
23
24
25
26 public class ContraintsIT extends UpgradedSeleniumITBase {
27
28 @Override
29 public String getTestUrl() {
30 return "/kr-krad/uicomponents?viewId=UifCompView&methodToCall=start&pageId=UifCompView-Page3";
31 }
32
33 @Test
34 public void testContraintsIT() throws Exception {
35 checkForIncidentReport("name=field9");
36 focus("name=field9");
37 waitAndType("name=field9", "1");
38 fireEvent("name=field9", "blur");
39 Assert.assertTrue(getAttribute("name=field9@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
40 focus("name=field9");
41 waitAndType("name=field9", "12345");
42 fireEvent("name=field9", "blur");
43 Assert.assertTrue(getAttribute("name=field9@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
44 focus("name=field10");
45 waitAndType("name=field10", "2");
46 fireEvent("name=field10", "blur");
47 Assert.assertTrue(getAttribute("name=field10@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
48 focus("name=field10");
49 waitAndType("name=field10", "51");
50 fireEvent("name=field10", "blur");
51 Assert.assertTrue(getAttribute("name=field10@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
52 focus("name=field10");
53 waitAndType("name=field10", "25");
54 fireEvent("name=field10", "blur");
55 Assert.assertTrue(getAttribute("name=field10@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
56 focus("name=field6");
57 waitAndType("name=field6", "A");
58 fireEvent("name=field6", "blur");
59 fireEvent("name=field7", "blur");
60 Assert.assertTrue(getAttribute("name=field7@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
61 waitAndType("name=field7", "B");
62 fireEvent("name=field7", "blur");
63 Assert.assertTrue(getAttribute("name=field7@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
64 fireEvent("name=field8", "blur");
65 Assert.assertTrue(getAttribute("name=field8@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
66 waitAndType("name=field8", "C");
67 fireEvent("name=field8", "blur");
68 Assert.assertTrue(getAttribute("name=field8@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
69 waitAndType("name=field6", "");
70 fireEvent("name=field6", "blur");
71 Assert.assertTrue(getAttribute("name=field6@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
72 waitAndType("name=field7", "");
73 fireEvent("name=field7", "blur");
74 Assert.assertTrue(getAttribute("name=field7@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
75 waitAndType("name=field8", "");
76 fireEvent("name=field8", "blur");
77 Assert.assertTrue(getAttribute("name=field6@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
78 Assert.assertTrue(getAttribute("name=field7@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
79 Assert.assertTrue(getAttribute("name=field8@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
80 waitAndType("name=field8", "C");
81 fireEvent("name=field8", "blur");
82 Assert.assertTrue(getAttribute("name=field6@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
83 Assert.assertTrue(getAttribute("name=field7@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
84 Assert.assertTrue(getAttribute("name=field8@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
85 waitAndType("name=field6", "A");
86 fireEvent("name=field6", "blur");
87 Assert.assertTrue(getAttribute("name=field6@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
88 Assert.assertTrue(getAttribute("name=field7@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
89 Assert.assertTrue(getAttribute("name=field8@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
90 waitAndType("name=field14", "A");
91 fireEvent("name=field14", "blur");
92 Assert.assertTrue(getAttribute("name=field14@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
93 waitAndType("name=field11", "A");
94 fireEvent("name=field11", "blur");
95 Assert.assertTrue(getAttribute("name=field11@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
96 Assert.assertTrue(getAttribute("name=field14@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
97 waitAndType("name=field11", "");
98 fireEvent("name=field11", "blur");
99 Assert.assertTrue(getAttribute("name=field14@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
100 waitAndType("name=field12", "A");
101 fireEvent("name=field12", "blur");
102 Assert.assertTrue(getAttribute("name=field14@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
103 waitAndType("name=field13", "A");
104 fireEvent("name=field13", "blur");
105 Assert.assertTrue(getAttribute("name=field13@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
106 Assert.assertTrue(getAttribute("name=field14@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
107 waitAndType("name=field11", "A");
108 fireEvent("name=field11", "blur");
109 Assert.assertTrue(getAttribute("name=field11@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
110 Assert.assertTrue(getAttribute("name=field14@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
111 waitAndType("name=field18", "A");
112 fireEvent("name=field18", "blur");
113 Assert.assertTrue(getAttribute("name=field18@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
114 waitAndType("name=field15", "A");
115 fireEvent("name=field15", "blur");
116 Assert.assertTrue(getAttribute("name=field15@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
117 Assert.assertTrue(getAttribute("name=field18@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
118 waitAndType("name=field15", "");
119 fireEvent("name=field15", "blur");
120 Assert.assertTrue(getAttribute("name=field18@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
121 waitAndType("name=field16", "A");
122 fireEvent("name=field16", "blur");
123 Assert.assertTrue(getAttribute("name=field18@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
124 waitAndType("name=field17", "A");
125 fireEvent("name=field17", "blur");
126 Assert.assertTrue(getAttribute("name=field17@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
127 Assert.assertTrue(getAttribute("name=field18@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
128 waitAndType("name=field15", "A");
129 fireEvent("name=field15", "blur");
130 Assert.assertTrue(getAttribute("name=field18@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
131 waitAndType("name=field23", "A");
132 fireEvent("name=field23", "blur");
133 Assert.assertTrue(getAttribute("name=field23@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
134 waitAndType("name=field19", "A");
135 fireEvent("name=field19", "blur");
136 Assert.assertTrue(getAttribute("name=field23@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
137 waitAndType("name=field19", "");
138 fireEvent("name=field19", "blur");
139 waitAndType("name=field20", "B");
140 fireEvent("name=field20", "blur");
141 Assert.assertTrue(getAttribute("name=field23@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
142 waitAndType("name=field20", "");
143 fireEvent("name=field20", "blur");
144 Assert.assertTrue(getAttribute("name=field23@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
145 waitAndType("name=field21", "C");
146 fireEvent("name=field21", "blur");
147 Assert.assertTrue(getAttribute("name=field23@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
148 waitAndType("name=field22", "D");
149 fireEvent("name=field22", "blur");
150 Assert.assertTrue(getAttribute("name=field23@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
151 waitAndType("name=field19", "D");
152 fireEvent("name=field19", "blur");
153 Assert.assertTrue(getAttribute("name=field23@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
154 waitAndType("name=field20", "D");
155 fireEvent("name=field20", "blur");
156 Assert.assertTrue(getAttribute("name=field23@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
157 check("name=field24 value=case1");
158 waitAndType("name=field25", "");
159 fireEvent("name=field25", "blur");
160 Assert.assertTrue(getAttribute("name=field25@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
161 check("name=field24 value=case4");
162 fireEvent("name=field24", "blur");
163 for (int second = 0; ; second++) {
164 if (second >= 60) {
165 Assert.fail("timeout");
166 }
167 try {
168 if (getAttribute("name=field25@class").matches("^[\\s\\S]*valid[\\s\\S]*$")) {
169 break;
170 }
171 } catch (Exception e) {
172 }
173 Thread.sleep(1000);
174 }
175
176 Assert.assertTrue(getAttribute("name=field25@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
177 check("name=field24 value=case1");
178 fireEvent("name=field24", "blur");
179 waitAndType("name=field25", "$100");
180 fireEvent("name=field25", "blur");
181 for (int second = 0; ; second++) {
182 if (second >= 60) {
183 Assert.fail("timeout");
184 }
185 try {
186 if (getAttribute("name=field25@class").matches("^[\\s\\S]*valid[\\s\\S]*$")) {
187 break;
188 }
189 } catch (Exception e) {
190 }
191 Thread.sleep(1000);
192 }
193
194 Assert.assertTrue(getAttribute("name=field25@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
195 check("name=field24 value=case2");
196 fireEvent("name=field24", "blur");
197 for (int second = 0; ; second++) {
198 if (second >= 60) {
199 Assert.fail("timeout");
200 }
201 try {
202 if (getAttribute("name=field25@class").matches("^[\\s\\S]*error[\\s\\S]*$")) {
203 break;
204 }
205 } catch (Exception e) {
206 }
207 Thread.sleep(1000);
208 }
209
210 Assert.assertTrue(getAttribute("name=field25@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
211 waitAndType("name=field25", "A100");
212 fireEvent("name=field25", "blur");
213 Assert.assertTrue(getAttribute("name=field25@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
214 check("name=field24 value=case3");
215 fireEvent("name=field24", "blur");
216 waitAndType("name=field26", "6000");
217 fireEvent("name=field26", "blur");
218 for (int second = 0; ; second++) {
219 if (second >= 60) {
220 Assert.fail("timeout");
221 }
222 try {
223 if (getAttribute("name=field26@class").matches("^[\\s\\S]*error[\\s\\S]*$")) {
224 break;
225 }
226 } catch (Exception e) {
227 }
228 Thread.sleep(1000);
229 }
230
231 Assert.assertTrue(getAttribute("name=field26@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
232 waitAndType("name=field26", "501");
233 fireEvent("name=field26", "blur");
234 Assert.assertTrue(getAttribute("name=field26@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
235 waitAndType("name=field26", "499");
236 fireEvent("name=field26", "blur");
237 Assert.assertTrue(getAttribute("name=field26@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
238 waitAndType("name=field26", "6000");
239 fireEvent("name=field26", "blur");
240 check("name=field24 value=case3");
241 fireEvent("name=field24", "blur");
242 for (int second = 0; ; second++) {
243 if (second >= 60) {
244 Assert.fail("timeout");
245 }
246 try {
247 if (getAttribute("name=field26@class").matches("^[\\s\\S]*error[\\s\\S]*$")) {
248 break;
249 }
250 } catch (Exception e) {
251 }
252 Thread.sleep(1000);
253 }
254
255 Assert.assertTrue(getAttribute("name=field26@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
256 check("name=field24 value=case4");
257 waitAndType("name=field27", "A");
258 fireEvent("name=field27", "blur");
259 waitAndType("name=field28", "");
260 fireEvent("name=field28", "blur");
261 for (int second = 0; ; second++) {
262 if (second >= 60) {
263 Assert.fail("timeout");
264 }
265 try {
266 if (getAttribute("name=field28@class").matches("^[\\s\\S]*error[\\s\\S]*$")) {
267 break;
268 }
269 } catch (Exception e) {
270 }
271 Thread.sleep(1000);
272 }
273
274 Assert.assertTrue(getAttribute("name=field28@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
275 check("name=field24 value=case3");
276 fireEvent("name=field24", "blur");
277 for (int second = 0; ; second++) {
278 if (second >= 60) {
279 Assert.fail("timeout");
280 }
281 try {
282 if (getAttribute("name=field28@class").matches("^[\\s\\S]*valid[\\s\\S]*$")) {
283 break;
284 }
285 } catch (Exception e) {
286 }
287 Thread.sleep(1000);
288 }
289
290 Assert.assertTrue(getAttribute("name=field28@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
291 waitAndType("name=field28", "B");
292 fireEvent("name=field28", "blur");
293 check("name=field24 value=case4");
294 fireEvent("name=field24", "blur");
295 for (int second = 0; ; second++) {
296 if (second >= 60) {
297 Assert.fail("timeout");
298 }
299 try {
300 if (getAttribute("name=field28@class").matches("^[\\s\\S]*valid[\\s\\S]*$")) {
301 break;
302 }
303 } catch (Exception e) {
304 }
305 Thread.sleep(1000);
306 }
307
308 Assert.assertTrue(getAttribute("name=field28@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
309 waitAndType("name=field31", "B");
310 waitAndType("name=field32", "B");
311 fireEvent("name=field33", "blur");
312 Assert.assertTrue(getAttribute("name=field33@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
313 waitAndType("name=field33", "B");
314 fireEvent("name=field33", "blur");
315 Assert.assertTrue(getAttribute("name=field33@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
316 waitAndType("name=field32", "A");
317 waitAndType("name=field33", "");
318 fireEvent("name=field33", "blur");
319 Assert.assertTrue(getAttribute("name=field33@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
320 }
321 }