001 /** 002 * Copyright 2005-2011 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package edu.samplu.travel.krad.test; 017 018 import com.thoughtworks.selenium.DefaultSelenium; 019 import com.thoughtworks.selenium.Selenium; 020 import org.junit.After; 021 import org.junit.Before; 022 import org.junit.Test; 023 024 import static org.junit.Assert.assertEquals; 025 import static org.junit.Assert.assertTrue; 026 027 /** 028 * tests that regex validation works as expected on input fields where it is configured 029 * 030 * @author Kuali Rice Team (rice.collab@kuali.org) 031 */ 032 public class UIFComponentValidationRegexPatternIT { 033 private Selenium selenium; 034 035 @Before 036 public void setUp() throws Exception { 037 selenium = new DefaultSelenium("localhost", 4444, "*firefox", System.getProperty("remote.public.url")); 038 selenium.start(); 039 } 040 041 @Test 042 public void testValidCharacterConstraint() throws Exception { 043 044 /* 045 * Timestamp pattern validation message says it allows years from 1900 - 2099 046 * In fact it also allows 2999 as the upper limit. This needs to be sorted out. 047 * Test failing this condition is commented in the below code section for Timestamp Validation. Once resolved can be uncommented 048 * 049 */ 050 051 selenium.open(System.getProperty("remote.public.url")); 052 assertEquals("Login", selenium.getTitle()); 053 selenium.type("__login_user", "admin"); 054 selenium.click("//input[@value='Login']"); 055 selenium.waitForPageToLoad("50000"); 056 assertEquals("Kuali Portal Index", selenium.getTitle()); 057 selenium.click("link=KRAD"); 058 selenium.waitForPageToLoad("30000"); 059 selenium.click("link=Uif Components (Kitchen Sink)"); 060 selenium.waitForPageToLoad("50000"); 061 assertEquals("Kuali Portal Index", selenium.getTitle()); 062 selenium.selectFrame("iframeportlet"); 063 selenium.click("link=Validation - Regex"); 064 //selenium.waitForPageToLoad("30000"); 065 Thread.sleep(5000); 066 067 068 //---------------------------------------------Fixed Point------------------------------// 069 clearText("//input[@name='field50']"); 070 selenium.type("//input[@name='field50']", "127.344"); 071 selenium.focus("//input[@name='field51']"); 072 Thread.sleep(100); 073 assertTrue(selenium.isTextPresent("Must be a positive fixed point number, with 5 max digits and 2 digits to the right of the decimal point")); 074 075 clearText("//input[@name='field50']"); 076 selenium.type("//input[@name='field50']", "1234.4"); 077 selenium.focus("//input[@name='field51']"); 078 Thread.sleep(100); 079 assertTrue(selenium.isTextPresent("Must be a positive fixed point number, with 5 max digits and 2 digits to the right of the decimal point")); 080 081 clearText("//input[@name='field50']"); 082 selenium.type("//input[@name='field50']", "1234.434"); 083 selenium.focus("//input[@name='field51']"); 084 Thread.sleep(100); 085 assertTrue(selenium.isTextPresent("Must be a positive fixed point number, with 5 max digits and 2 digits to the right of the decimal point")); 086 087 clearText("//input[@name='field50']"); 088 selenium.type("//input[@name='field50']", "123.67"); 089 selenium.focus("//input[@name='field51']"); 090 Thread.sleep(100); 091 assertTrue(! selenium.isTextPresent("Must be a positive fixed point number, with 5 max digits and 2 digits to the right of the decimal point")); 092 093 //---------------------------------------------Floating Point------------------------------// 094 clearText("//input[@name='field51']"); 095 selenium.type("//input[@name='field51']", "127."); 096 selenium.focus("//input[@name='field77']"); 097 Thread.sleep(100); 098 assertTrue(selenium.isTextPresent("Must be a positive or negative number, with any number of digits to the right of the decimal.")); 099 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 //---------------------------------------------Integer Pattern constraint------------------------------// 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 //---------------------------------------------Phone Text------------------------------// 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 //---------------------------------------------JavaClass Text------------------------------// 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 //---------------------------------------------Email Text------------------------------// 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 //---------------------------------------------URL pattern Text------------------------------// 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 //---------------------------------------------Date pattern Text------------------------------// 296 //-------------invalid formats 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 //-------------valid formats 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 //---------------------------------------------BasicDate pattern Text------------------------------// 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 //---------------------------------------------Time12H Pattern Text------------------------------// 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 //---------------------------------------------Time24H Pattern Text------------------------------// 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 //---------------------------------------------Timestamp pattern Text------------------------------// 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 //--------this should not be allowed 532 /* 533 clearTimeStampText(); 534 selenium.type("//input[@name='field56']", "2999-12-12 12:12:12.103"); 535 selenium.focus("//input[@name='field57']"); 536 Thread.sleep(100); 537 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.")); 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 //---------------------------------------------Year Pattern Text------------------------------// 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 //---------------------------------------------Month Pattern Text------------------------------// 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 //---------------------------------------------ZipCode Pattern Text------------------------------// 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 //---------------------------------------------Alpha Numeric w/o options Text------------------------------// 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 //---------------------------------------------Alpha Numeric with options Text------------------------------// 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 //---------------------------------------------Alpha with Whitespace and commas Text------------------------------// 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 //---------------------------------------------AlphaPatterrn with disallowed charset Text------------------------------// 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 //---------------------------------------------Anything with No Whitespace Text------------------------------// 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 //---------------------------------------------CharacterSet Text------------------------------// 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 //---------------------------------------------Numeric Character Text------------------------------// 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 //---------------------------------------------Valid Chars Custom Text------------------------------// 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 }