1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.samplu.travel.krad.test;
17
18 import edu.samplu.common.Failable;
19 import edu.samplu.common.ITUtil;
20 import edu.samplu.common.WebDriverLegacyITBase;
21
22
23
24
25
26
27 public abstract class UIFComponentValidationRegexPatternAbstractSmokeTestBase extends WebDriverLegacyITBase {
28
29
30
31
32 public static final String BOOKMARK_URL = "/kr-krad/uicomponents?viewId=UifCompView_KNS&methodToCall=start&readOnlyFields=field91";
33
34
35 protected void bookmark() {
36 open(ITUtil.getBaseUrlString() + BOOKMARK_URL);
37 }
38
39
40
41
42
43
44 @Override
45 public String getTestUrl() {
46 return ITUtil.PORTAL;
47 }
48
49
50 protected void navigation() throws InterruptedException {
51 waitAndClickKRAD();
52 waitAndClickByXpath(KITCHEN_SINK_XPATH);
53 switchToWindow(KUALI_UIF_COMPONENTS_WINDOW_XPATH);
54 }
55
56 protected void testValidCharacterConstraintNav(Failable failable) throws Exception {
57 navigation();
58 testValidCharacterConstraint();
59 passed();
60 }
61
62 protected void testValidCharacterConstraintBookmark(Failable failable) throws Exception {
63 testValidCharacterConstraint();
64 passed();
65 }
66
67 protected void testValidCharacterConstraint() throws Exception {
68 waitAndClickByXpath("//a[contains(text(),'Validation - Regex')]");
69
70
71 waitAndTypeByName("field50", "123.12");
72 fireEvent("field50", "blur");
73 try {
74 validateErrorImage(true);
75 fail("Framework error validateErrorImage(true) should have thrown an AssertionExcpetion");
76 } catch (AssertionError ae) {
77 jGrowl("validateErrorImage(true) when not expected okay.");
78
79 }
80 validateErrorImage(false);
81
82 clearTextByName("field50");
83 waitAndTypeByName("field50", "123.123");
84 fireEvent("field50", "blur");
85 try {
86 validateErrorImage(false);
87 fail("Framework error validateErrorImage(false) should have thrown an AssertionExcpetion");
88 } catch (AssertionError ae) {
89 jGrowl("validateErrorImage(false) when expected okay.");
90 }
91 validateErrorImage(true);
92
93 clearTextByName("field50");
94 waitAndTypeByXpath("//input[@name='field50']", "1234.4");
95 fireEvent("field50", "blur");
96 validateErrorImage(true);
97 clearTextByName("field50");
98 waitAndTypeByXpath("//input[@name='field50']", "1234.434");
99 fireEvent("field50", "blur");
100 validateErrorImage(true);
101 clearTextByName("field50");
102 waitAndTypeByXpath("//input[@name='field50']", "123.67");
103 fireEvent("field50", "blur");
104 validateErrorImage(false);
105 clearTextByName("field50");
106
107
108 waitAndTypeByXpath("//input[@name='field51']", "127.");
109 fireEvent("field51", "blur");
110 validateErrorImage(true);
111 clearTextByName("field51");
112 waitAndTypeByXpath("//input[@name='field51']", "1234()98");
113 fireEvent("field51", "blur");
114 validateErrorImage(true);
115 clearTextByName("field51");
116 waitAndTypeByXpath("//input[@name='field51']", "-123.67");
117 fireEvent("field51", "blur");
118 validateErrorImage(false);
119 clearTextByName("field51");
120
121
122 waitAndTypeByXpath("//input[@name='field77']", "127.");
123 fireEvent("field77", "blur");
124 validateErrorImage(true);
125 clearTextByName("field77");
126 waitAndTypeByXpath("//input[@name='field77']", "1234.4123");
127 fireEvent("field77", "blur");
128 validateErrorImage(true);
129 clearTextByName("field77");
130 waitAndTypeByXpath("//input[@name='field77']", "123E123");
131 fireEvent("field77", "blur");
132 validateErrorImage(true);
133 clearTextByName("field77");
134 waitAndTypeByXpath("//input[@name='field77']", "-123");
135 fireEvent("field77", "blur");
136 validateErrorImage(false);
137 clearTextByName("field77");
138
139
140 waitAndTypeByXpath("//input[@name='field52']", "1271231234");
141 fireEvent("field52", "blur");
142 validateErrorImage(true);
143 clearTextByName("field52");
144 waitAndTypeByXpath("//input[@name='field52']", "123-123-123");
145 fireEvent("field52", "blur");
146 validateErrorImage(true);
147 clearTextByName("field52");
148 waitAndTypeByXpath("//input[@name='field52']", "12-12-123445");
149 fireEvent("field52", "blur");
150 validateErrorImage(true);
151 clearTextByName("field52");
152 waitAndTypeByXpath("//input[@name='field52']", "1234-12-1234");
153 fireEvent("field52", "blur");
154 validateErrorImage(true);
155 clearTextByName("field52");
156 waitAndTypeByXpath("//input[@name='field52']", "123.123.1234");
157 fireEvent("field52", "blur");
158 validateErrorImage(true);
159 clearTextByName("field52");
160 waitAndTypeByXpath("//input[@name='field52']", "123-123-12345");
161 fireEvent("field52", "blur");
162 validateErrorImage(true);
163 clearTextByName("field52");
164 waitAndTypeByXpath("//input[@name='field52']", "123-123-1234");
165 fireEvent("field52", "blur");
166 validateErrorImage(false);
167 clearTextByName("field52");
168
169
170 waitAndTypeByXpath("//input[@name='field53']", "127");
171 fireEvent("field53", "blur");
172 validateErrorImage(true);
173 clearTextByName("field53");
174 waitAndTypeByXpath("//input[@name='field53']", "TestJava!@#Class");
175 fireEvent("field53", "blur");
176 validateErrorImage(true);
177 clearTextByName("field53");
178 waitAndTypeByXpath("//input[@name='field53']", "Test JavaClass");
179 fireEvent("field53", "blur");
180 validateErrorImage(true);
181 clearTextByName("field53");
182 waitAndTypeByXpath("//input[@name='field53']", "Test JavaClass");
183 fireEvent("field53", "blur");
184 validateErrorImage(true);
185 clearTextByName("field53");
186 waitAndTypeByXpath("//input[@name='field53']", "TestJavaClass");
187 fireEvent("field53", "blur");
188 validateErrorImage(false);
189 clearTextByName("field53");
190
191
192 waitAndTypeByXpath("//input[@name='field54']", "123@123.123");
193 fireEvent("field54", "blur");
194 validateErrorImage(true);
195 clearTextByName("field54");
196 waitAndTypeByXpath("//input[@name='field54']", "email.com@emailServer");
197 fireEvent("field54", "blur");
198 validateErrorImage(true);
199 clearTextByName("field54");
200 waitAndTypeByXpath("//input[@name='field54']", "emailemailServer@.com");
201 fireEvent("field54", "blur");
202 validateErrorImage(true);
203 clearTextByName("field54");
204 waitAndTypeByXpath("//input[@name='field54']", "email@emailServercom");
205 fireEvent("field54", "blur");
206 validateErrorImage(true);
207 clearTextByName("field54");
208 waitAndTypeByXpath("//input[@name='field54']", "email@emailServer.com");
209 fireEvent("field54", "blur");
210 validateErrorImage(false);
211 clearTextByName("field54");
212
213
214 waitAndTypeByXpath("//input[@name='field84']", "www.google.com");
215 fireEvent("field84", "blur");
216 validateErrorImage(true);
217 clearTextByName("field84");
218 waitAndTypeByXpath("//input[@name='field84']", "https:www.google.com");
219 fireEvent("field84", "blur");
220 validateErrorImage(true);
221 clearTextByName("field84");
222 waitAndTypeByXpath("//input[@name='field84']", "ftp://www.google.comsdfa123!#@");
223 fireEvent("field84", "blur");
224 validateErrorImage(true);
225 clearTextByName("field84");
226 waitAndTypeByXpath("//input[@name='field84']", "ftp:/www.google.coms");
227 fireEvent("field84", "blur");
228 validateErrorImage(true);
229 clearTextByName("field84");
230 waitAndTypeByXpath("//input[@name='field84']", "ftp://www.google.com");
231 fireEvent("field84", "blur");
232 validateErrorImage(false);
233 clearTextByName("field84");
234 waitAndTypeByXpath("//input[@name='field84']", "https://www.google.com");
235 fireEvent("field84", "blur");
236 validateErrorImage(false);
237 clearTextByName("field84");
238 waitAndTypeByXpath("//input[@name='field84']", "http://www.google.com");
239 fireEvent("field84", "blur");
240 validateErrorImage(false);
241 clearTextByName("field84");
242
243
244
245 waitAndTypeByXpath("//input[@name='field55']", "12/12/2112 12:12:87 am");
246 fireEvent("field55", "blur");
247 validateErrorImage(true);
248 clearTextByName("field55");
249 waitAndTypeByXpath("//input[@name='field55']", "12-12-2112 12:12 am");
250 fireEvent("field55", "blur");
251 validateErrorImage(true);
252 clearTextByName("field55");
253 waitAndTypeByXpath("//input[@name='field55']", "12-12-2112 12:12");
254 fireEvent("field55", "blur");
255 validateErrorImage(true);
256 clearTextByName("field55");
257 waitAndTypeByXpath("//input[@name='field55']", "12/12/2112 12:12");
258 fireEvent("field55", "blur");
259 validateErrorImage(true);
260 clearTextByName("field55");
261 waitAndTypeByXpath("//input[@name='field55']", "12-12-2112 12:12:78");
262 fireEvent("field55", "blur");
263 validateErrorImage(true);
264 clearTextByName("field55");
265 waitAndTypeByXpath("//input[@name='field55']", "12 Sept");
266 fireEvent("field55", "blur");
267 validateErrorImage(true);
268 clearTextByName("field55");
269 waitAndTypeByXpath("//input[@name='field55']", "Sept 12 12:12");
270 fireEvent("field55", "blur");
271 validateErrorImage(true);
272 clearTextByName("field55");
273 waitAndTypeByXpath("//input[@name='field55']", "221299 12:12:13");
274 fireEvent("field55", "blur");
275 validateErrorImage(true);
276 clearTextByName("field55");
277 waitAndTypeByXpath("//input[@name='field55']", "111222 12:12");
278 fireEvent("field55", "blur");
279 validateErrorImage(true);
280 clearTextByName("field55");
281 waitAndTypeByXpath("//input[@name='field55']", "9/9/2012 12:12 am");
282 fireEvent("field55", "blur");
283 validateErrorImage(true);
284 clearTextByName("field55");
285
286
287 waitAndTypeByXpath("//input[@name='field55']", "09/09/2012 12:12 pm");
288 fireEvent("field55", "blur");
289 validateErrorImage(false);
290 clearTextByName("field55");
291 waitAndTypeByXpath("//input[@name='field55']", "090923");
292 fireEvent("field55", "blur");
293 validateErrorImage(false);
294 clearTextByName("field55");
295 waitAndTypeByXpath("//input[@name='field55']", "Sept 12");
296 fireEvent("field55", "blur");
297 validateErrorImage(false);
298 clearTextByName("field55");
299 waitAndTypeByXpath("//input[@name='field55']", "2034");
300 fireEvent("field55", "blur");
301 validateErrorImage(false);
302 clearTextByName("field55");
303 waitAndTypeByXpath("//input[@name='field55']", "12/12/2012 23:12:59");
304 fireEvent("field55", "blur");
305 validateErrorImage(false);
306 clearTextByName("field55");
307 waitAndTypeByXpath("//input[@name='field55']", "12-12-12 23:12:59");
308 fireEvent("field55", "blur");
309 validateErrorImage(false);
310 clearTextByName("field55");
311 waitAndTypeByXpath("//input[@name='field55']", "121212 23:12:32");
312 fireEvent("field55", "blur");
313 validateErrorImage(false);
314 clearTextByName("field55");
315 waitAndTypeByXpath("//input[@name='field55']", "Sept 12 23:45:50");
316 fireEvent("field55", "blur");
317 validateErrorImage(false);
318 clearTextByName("field55");
319 waitAndTypeByXpath("//input[@name='field55']", "2011 12:23:32");
320 fireEvent("field55", "blur");
321 validateErrorImage(false);
322 clearTextByName("field55");
323
324
325 waitAndTypeByXpath("//input[@name='field75']", "12122012");
326 fireEvent("field75", "blur");
327 validateErrorImage(true);
328 clearTextByName("field75");
329 waitAndTypeByXpath("//input[@name='field75']", "13-12-34");
330 fireEvent("field75", "blur");
331 validateErrorImage(true);
332 clearTextByName("field75");
333 waitAndTypeByXpath("//input[@name='field75']", "12:12:2034");
334 fireEvent("field75", "blur");
335 validateErrorImage(true);
336 clearTextByName("field75");
337 waitAndTypeByXpath("//input[@name='field75']", "12-12-2034");
338 fireEvent("field75", "blur");
339 validateErrorImage(false);
340 clearTextByName("field75");
341
342
343 waitAndTypeByXpath("//input[@name='field82']", "13:00:12");
344 fireEvent("field82", "blur");
345 validateErrorImage(true);
346 clearTextByName("field82");
347 waitAndTypeByXpath("//input[@name='field82']", "09:00:");
348 fireEvent("field82", "blur");
349 validateErrorImage(true);
350 clearTextByName("field82");
351 waitAndTypeByXpath("//input[@name='field82']", "3-00:12");
352 fireEvent("field82", "blur");
353 validateErrorImage(true);
354 clearTextByName("field82");
355 waitAndTypeByXpath("//input[@name='field82']", "3:00:34");
356 fireEvent("field82", "blur");
357 validateErrorImage(false);
358 clearTextByName("field82");
359 waitAndTypeByXpath("//input[@name='field82']", "3:00");
360 fireEvent("field82", "blur");
361 validateErrorImage(false);
362 clearTextByName("field82");
363
364
365 waitAndTypeByXpath("//input[@name='field83']", "24:00:12");
366 fireEvent("field83", "blur");
367 validateErrorImage(true);
368 clearTextByName("field83");
369 waitAndTypeByXpath("//input[@name='field83']", "14:00:");
370 fireEvent("field83", "blur");
371 validateErrorImage(true);
372 clearTextByName("field83");
373 waitAndTypeByXpath("//input[@name='field83']", "13:00:76");
374 fireEvent("field83", "blur");
375 validateErrorImage(true);
376 clearTextByName("field83");
377 waitAndTypeByXpath("//input[@name='field83']", "13:00:23");
378 fireEvent("field83", "blur");
379 validateErrorImage(false);
380 clearTextByName("field83");
381 waitAndTypeByXpath("//input[@name='field83']", "23:00:12");
382 fireEvent("field83", "blur");
383 validateErrorImage(false);
384 clearTextByName("field83");
385
386
387 waitAndTypeByXpath("//input[@name='field56']", "1000-12-12 12:12:12.103");
388 fireEvent("field56", "blur");
389 validateErrorImage(true);
390 clearTextByName("field56");
391 waitAndTypeByXpath("//input[@name='field56']", "2000/12/12 12-12-12.87");
392 fireEvent("field56", "blur");
393 validateErrorImage(true);
394 clearTextByName("field56");
395 waitAndTypeByXpath("//input[@name='field56']", "2000/12/12 12-12-12.87");
396 fireEvent("field56", "blur");
397 validateErrorImage(true);
398 clearTextByName("field56");
399 waitAndTypeByXpath("//input[@name='field56']", "2011-08-12 12:12:12");
400 fireEvent("field56", "blur");
401 validateErrorImage(true);
402 clearTextByName("field56");
403
404
405
406
407
408
409
410
411
412 waitAndTypeByXpath("//input[@name='field56']", "2099-12-12 12:12:12.103");
413 fireEvent("field56", "blur");
414 validateErrorImage(false);
415 clearTextByName("field56");
416
417
418 waitAndTypeByXpath("//input[@name='field57']", "1599");
419 fireEvent("field57", "blur");
420 validateErrorImage(true);
421 clearTextByName("field57");
422 waitAndTypeByXpath("//input[@name='field57']", "2200");
423 fireEvent("field57", "blur");
424 validateErrorImage(true);
425 clearTextByName("field57");
426 waitAndTypeByXpath("//input[@name='field57']", "20000");
427 fireEvent("field57", "blur");
428 validateErrorImage(true);
429 clearTextByName("field57");
430 waitAndTypeByXpath("//input[@name='field57']", "-202");
431 fireEvent("field57", "blur");
432 validateErrorImage(true);
433 clearTextByName("field57");
434 waitAndTypeByXpath("//input[@name='field57']", "2000");
435 fireEvent("field57", "blur");
436 validateErrorImage(false);
437 clearTextByName("field57");
438
439
440 waitAndTypeByXpath("//input[@name='field58']", "0");
441 fireEvent("field58", "blur");
442 validateErrorImage(true);
443 clearTextByName("field58");
444 waitAndTypeByXpath("//input[@name='field58']", "-12");
445 fireEvent("field58", "blur");
446 validateErrorImage(true);
447 clearTextByName("field58");
448 waitAndTypeByXpath("//input[@name='field58']", "100");
449 fireEvent("field58", "blur");
450 validateErrorImage(true);
451 clearTextByName("field58");
452 waitAndTypeByXpath("//input[@name='field58']", "12");
453 fireEvent("field58", "blur");
454 validateErrorImage(false);
455 clearTextByName("field58");
456
457
458 waitAndTypeByXpath("//input[@name='field61']", "123");
459 fireEvent("field61", "blur");
460 validateErrorImage(true);
461 clearTextByName("field61");
462 waitAndTypeByXpath("//input[@name='field61']", "2341 12");
463 fireEvent("field61", "blur");
464 validateErrorImage(true);
465 clearTextByName("field61");
466 waitAndTypeByXpath("//input[@name='field61']", "0-1231");
467 fireEvent("field61", "blur");
468 validateErrorImage(true);
469 clearTextByName("field61");
470 waitAndTypeByXpath("//input[@name='field61']", "12345");
471 fireEvent("field61", "blur");
472 validateErrorImage(false);
473 clearTextByName("field61");
474
475
476 waitAndTypeByXpath("//input[@name='field62']", "123 23 @#");
477 fireEvent("field62", "blur");
478 validateErrorImage(true);
479 clearTextByName("field62");
480 waitAndTypeByXpath("//input[@name='field62']", "-asd123");
481 fireEvent("field62", "blur");
482 validateErrorImage(true);
483 clearTextByName("field62");
484 waitAndTypeByXpath("//input[@name='field62']", "asd/123");
485 fireEvent("field62", "blur");
486 validateErrorImage(true);
487 clearTextByName("field62");
488 waitAndTypeByXpath("//input[@name='field62']", "asd123");
489 fireEvent("field62", "blur");
490 validateErrorImage(false);
491 clearTextByName("field62");
492
493
494 waitAndTypeByXpath("//input[@name='field63']", "123^we");
495 fireEvent("field63", "blur");
496 validateErrorImage(true);
497 clearTextByName("field63");
498 waitAndTypeByXpath("//input[@name='field63']", "-123_asd");
499 fireEvent("field63", "blur");
500 validateErrorImage(true);
501 clearTextByName("field63");
502 waitAndTypeByXpath("//input[@name='field63']", "123 23 @#");
503 fireEvent("field63", "blur");
504 clearTextByName("field63");
505 waitAndTypeByXpath("//input[@name='field63']", "as_de 456/123");
506 fireEvent("field63", "blur");
507 validateErrorImage(false);
508 clearTextByName("field63");
509
510
511 waitAndTypeByXpath("//input[@name='field64']", "123^we");
512 fireEvent("field64", "blur");
513 validateErrorImage(true);
514 clearTextByName("field64");
515 waitAndTypeByXpath("//input[@name='field64']", "asd_pqr");
516 fireEvent("field64", "blur");
517 validateErrorImage(true);
518 clearTextByName("field64");
519 waitAndTypeByXpath("//input[@name='field64']", "asd/def");
520 fireEvent("field64", "blur");
521 validateErrorImage(true);
522 clearTextByName("field64");
523 waitAndTypeByXpath("//input[@name='field64']", "asd ,pqr");
524 fireEvent("field64", "blur");
525 validateErrorImage(false);
526 clearTextByName("field64");
527
528
529 waitAndTypeByXpath("//input[@name='field76']", "123");
530 fireEvent("field76", "blur");
531 validateErrorImage(true);
532 clearTextByName("field76");
533 waitAndTypeByXpath("//input[@name='field76']", "`abcd`");
534 fireEvent("field76", "blur");
535 validateErrorImage(true);
536 clearTextByName("field76");
537 waitAndTypeByXpath("//input[@name='field76']", "|abcd|");
538 fireEvent("field76", "blur");
539 validateErrorImage(true);
540 clearTextByName("field76");
541 waitAndTypeByXpath("//input[@name='field76']", "~abcd~");
542 fireEvent("field76", "blur");
543 validateErrorImage(true);
544 clearTextByName("field76");
545 waitAndTypeByXpath("//input[@name='field76']", " ab_c d_ef ");
546 fireEvent("field76", "blur");
547 validateErrorImage(false);
548 clearTextByName("field76");
549
550
551 waitAndTypeByXpath("//input[@name='field65']", "123 ^we");
552 fireEvent("field65", "blur");
553 validateErrorImage(true);
554 clearTextByName("field65");
555 waitAndTypeByXpath("//input[@name='field65']", "123^we!@#^&*~:");
556 fireEvent("field65", "blur");
557 validateErrorImage(false);
558 clearTextByName("field65");
559
560
561 waitAndTypeByXpath("//input[@name='field66']", "123 ^we");
562 fireEvent("field66", "blur");
563 validateErrorImage(true);
564 clearTextByName("field66");
565 waitAndTypeByXpath("//input[@name='field66']", "123_^we");
566 fireEvent("field66", "blur");
567 validateErrorImage(true);
568 clearTextByName("field66");
569 waitAndTypeByXpath("//input[@name='field66']", "abc ABC");
570 fireEvent("field66", "blur");
571 validateErrorImage(true);
572 clearTextByName("field66");
573 waitAndTypeByXpath("//input[@name='field66']", "aAbBcC");
574 fireEvent("field66", "blur");
575 validateErrorImage(false);
576 clearTextByName("field66");
577
578
579 waitAndTypeByXpath("//input[@name='field67']", "123 ^we");
580 fireEvent("field67", "blur");
581 validateErrorImage(true);
582 clearTextByName("field67");
583 waitAndTypeByXpath("//input[@name='field67']", "123/10");
584 fireEvent("field67", "blur");
585 validateErrorImage(true);
586 clearTextByName("field67");
587 waitAndTypeByXpath("//input[@name='field67']", "(123.00)");
588 fireEvent("field67", "blur");
589 validateErrorImage(true);
590 clearTextByName("field67");
591 waitAndTypeByXpath("//input[@name='field67']", "(12-3)");
592 fireEvent("field67", "blur");
593 validateErrorImage(false);
594 clearTextByName("field67");
595
596
597 waitAndTypeByXpath("//input[@name='field68']", "123.123");
598 fireEvent("field68", "blur");
599 validateErrorImage(true);
600 clearTextByName("field68");
601 waitAndTypeByXpath("//input[@name='field68']", "a.b");
602 fireEvent("field68", "blur");
603 validateErrorImage(true);
604 clearTextByName("field68");
605 waitAndTypeByXpath("//input[@name='field68']", "123 qwe");
606 fireEvent("field68", "blur");
607 validateErrorImage(true);
608 clearTextByName("field68");
609 waitAndTypeByXpath("//input[@name='field68']", "5.a");
610 fireEvent("field68", "blur");
611 validateErrorImage(true);
612 clearTextByName("field68");
613 waitAndTypeByXpath("//input[@name='field68']", "a.0,b.4");
614 fireEvent("field68", "blur");
615 validateErrorImage(true);
616 clearTextByName("field68");
617 waitAndTypeByXpath("//input[@name='field68']", "a.0");
618 fireEvent("field68", "blur");
619 validateErrorImage(false);
620 clearTextByName("field68");
621 passed();
622 }
623 }