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 com.thoughtworks.selenium.DefaultSelenium;
19 import com.thoughtworks.selenium.Selenium;
20 import org.junit.After;
21 import org.junit.Before;
22 import org.junit.Test;
23
24 import static org.junit.Assert.assertEquals;
25 import static org.junit.Assert.assertTrue;
26
27
28
29
30
31
32 public class UIFComponentValidationRegexPatternIT {
33 private Selenium selenium;
34
35 @Before
36 public void setUp() throws Exception {
37 selenium = new DefaultSelenium("localhost", 4444, "*firefox", System.getProperty("remote.public.url"));
38 selenium.start();
39 }
40
41 @Test
42 public void testValidCharacterConstraint() throws Exception {
43
44
45
46
47
48
49
50
51 selenium.open(System.getProperty("remote.public.url"));
52 assertEquals("Login", selenium.getTitle());
53 selenium.type("__login_user", "admin");
54 selenium.click("//input[@value='Login']");
55 selenium.waitForPageToLoad("50000");
56 assertEquals("Kuali Portal Index", selenium.getTitle());
57 selenium.click("link=KRAD");
58 selenium.waitForPageToLoad("30000");
59 selenium.click("link=Uif Components (Kitchen Sink)");
60 selenium.waitForPageToLoad("50000");
61 assertEquals("Kuali Portal Index", selenium.getTitle());
62 selenium.selectFrame("iframeportlet");
63 selenium.click("link=Validation - Regex");
64
65 Thread.sleep(5000);
66
67
68
69 clearText("//input[@name='field50']");
70 selenium.type("//input[@name='field50']", "127.344");
71 selenium.focus("//input[@name='field51']");
72 Thread.sleep(100);
73 assertTrue(selenium.isTextPresent("Must be a positive fixed point number, with 5 max digits and 2 digits to the right of the decimal point"));
74
75 clearText("//input[@name='field50']");
76 selenium.type("//input[@name='field50']", "1234.4");
77 selenium.focus("//input[@name='field51']");
78 Thread.sleep(100);
79 assertTrue(selenium.isTextPresent("Must be a positive fixed point number, with 5 max digits and 2 digits to the right of the decimal point"));
80
81 clearText("//input[@name='field50']");
82 selenium.type("//input[@name='field50']", "1234.434");
83 selenium.focus("//input[@name='field51']");
84 Thread.sleep(100);
85 assertTrue(selenium.isTextPresent("Must be a positive fixed point number, with 5 max digits and 2 digits to the right of the decimal point"));
86
87 clearText("//input[@name='field50']");
88 selenium.type("//input[@name='field50']", "123.67");
89 selenium.focus("//input[@name='field51']");
90 Thread.sleep(100);
91 assertTrue(! selenium.isTextPresent("Must be a positive fixed point number, with 5 max digits and 2 digits to the right of the decimal point"));
92
93
94 clearText("//input[@name='field51']");
95 selenium.type("//input[@name='field51']", "127.");
96 selenium.focus("//input[@name='field77']");
97 Thread.sleep(100);
98 assertTrue(selenium.isTextPresent("Must be a positive or negative number, with any number of digits to the right of the decimal."));
99
100 clearText("//input[@name='field51']");
101 selenium.type("//input[@name='field51']", "1234.4123");
102 selenium.focus("//input[@name='field77']");
103 Thread.sleep(100);
104 assertTrue(! selenium.isTextPresent("Must be a positive or negative number, with any number of digits to the right of the decimal."));
105
106 clearText("//input[@name='field51']");
107 selenium.type("//input[@name='field51']", "1234()98");
108 selenium.focus("//input[@name='field77']");
109 Thread.sleep(100);
110 assertTrue(selenium.isTextPresent("Must be a positive or negative number, with any number of digits to the right of the decimal."));
111
112 clearText("//input[@name='field51']");
113 selenium.type("//input[@name='field51']", "-123.67");
114 selenium.focus("//input[@name='field77']");
115 Thread.sleep(100);
116 assertTrue(! selenium.isTextPresent("Must be a positive or negative number, with any number of digits to the right of the decimal."));
117
118
119
120 clearText("//input[@name='field77']");
121 selenium.type("//input[@name='field77']", "127.");
122 selenium.focus("//input[@name='field52']");
123 Thread.sleep(100);
124 assertTrue(selenium.isTextPresent("Must be a positive or negative whole number"));
125
126 clearText("//input[@name='field77']");
127 selenium.type("//input[@name='field77']", "1234.4123");
128 selenium.focus("//input[@name='field52']");
129 Thread.sleep(100);
130 assertTrue(selenium.isTextPresent("Must be a positive or negative whole number"));
131
132 clearText("//input[@name='field77']");
133 selenium.type("//input[@name='field77']", "123E123");
134 selenium.focus("//input[@name='field52']");
135 Thread.sleep(100);
136 assertTrue(selenium.isTextPresent("Must be a positive or negative whole number"));
137
138 clearText("//input[@name='field77']");
139 selenium.type("//input[@name='field77']", "-123");
140 selenium.focus("//input[@name='field52']");
141 Thread.sleep(100);
142 assertTrue(! selenium.isTextPresent("Must be a positive or negative whole number"));
143
144
145 clearText("//input[@name='field52']");
146 selenium.type("//input[@name='field52']", "1271231234");
147 selenium.focus("//input[@name='field53']");
148 Thread.sleep(100);
149 assertTrue(selenium.isTextPresent("Must be a phone number, in the format of ###-###-####."));
150
151
152 clearText("//input[@name='field52']");
153 selenium.type("//input[@name='field52']", "123-123-123");
154 selenium.focus("//input[@name='field53']");
155 Thread.sleep(100);
156 assertTrue(selenium.isTextPresent("Must be a phone number, in the format of ###-###-####."));
157
158 clearText("//input[@name='field52']");
159 selenium.type("//input[@name='field52']", "12-12-123445");
160 selenium.focus("//input[@name='field53']");
161 Thread.sleep(100);
162 assertTrue(selenium.isTextPresent("Must be a phone number, in the format of ###-###-####."));
163
164 clearText("//input[@name='field52']");
165 selenium.type("//input[@name='field52']", "1234-12-1234");
166 selenium.focus("//input[@name='field53']");
167 Thread.sleep(100);
168 assertTrue(selenium.isTextPresent("Must be a phone number, in the format of ###-###-####."));
169
170 clearText("//input[@name='field52']");
171 selenium.type("//input[@name='field52']", "123.123.1234");
172 selenium.focus("//input[@name='field53']");
173 Thread.sleep(100);
174 assertTrue(selenium.isTextPresent("Must be a phone number, in the format of ###-###-####."));
175
176 clearText("//input[@name='field52']");
177 selenium.type("//input[@name='field52']", "123-123-12345");
178 selenium.focus("//input[@name='field53']");
179 Thread.sleep(100);
180 assertTrue(selenium.isTextPresent("Must be a phone number, in the format of ###-###-####."));
181
182 clearText("//input[@name='field52']");
183 selenium.type("//input[@name='field52']", "123-123-1234");
184 selenium.focus("//input[@name='field53']");
185 Thread.sleep(100);
186 assertTrue(! selenium.isTextPresent("Must be a phone number, in the format of ###-###-####."));
187
188
189 clearText("//input[@name='field53']");
190 selenium.type("//input[@name='field53']", "127");
191 selenium.focus("//input[@name='field54']");
192 Thread.sleep(100);
193 assertTrue(selenium.isTextPresent("Must be a valid Java class name."));
194
195 clearText("//input[@name='field53']");
196 selenium.type("//input[@name='field53']", "TestJava!@#Class");
197 selenium.focus("//input[@name='field54']");
198 Thread.sleep(100);
199 assertTrue(selenium.isTextPresent("Must be a valid Java class name."));
200
201 clearText("//input[@name='field53']");
202 selenium.type("//input[@name='field53']", "Test JavaClass");
203 selenium.focus("//input[@name='field54']");
204 Thread.sleep(100);
205 assertTrue(selenium.isTextPresent("Must be a valid Java class name."));
206
207 clearText("//input[@name='field53']");
208 selenium.type("//input[@name='field53']", "Test JavaClass");
209 selenium.focus("//input[@name='field54']");
210 Thread.sleep(100);
211 assertTrue(selenium.isTextPresent("Must be a valid Java class name."));
212
213 clearText("//input[@name='field53']");
214 selenium.type("//input[@name='field53']", "TestJavaClass");
215 selenium.focus("//input[@name='field54']");
216 Thread.sleep(100);
217 assertTrue(! selenium.isTextPresent("Must be a valid Java class name."));
218
219
220 clearText("//input[@name='field54']");
221 selenium.type("//input[@name='field54']", "123@123.123");
222 selenium.focus("//input[@name='field84']");
223 Thread.sleep(100);
224 assertTrue(selenium.isTextPresent("Must be a properly formatted email address."));
225
226 clearText("//input[@name='field54']");
227 selenium.type("//input[@name='field54']", "email.com@emailServer");
228 selenium.focus("//input[@name='field84']");
229 Thread.sleep(100);
230 assertTrue(selenium.isTextPresent("Must be a properly formatted email address."));
231
232 clearText("//input[@name='field54']");
233 selenium.type("//input[@name='field54']", "emailemailServer@.com");
234 selenium.focus("//input[@name='field84']");
235 Thread.sleep(100);
236 assertTrue(selenium.isTextPresent("Must be a properly formatted email address."));
237
238 clearText("//input[@name='field54']");
239 selenium.type("//input[@name='field54']", "email@emailServercom");
240 selenium.focus("//input[@name='field84']");
241 Thread.sleep(100);
242 assertTrue(selenium.isTextPresent("Must be a properly formatted email address."));
243
244 clearText("//input[@name='field54']");
245 selenium.type("//input[@name='field54']", "email@emailServer.com");
246 selenium.focus("//input[@name='field84']");
247 Thread.sleep(100);
248 assertTrue(! selenium.isTextPresent("Must be a properly formatted email address."));
249
250
251
252 clearText("//input[@name='field84']");
253 selenium.type("//input[@name='field84']", "www.google.com");
254 selenium.focus("//input[@name='field55']");
255 Thread.sleep(100);
256 assertTrue(selenium.isTextPresent("Must be a valid url beginning with http, https, or ftp"));
257
258 clearText("//input[@name='field84']");
259 selenium.type("//input[@name='field84']", "https:www.google.com");
260 selenium.focus("//input[@name='field55']");
261 Thread.sleep(100);
262 assertTrue(selenium.isTextPresent("Must be a valid url beginning with http, https, or ftp"));
263
264 clearText("//input[@name='field84']");
265 selenium.type("//input[@name='field84']", "ftp://www.google.comsdfa123!#@");
266 selenium.focus("//input[@name='field55']");
267 Thread.sleep(100);
268 assertTrue(selenium.isTextPresent("Must be a valid url beginning with http, https, or ftp"));
269
270 clearText("//input[@name='field84']");
271 selenium.type("//input[@name='field84']", "ftp:/www.google.coms");
272 selenium.focus("//input[@name='field55']");
273 Thread.sleep(100);
274 assertTrue(selenium.isTextPresent("Must be a valid url beginning with http, https, or ftp"));
275
276 clearText("//input[@name='field84']");
277 selenium.type("//input[@name='field84']", "ftp://www.google.com");
278 selenium.focus("//input[@name='field55']");
279 Thread.sleep(100);
280 assertTrue(! selenium.isTextPresent("Must be a valid url beginning with http, https, or ftp"));
281
282 clearText("//input[@name='field84']");
283 selenium.type("//input[@name='field84']", "https://www.google.com");
284 selenium.focus("//input[@name='field55']");
285 Thread.sleep(100);
286 assertTrue(! selenium.isTextPresent("Must be a valid url beginning with http, https, or ftp"));
287
288 clearText("//input[@name='field84']");
289 selenium.type("//input[@name='field84']", "http://www.google.com");
290 selenium.focus("//input[@name='field55']");
291 Thread.sleep(100);
292 assertTrue(! selenium.isTextPresent("Must be a valid url beginning with http, https, or ftp"));
293
294
295
296
297 clearText("//input[@name='field55']");
298 selenium.type("//input[@name='field55']", "12/12/2112 12:12:87 am");
299 selenium.focus("//input[@name='field75']");
300 Thread.sleep(100);
301 assertTrue(selenium.isTextPresent("Must be a date in the following format(s): MM/dd/yyyy hh:mm a, MM/dd/yy, MM/dd/yyyy, MM-dd-yy, MM-dd-yyyy, MMddyy, MMMM dd, yyyy, MM/dd/yy HH:mm:ss, MM/dd/yyyy HH:mm:ss, MM-dd-yy HH:mm:ss, MMddyy HH:mm:ss, MMMM dd HH:mm:ss, yyyy HH:mm:ss"));
302
303 clearText("//input[@name='field55']");
304 selenium.type("//input[@name='field55']", "12-12-2112 12:12 am");
305 selenium.focus("//input[@name='field75']");
306 Thread.sleep(100);
307 assertTrue(selenium.isTextPresent("Must be a date in the following format(s): MM/dd/yyyy hh:mm a, MM/dd/yy, MM/dd/yyyy, MM-dd-yy, MM-dd-yyyy, MMddyy, MMMM dd, yyyy, MM/dd/yy HH:mm:ss, MM/dd/yyyy HH:mm:ss, MM-dd-yy HH:mm:ss, MMddyy HH:mm:ss, MMMM dd HH:mm:ss, yyyy HH:mm:ss"));
308
309 clearText("//input[@name='field55']");
310 selenium.type("//input[@name='field55']", "12-12-2112 12:12");
311 selenium.focus("//input[@name='field75']");
312 Thread.sleep(100);
313 assertTrue(selenium.isTextPresent("Must be a date in the following format(s): MM/dd/yyyy hh:mm a, MM/dd/yy, MM/dd/yyyy, MM-dd-yy, MM-dd-yyyy, MMddyy, MMMM dd, yyyy, MM/dd/yy HH:mm:ss, MM/dd/yyyy HH:mm:ss, MM-dd-yy HH:mm:ss, MMddyy HH:mm:ss, MMMM dd HH:mm:ss, yyyy HH:mm:ss"));
314
315 clearText("//input[@name='field55']");
316 selenium.type("//input[@name='field55']", "12/12/2112 12:12");
317 selenium.focus("//input[@name='field75']");
318 Thread.sleep(100);
319 assertTrue(selenium.isTextPresent("Must be a date in the following format(s): MM/dd/yyyy hh:mm a, MM/dd/yy, MM/dd/yyyy, MM-dd-yy, MM-dd-yyyy, MMddyy, MMMM dd, yyyy, MM/dd/yy HH:mm:ss, MM/dd/yyyy HH:mm:ss, MM-dd-yy HH:mm:ss, MMddyy HH:mm:ss, MMMM dd HH:mm:ss, yyyy HH:mm:ss"));
320
321 clearText("//input[@name='field55']");
322 selenium.type("//input[@name='field55']", "12-12-2112 12:12:78");
323 selenium.focus("//input[@name='field75']");
324 Thread.sleep(100);
325 assertTrue(selenium.isTextPresent("Must be a date in the following format(s): MM/dd/yyyy hh:mm a, MM/dd/yy, MM/dd/yyyy, MM-dd-yy, MM-dd-yyyy, MMddyy, MMMM dd, yyyy, MM/dd/yy HH:mm:ss, MM/dd/yyyy HH:mm:ss, MM-dd-yy HH:mm:ss, MMddyy HH:mm:ss, MMMM dd HH:mm:ss, yyyy HH:mm:ss"));
326
327 clearText("//input[@name='field55']");
328 selenium.type("//input[@name='field55']", "12 Sept");
329 selenium.focus("//input[@name='field75']");
330 Thread.sleep(100);
331 assertTrue(selenium.isTextPresent("Must be a date in the following format(s): MM/dd/yyyy hh:mm a, MM/dd/yy, MM/dd/yyyy, MM-dd-yy, MM-dd-yyyy, MMddyy, MMMM dd, yyyy, MM/dd/yy HH:mm:ss, MM/dd/yyyy HH:mm:ss, MM-dd-yy HH:mm:ss, MMddyy HH:mm:ss, MMMM dd HH:mm:ss, yyyy HH:mm:ss"));
332
333 clearText("//input[@name='field55']");
334 selenium.type("//input[@name='field55']", "Sept 12 12:12");
335 selenium.focus("//input[@name='field75']");
336 Thread.sleep(100);
337 assertTrue(selenium.isTextPresent("Must be a date in the following format(s): MM/dd/yyyy hh:mm a, MM/dd/yy, MM/dd/yyyy, MM-dd-yy, MM-dd-yyyy, MMddyy, MMMM dd, yyyy, MM/dd/yy HH:mm:ss, MM/dd/yyyy HH:mm:ss, MM-dd-yy HH:mm:ss, MMddyy HH:mm:ss, MMMM dd HH:mm:ss, yyyy HH:mm:ss"));
338
339 clearText("//input[@name='field55']");
340 selenium.type("//input[@name='field55']", "221299 12:12:13");
341 selenium.focus("//input[@name='field75']");
342 Thread.sleep(100);
343 assertTrue(selenium.isTextPresent("Must be a date in the following format(s): MM/dd/yyyy hh:mm a, MM/dd/yy, MM/dd/yyyy, MM-dd-yy, MM-dd-yyyy, MMddyy, MMMM dd, yyyy, MM/dd/yy HH:mm:ss, MM/dd/yyyy HH:mm:ss, MM-dd-yy HH:mm:ss, MMddyy HH:mm:ss, MMMM dd HH:mm:ss, yyyy HH:mm:ss"));
344
345 clearText("//input[@name='field55']");
346 selenium.type("//input[@name='field55']", "111222 12:12");
347 selenium.focus("//input[@name='field75']");
348 Thread.sleep(100);
349 assertTrue(selenium.isTextPresent("Must be a date in the following format(s): MM/dd/yyyy hh:mm a, MM/dd/yy, MM/dd/yyyy, MM-dd-yy, MM-dd-yyyy, MMddyy, MMMM dd, yyyy, MM/dd/yy HH:mm:ss, MM/dd/yyyy HH:mm:ss, MM-dd-yy HH:mm:ss, MMddyy HH:mm:ss, MMMM dd HH:mm:ss, yyyy HH:mm:ss"));
350
351 clearText("//input[@name='field55']");
352 selenium.type("//input[@name='field55']", "9/9/2012 12:12 am");
353 selenium.focus("//input[@name='field75']");
354 Thread.sleep(100);
355 assertTrue(selenium.isTextPresent("Must be a date in the following format(s): MM/dd/yyyy hh:mm a, MM/dd/yy, MM/dd/yyyy, MM-dd-yy, MM-dd-yyyy, MMddyy, MMMM dd, yyyy, MM/dd/yy HH:mm:ss, MM/dd/yyyy HH:mm:ss, MM-dd-yy HH:mm:ss, MMddyy HH:mm:ss, MMMM dd HH:mm:ss, yyyy HH:mm:ss"));
356
357
358 clearText("//input[@name='field55']");
359 selenium.type("//input[@name='field55']", "09/09/2012 12:12 pm");
360 selenium.focus("//input[@name='field75']");
361 Thread.sleep(100);
362 assertTrue(! selenium.isTextPresent("Must be a date in the following format(s): MM/dd/yyyy hh:mm a, MM/dd/yy, MM/dd/yyyy, MM-dd-yy, MM-dd-yyyy, MMddyy, MMMM dd, yyyy, MM/dd/yy HH:mm:ss, MM/dd/yyyy HH:mm:ss, MM-dd-yy HH:mm:ss, MMddyy HH:mm:ss, MMMM dd HH:mm:ss, yyyy HH:mm:ss"));
363
364 clearText("//input[@name='field55']");
365 selenium.type("//input[@name='field55']", "090923");
366 selenium.focus("//input[@name='field75']");
367 Thread.sleep(100);
368 assertTrue(! selenium.isTextPresent("Must be a date in the following format(s): MM/dd/yyyy hh:mm a, MM/dd/yy, MM/dd/yyyy, MM-dd-yy, MM-dd-yyyy, MMddyy, MMMM dd, yyyy, MM/dd/yy HH:mm:ss, MM/dd/yyyy HH:mm:ss, MM-dd-yy HH:mm:ss, MMddyy HH:mm:ss, MMMM dd HH:mm:ss, yyyy HH:mm:ss"));
369
370 clearText("//input[@name='field55']");
371 selenium.type("//input[@name='field55']", "Sept 12");
372 selenium.focus("//input[@name='field75']");
373 Thread.sleep(100);
374 assertTrue(! selenium.isTextPresent("Must be a date in the following format(s): MM/dd/yyyy hh:mm a, MM/dd/yy, MM/dd/yyyy, MM-dd-yy, MM-dd-yyyy, MMddyy, MMMM dd, yyyy, MM/dd/yy HH:mm:ss, MM/dd/yyyy HH:mm:ss, MM-dd-yy HH:mm:ss, MMddyy HH:mm:ss, MMMM dd HH:mm:ss, yyyy HH:mm:ss"));
375
376
377 clearText("//input[@name='field55']");
378 selenium.type("//input[@name='field55']", "2034");
379 selenium.focus("//input[@name='field75']");
380 Thread.sleep(100);
381 assertTrue(! selenium.isTextPresent("Must be a date in the following format(s): MM/dd/yyyy hh:mm a, MM/dd/yy, MM/dd/yyyy, MM-dd-yy, MM-dd-yyyy, MMddyy, MMMM dd, yyyy, MM/dd/yy HH:mm:ss, MM/dd/yyyy HH:mm:ss, MM-dd-yy HH:mm:ss, MMddyy HH:mm:ss, MMMM dd HH:mm:ss, yyyy HH:mm:ss"));
382
383 clearText("//input[@name='field55']");
384 selenium.type("//input[@name='field55']", "12/12/2012 23:12:59");
385 selenium.focus("//input[@name='field75']");
386 Thread.sleep(100);
387 assertTrue(! selenium.isTextPresent("Must be a date in the following format(s): MM/dd/yyyy hh:mm a, MM/dd/yy, MM/dd/yyyy, MM-dd-yy, MM-dd-yyyy, MMddyy, MMMM dd, yyyy, MM/dd/yy HH:mm:ss, MM/dd/yyyy HH:mm:ss, MM-dd-yy HH:mm:ss, MMddyy HH:mm:ss, MMMM dd HH:mm:ss, yyyy HH:mm:ss"));
388
389 clearText("//input[@name='field55']");
390 selenium.type("//input[@name='field55']", "12-12-12 23:12:59");
391 selenium.focus("//input[@name='field75']");
392 Thread.sleep(100);
393 assertTrue(! selenium.isTextPresent("Must be a date in the following format(s): MM/dd/yyyy hh:mm a, MM/dd/yy, MM/dd/yyyy, MM-dd-yy, MM-dd-yyyy, MMddyy, MMMM dd, yyyy, MM/dd/yy HH:mm:ss, MM/dd/yyyy HH:mm:ss, MM-dd-yy HH:mm:ss, MMddyy HH:mm:ss, MMMM dd HH:mm:ss, yyyy HH:mm:ss"));
394
395 clearText("//input[@name='field55']");
396 selenium.type("//input[@name='field55']", "121212 23:12:32");
397 selenium.focus("//input[@name='field75']");
398 Thread.sleep(100);
399 assertTrue(! selenium.isTextPresent("Must be a date in the following format(s): MM/dd/yyyy hh:mm a, MM/dd/yy, MM/dd/yyyy, MM-dd-yy, MM-dd-yyyy, MMddyy, MMMM dd, yyyy, MM/dd/yy HH:mm:ss, MM/dd/yyyy HH:mm:ss, MM-dd-yy HH:mm:ss, MMddyy HH:mm:ss, MMMM dd HH:mm:ss, yyyy HH:mm:ss"));
400
401 clearText("//input[@name='field55']");
402 selenium.type("//input[@name='field55']", "Sept 12 23:45:50");
403 selenium.focus("//input[@name='field75']");
404 Thread.sleep(100);
405 assertTrue(! selenium.isTextPresent("Must be a date in the following format(s): MM/dd/yyyy hh:mm a, MM/dd/yy, MM/dd/yyyy, MM-dd-yy, MM-dd-yyyy, MMddyy, MMMM dd, yyyy, MM/dd/yy HH:mm:ss, MM/dd/yyyy HH:mm:ss, MM-dd-yy HH:mm:ss, MMddyy HH:mm:ss, MMMM dd HH:mm:ss, yyyy HH:mm:ss"));
406
407 clearText("//input[@name='field55']");
408 selenium.type("//input[@name='field55']", "2011 12:23:32");
409 selenium.focus("//input[@name='field75']");
410 Thread.sleep(100);
411 assertTrue(! selenium.isTextPresent("Must be a date in the following format(s): MM/dd/yyyy hh:mm a, MM/dd/yy, MM/dd/yyyy, MM-dd-yy, MM-dd-yyyy, MMddyy, MMMM dd, yyyy, MM/dd/yy HH:mm:ss, MM/dd/yyyy HH:mm:ss, MM-dd-yy HH:mm:ss, MMddyy HH:mm:ss, MMMM dd HH:mm:ss, yyyy HH:mm:ss"));
412
413
414
415 clearText("//input[@name='field75']");
416 selenium.type("//input[@name='field75']", "12122012");
417 selenium.focus("//input[@name='field82']");
418 Thread.sleep(100);
419 assertTrue(selenium.isTextPresent("Must be a date in the following format(s): MM/dd/yy, MM/dd/yyyy, MM-dd-yy, MM-dd-yyyy"));
420
421 clearText("//input[@name='field75']");
422 selenium.type("//input[@name='field75']", "13-12-34");
423 selenium.focus("//input[@name='field82']");
424 Thread.sleep(100);
425 assertTrue(selenium.isTextPresent("Must be a date in the following format(s): MM/dd/yy, MM/dd/yyyy, MM-dd-yy, MM-dd-yyyy"));
426
427 clearText("//input[@name='field75']");
428 selenium.type("//input[@name='field75']", "12:12:2034");
429 selenium.focus("//input[@name='field82']");
430 Thread.sleep(100);
431 assertTrue(selenium.isTextPresent("Must be a date in the following format(s): MM/dd/yy, MM/dd/yyyy, MM-dd-yy, MM-dd-yyyy"));
432
433 clearText("//input[@name='field75']");
434 selenium.type("//input[@name='field75']", "12-12-2034");
435 selenium.focus("//input[@name='field82']");
436 Thread.sleep(100);
437 assertTrue(! selenium.isTextPresent("Must be a date in the following format(s): MM/dd/yy, MM/dd/yyyy, MM-dd-yy, MM-dd-yyyy"));
438
439
440
441 clearText("//input[@name='field82']");
442 selenium.type("//input[@name='field82']", "13:00:12");
443 selenium.focus("//input[@name='field83']");
444 Thread.sleep(100);
445 assertTrue(selenium.isTextPresent("Must be a valid 12 hour time in HH:mm format, seconds are optional"));
446
447 clearText("//input[@name='field82']");
448 selenium.type("//input[@name='field82']", "09:00:");
449 selenium.focus("//input[@name='field83']");
450 Thread.sleep(100);
451 assertTrue(selenium.isTextPresent("Must be a valid 12 hour time in HH:mm format, seconds are optional"));
452
453 clearText("//input[@name='field82']");
454 selenium.type("//input[@name='field82']", "3-00:12");
455 selenium.focus("//input[@name='field83']");
456 Thread.sleep(100);
457 assertTrue(selenium.isTextPresent("Must be a valid 12 hour time in HH:mm format, seconds are optional"));
458
459 clearText("//input[@name='field82']");
460 selenium.type("//input[@name='field82']", "3:00:34");
461 selenium.focus("//input[@name='field83']");
462 Thread.sleep(100);
463 assertTrue(! selenium.isTextPresent("Must be a valid 12 hour time in HH:mm format, seconds are optional"));
464
465 clearText("//input[@name='field82']");
466 selenium.type("//input[@name='field82']", "3:00");
467 selenium.focus("//input[@name='field83']");
468 Thread.sleep(100);
469 assertTrue(! selenium.isTextPresent("Must be a valid 12 hour time in HH:mm format, seconds are optional"));
470
471
472
473 clearText("//input[@name='field83']");
474 selenium.type("//input[@name='field83']", "24:00:12");
475 selenium.focus("//input[@name='field56']");
476 Thread.sleep(100);
477 assertTrue(selenium.isTextPresent("Must be a valid 24 hour (0-23) time in HH:mm format, seconds are optional"));
478
479 clearText("//input[@name='field83']");
480 selenium.type("//input[@name='field83']", "14:00:");
481 selenium.focus("//input[@name='field56']");
482 Thread.sleep(100);
483 assertTrue(selenium.isTextPresent("Must be a valid 24 hour (0-23) time in HH:mm format, seconds are optional"));
484
485 clearText("//input[@name='field83']");
486 selenium.type("//input[@name='field83']", "13:00:76");
487 selenium.focus("//input[@name='field56']");
488 Thread.sleep(100);
489 assertTrue(selenium.isTextPresent("Must be a valid 24 hour (0-23) time in HH:mm format, seconds are optional"));
490
491 clearText("//input[@name='field83']");
492 selenium.type("//input[@name='field83']", "13:00:23");
493 selenium.focus("//input[@name='field56']");
494 Thread.sleep(100);
495 assertTrue(! selenium.isTextPresent("Must be a valid 24 hour (0-23) time in HH:mm format, seconds are optional"));
496
497 clearText("//input[@name='field83']");
498 selenium.type("//input[@name='field83']", "23:00:12");
499 selenium.focus("//input[@name='field56']");
500 Thread.sleep(100);
501 assertTrue(! selenium.isTextPresent("Must be a valid 24 hour (0-23) time in HH:mm format, seconds are optional"));
502
503
504
505
506
507 clearText("//input[@name='field56']");
508 selenium.type("//input[@name='field56']", "1000-12-12 12:12:12.103");
509 selenium.focus("//input[@name='field57']");
510 Thread.sleep(100);
511 assertTrue(selenium.isTextPresent("Must be a date/time in the format of yyyy-mm-dd hh:mm:ss.ms, between the years of 1900 and 2099, inclusive. \"ms\" represents milliseconds, and must be included."));
512
513 clearText("//input[@name='field56']");
514 selenium.type("//input[@name='field56']", "2000/12/12 12-12-12.87");
515 selenium.focus("//input[@name='field57']");
516 Thread.sleep(100);
517 assertTrue(selenium.isTextPresent("Must be a date/time in the format of yyyy-mm-dd hh:mm:ss.ms, between the years of 1900 and 2099, inclusive. \"ms\" represents milliseconds, and must be included."));
518
519 clearText("//input[@name='field56']");
520 selenium.type("//input[@name='field56']", "2000/12/12 12-12-12.87");
521 selenium.focus("//input[@name='field57']");
522 Thread.sleep(100);
523 assertTrue(selenium.isTextPresent("Must be a date/time in the format of yyyy-mm-dd hh:mm:ss.ms, between the years of 1900 and 2099, inclusive. \"ms\" represents milliseconds, and must be included."));
524
525 clearText("//input[@name='field56']");
526 selenium.type("//input[@name='field56']", "2011-08-12 12:12:12");
527 selenium.focus("//input[@name='field57']");
528 Thread.sleep(100);
529 assertTrue(selenium.isTextPresent("Must be a date/time in the format of yyyy-mm-dd hh:mm:ss.ms, between the years of 1900 and 2099, inclusive. \"ms\" represents milliseconds, and must be included."));
530
531
532
533
534
535
536
537
538
539
540 clearText("//input[@name='field56']");
541 selenium.type("//input[@name='field56']", "2099-12-12 12:12:12.103");
542 selenium.focus("//input[@name='field57']");
543 Thread.sleep(100);
544 assertTrue(! selenium.isTextPresent("Must be a date/time in the format of yyyy-mm-dd hh:mm:ss.ms, between the years of 1900 and 2099, inclusive. \"ms\" represents milliseconds, and must be included."));
545
546
547
548 clearText("//input[@name='field57']");
549 selenium.type("//input[@name='field57']", "1599");
550 selenium.focus("//input[@name='field58']");
551 Thread.sleep(100);
552 assertTrue(selenium.isTextPresent("Must be a four digit year between 1600 to 2199, inclusive."));
553
554 clearText("//input[@name='field57']");
555 selenium.type("//input[@name='field57']", "2200");
556 selenium.focus("//input[@name='field58']");
557 Thread.sleep(100);
558 assertTrue(selenium.isTextPresent("Must be a four digit year between 1600 to 2199, inclusive."));
559
560 clearText("//input[@name='field57']");
561 selenium.type("//input[@name='field57']", "20000");
562 selenium.focus("//input[@name='field58']");
563 Thread.sleep(100);
564 assertTrue(selenium.isTextPresent("Must be a four digit year between 1600 to 2199, inclusive."));
565
566 clearText("//input[@name='field57']");
567 selenium.type("//input[@name='field57']", "-202");
568 selenium.focus("//input[@name='field58']");
569 Thread.sleep(100);
570 assertTrue(selenium.isTextPresent("Must be a four digit year between 1600 to 2199, inclusive."));
571
572 clearText("//input[@name='field57']");
573 selenium.type("//input[@name='field57']", "2000");
574 selenium.focus("//input[@name='field58']");
575 Thread.sleep(100);
576 assertTrue(! selenium.isTextPresent("Must be a four digit year between 1600 to 2199, inclusive."));
577
578
579 clearText("//input[@name='field58']");
580 selenium.type("//input[@name='field58']", "0");
581 selenium.focus("//input[@name='field61']");
582 Thread.sleep(100);
583 assertTrue(selenium.isTextPresent("Must be 1 to 12, representing a month."));
584
585 clearText("//input[@name='field58']");
586 selenium.type("//input[@name='field58']", "-12");
587 selenium.focus("//input[@name='field61']");
588 Thread.sleep(100);
589 assertTrue(selenium.isTextPresent("Must be 1 to 12, representing a month."));
590
591 clearText("//input[@name='field58']");
592 selenium.type("//input[@name='field58']", "100");
593 selenium.focus("//input[@name='field61']");
594 Thread.sleep(100);
595 assertTrue(selenium.isTextPresent("Must be 1 to 12, representing a month."));
596
597 clearText("//input[@name='field58']");
598 selenium.type("//input[@name='field58']", "12");
599 selenium.focus("//input[@name='field61']");
600 Thread.sleep(100);
601 assertTrue(! selenium.isTextPresent("Must be 1 to 12, representing a month."));
602
603
604
605
606 clearText("//input[@name='field61']");
607 selenium.type("//input[@name='field61']", "123");
608 selenium.focus("//input[@name='field62']");
609 Thread.sleep(100);
610 assertTrue(selenium.isTextPresent("Must be a ZIP code. ZIP + 4 codes are also accepted."));
611
612 clearText("//input[@name='field61']");
613 selenium.type("//input[@name='field61']", "2341 12");
614 selenium.focus("//input[@name='field62']");
615 Thread.sleep(100);
616 assertTrue(selenium.isTextPresent("Must be a ZIP code. ZIP + 4 codes are also accepted."));
617
618 clearText("//input[@name='field61']");
619 selenium.type("//input[@name='field61']", "0-1231");
620 selenium.focus("//input[@name='field62']");
621 Thread.sleep(100);
622 assertTrue(selenium.isTextPresent("Must be a ZIP code. ZIP + 4 codes are also accepted."));
623
624 clearText("//input[@name='field61']");
625 selenium.type("//input[@name='field61']", "12345");
626 selenium.focus("//input[@name='field62']");
627 Thread.sleep(100);
628 assertTrue(! selenium.isTextPresent("Must be a ZIP code. ZIP + 4 codes are also accepted."));
629
630
631
632 clearText("//input[@name='field62']");
633 selenium.type("//input[@name='field62']", "123 23 @#");
634 selenium.focus("//input[@name='field63']");
635 Thread.sleep(100);
636 assertTrue(selenium.isTextPresent("Can only be alphanumeric characters "));
637
638 clearText("//input[@name='field62']");
639 selenium.type("//input[@name='field62']", "-asd123");
640 selenium.focus("//input[@name='field63']");
641 Thread.sleep(100);
642 assertTrue(selenium.isTextPresent("Can only be alphanumeric characters "));
643
644 clearText("//input[@name='field62']");
645 selenium.type("//input[@name='field62']", "asd/123");
646 selenium.focus("//input[@name='field63']");
647 Thread.sleep(100);
648 assertTrue(selenium.isTextPresent("Can only be alphanumeric characters "));
649
650 clearText("//input[@name='field62']");
651 selenium.type("//input[@name='field62']", "asd123");
652 selenium.focus("//input[@name='field63']");
653 Thread.sleep(100);
654 assertTrue(! selenium.isTextPresent("Can only be alphanumeric characters "));
655
656
657 clearText("//input[@name='field63']");
658 selenium.type("//input[@name='field63']", "123^we");
659 selenium.focus("//input[@name='field64']");
660 Thread.sleep(100);
661 assertTrue(selenium.isTextPresent("Can only be alphanumeric characters, whitespace, underscores, forward slashes "));
662
663 clearText("//input[@name='field63']");
664 selenium.type("//input[@name='field63']", "-123_asd");
665 selenium.focus("//input[@name='field64']");
666 Thread.sleep(100);
667 assertTrue(selenium.isTextPresent("Can only be alphanumeric characters, whitespace, underscores, forward slashes "));
668
669 clearText("//input[@name='field63']");
670 selenium.type("//input[@name='field63']", "123 23 @#");
671 selenium.focus("//input[@name='field64']");
672 Thread.sleep(100);
673 assertTrue(selenium.isTextPresent("Can only be alphanumeric characters, whitespace, underscores, forward slashes "));
674
675 clearText("//input[@name='field63']");
676 selenium.type("//input[@name='field63']", "as_de 456/123");
677 selenium.focus("//input[@name='field64']");
678 Thread.sleep(100);
679 assertTrue(! selenium.isTextPresent("Can only be alphanumeric characters, whitespace, underscores, forward slashes "));
680
681
682 clearText("//input[@name='field64']");
683 selenium.type("//input[@name='field64']", "123^we");
684 selenium.focus("//input[@name='field76']");
685 Thread.sleep(100);
686 assertTrue(selenium.isTextPresent("Can only be alpha characters, whitespace, commas"));
687
688 clearText("//input[@name='field64']");
689 selenium.type("//input[@name='field64']", "asd_pqr");
690 selenium.focus("//input[@name='field76']");
691 Thread.sleep(100);
692 assertTrue(selenium.isTextPresent("Can only be alpha characters, whitespace, commas"));
693
694 clearText("//input[@name='field64']");
695 selenium.type("//input[@name='field64']", "asd/def");
696 selenium.focus("//input[@name='field76']");
697 Thread.sleep(100);
698 assertTrue(selenium.isTextPresent("Can only be alpha characters, whitespace, commas"));
699
700 clearText("//input[@name='field64']");
701 selenium.type("//input[@name='field64']", "asd ,pqr");
702 selenium.focus("//input[@name='field76']");
703 Thread.sleep(100);
704 assertTrue(! selenium.isTextPresent("Can only be alpha characters, whitespace, commas"));
705
706
707
708 clearText("//input[@name='field76']");
709 selenium.type("//input[@name='field76']", "123");
710 selenium.focus("//input[@name='field65']");
711 Thread.sleep(100);
712 assertTrue(selenium.isTextPresent("Can only be alpha characters, whitespace, underscores, periods, parentheses, dollar signs, forward slashes, double quotes, apostrophes, commas, colons, null, question marks, exclaimation marks, dashes, plus signs, equals signs, *, @, %, #"));
713
714 clearText("//input[@name='field76']");
715 selenium.type("//input[@name='field76']", "<abcd>");
716 selenium.focus("//input[@name='field65']");
717 Thread.sleep(100);
718 assertTrue(selenium.isTextPresent("Can only be alpha characters, whitespace, underscores, periods, parentheses, dollar signs, forward slashes, double quotes, apostrophes, commas, colons, null, question marks, exclaimation marks, dashes, plus signs, equals signs, *, @, %, #"));
719
720 clearText("//input[@name='field76']");
721 selenium.type("//input[@name='field76']", "|abcd|");
722 selenium.focus("//input[@name='field65']");
723 Thread.sleep(100);
724 assertTrue(selenium.isTextPresent("Can only be alpha characters, whitespace, underscores, periods, parentheses, dollar signs, forward slashes, double quotes, apostrophes, commas, colons, null, question marks, exclaimation marks, dashes, plus signs, equals signs, *, @, %, #"));
725
726 clearText("//input[@name='field76']");
727 selenium.type("//input[@name='field76']", "~abcd~");
728 selenium.focus("//input[@name='field65']");
729 Thread.sleep(100);
730 assertTrue(selenium.isTextPresent("Can only be alpha characters, whitespace, underscores, periods, parentheses, dollar signs, forward slashes, double quotes, apostrophes, commas, colons, null, question marks, exclaimation marks, dashes, plus signs, equals signs, *, @, %, #"));
731
732 clearText("//input[@name='field76']");
733 selenium.type("//input[@name='field76']", " ab_c d_ef ");
734 selenium.focus("//input[@name='field65']");
735 Thread.sleep(100);
736 assertTrue(! selenium.isTextPresent("Can only be alpha characters, whitespace, underscores, periods, parentheses, dollar signs, forward slashes, double quotes, apostrophes, commas, colons, null, question marks, exclaimation marks, dashes, plus signs, equals signs, *, @, %, #"));
737
738
739
740 clearText("//input[@name='field65']");
741 selenium.type("//input[@name='field65']", "123 ^we");
742 selenium.focus("//input[@name='field66']");
743 Thread.sleep(100);
744 assertTrue(selenium.isTextPresent("Must not contain any whitespace (spaces, returns, etc)"));
745
746 clearText("//input[@name='field65']");
747 selenium.type("//input[@name='field65']", "123^we!@#^&*~:");
748 selenium.focus("//input[@name='field66']");
749 Thread.sleep(100);
750 assertTrue(! selenium.isTextPresent("Must not contain any whitespace (spaces, returns, etc)"));
751
752
753 clearText("//input[@name='field66']");
754 selenium.type("//input[@name='field66']", "123 ^we");
755 selenium.focus("//input[@name='field67']");
756 Thread.sleep(100);
757 assertTrue(selenium.isTextPresent("Can be any of the following characters: abcABC"));
758
759 clearText("//input[@name='field66']");
760 selenium.type("//input[@name='field66']", "123_^we");
761 selenium.focus("//input[@name='field67']");
762 Thread.sleep(100);
763 assertTrue(selenium.isTextPresent("Can be any of the following characters: abcABC"));
764
765 clearText("//input[@name='field66']");
766 selenium.type("//input[@name='field66']", "abc ABC");
767 selenium.focus("//input[@name='field67']");
768 Thread.sleep(100);
769 assertTrue(selenium.isTextPresent("Can be any of the following characters: abcABC"));
770
771 clearText("//input[@name='field66']");
772 selenium.type("//input[@name='field66']", "aAbBcC");
773 selenium.focus("//input[@name='field67']");
774 Thread.sleep(100);
775 assertTrue(! selenium.isTextPresent("Can be any of the following characters: abcABC"));
776
777
778 clearText("//input[@name='field67']");
779 selenium.type("//input[@name='field67']", "123 ^we");
780 selenium.focus("//input[@name='field68']");
781 Thread.sleep(100);
782 assertTrue(selenium.isTextPresent("Can only be numeric characters, parentheses, dashes"));
783
784 clearText("//input[@name='field67']");
785 selenium.type("//input[@name='field67']", "123/10");
786 selenium.focus("//input[@name='field68']");
787 Thread.sleep(100);
788 assertTrue(selenium.isTextPresent("Can only be numeric characters, parentheses, dashes"));
789
790 clearText("//input[@name='field67']");
791 selenium.type("//input[@name='field67']", "(123.00)");
792 selenium.focus("//input[@name='field68']");
793 Thread.sleep(100);
794 assertTrue(selenium.isTextPresent("Can only be numeric characters, parentheses, dashes"));
795
796 clearText("//input[@name='field67']");
797 selenium.type("//input[@name='field67']", "(12-3)");
798 selenium.focus("//input[@name='field68']");
799 Thread.sleep(100);
800 assertTrue(! selenium.isTextPresent("Can only be numeric characters, parentheses, dashes"));
801
802
803 clearText("//input[@name='field68']");
804 selenium.type("//input[@name='field68']", "123.123");
805 selenium.focus("//input[@name='field67']");
806 Thread.sleep(100);
807 assertTrue(selenium.isTextPresent("only 1 alpha character followed by a period and then followed by 1 number (a.8, b.0, etc)"));
808
809 clearText("//input[@name='field68']");
810 selenium.type("//input[@name='field68']", "a.b");
811 selenium.focus("//input[@name='field67']");
812 Thread.sleep(100);
813 assertTrue(selenium.isTextPresent("only 1 alpha character followed by a period and then followed by 1 number (a.8, b.0, etc)"));
814
815 clearText("//input[@name='field68']");
816 selenium.type("//input[@name='field68']", "123 qwe");
817 selenium.focus("//input[@name='field67']");
818 Thread.sleep(100);
819 assertTrue(selenium.isTextPresent("only 1 alpha character followed by a period and then followed by 1 number (a.8, b.0, etc)"));
820
821 clearText("//input[@name='field68']");
822 selenium.type("//input[@name='field68']", "5.a");
823 selenium.focus("//input[@name='field67']");
824 Thread.sleep(100);
825 assertTrue(selenium.isTextPresent("only 1 alpha character followed by a period and then followed by 1 number (a.8, b.0, etc)"));
826
827 clearText("//input[@name='field68']");
828 selenium.type("//input[@name='field68']", "a.0,b.4");
829 selenium.focus("//input[@name='field67']");
830 Thread.sleep(100);
831 assertTrue(selenium.isTextPresent("only 1 alpha character followed by a period and then followed by 1 number (a.8, b.0, etc)"));
832
833
834 clearText("//input[@name='field68']");
835 selenium.type("//input[@name='field68']", "a.0");
836 selenium.focus("//input[@name='field67']");
837 Thread.sleep(100);
838 assertTrue(! selenium.isTextPresent("only 1 alpha character followed by a period and then followed by 1 number (a.8, b.0, etc)"));
839 }
840
841 @After
842 public void tearDown() throws Exception {
843 selenium.stop();
844 }
845
846 public void clearText(String field) throws Exception {
847 selenium.focus(field);
848 selenium.type(field, "");
849 Thread.sleep(100);
850 }
851 }