001 /*
002 * Copyright 2006-2012 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
017 package edu.samplu.krad.compview;
018
019 import edu.samplu.common.WebDriverLegacyITBase;
020
021 import junit.framework.Assert;
022 import org.junit.Test;
023
024 /**
025 * @author Kuali Rice Team (rice.collab@kuali.org)
026 */
027 public class ValidCharsConstraintLegacyIT extends WebDriverLegacyITBase {
028 @Override
029 public String getTestUrl() {
030 return "/kr-krad/uicomponents?viewId=UifCompView&methodToCall=start&pageId=UifCompView-Page4";
031 }
032
033 @Test
034 public void testValidCharsConstraintIT() throws Exception {
035 fireEvent("field50","focus");
036 waitAndTypeByName("field50", "12.333");
037 fireEvent("field50", "blur");
038 Assert.assertTrue(getAttributeByName("field50","class").matches("^[\\s\\S]*error[\\s\\S]*$"));
039 fireEvent("field50","focus");
040 waitAndTypeByName("field50", "123.33");
041 fireEvent("field50", "blur");
042 Assert.assertTrue(getAttributeByName("field50","class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
043 fireEvent("field51","focus");
044 waitAndTypeByName("field51", "A");
045 fireEvent("field51", "blur");
046 Assert.assertTrue(getAttributeByName("field51","class").matches("^[\\s\\S]*error[\\s\\S]*$"));
047 fireEvent("field51","focus");
048 waitAndTypeByName("field51", "-123.33");
049 fireEvent("field51", "blur");
050 Assert.assertTrue(getAttributeByName("field51","class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
051 fireEvent("field77","focus");
052 waitAndTypeByName("field77", "1.1");
053 fireEvent("field77", "blur");
054 Assert.assertTrue(getAttributeByName("field77","class").matches("^[\\s\\S]*error[\\s\\S]*$"));
055 fireEvent("field77","focus");
056 waitAndTypeByName("field77", "12");
057 fireEvent("field77", "blur");
058 Assert.assertTrue(getAttributeByName("field77","class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
059 fireEvent("field52","focus");
060 waitAndTypeByName("field52", "5551112222");
061 fireEvent("field52", "blur");
062 Assert.assertTrue(getAttributeByName("field52","class").matches("^[\\s\\S]*error[\\s\\S]*$"));
063 fireEvent("field52","focus");
064 waitAndTypeByName("field52", "555-111-1111");
065 fireEvent("field52", "blur");
066 Assert.assertTrue(getAttributeByName("field52","class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
067 fireEvent("field53","focus");
068 waitAndTypeByName("field53", "1ClassName.java");
069 fireEvent("field53", "blur");
070 Assert.assertTrue(getAttributeByName("field53","class").matches("^[\\s\\S]*error[\\s\\S]*$"));
071 fireEvent("field53","focus");
072 waitAndTypeByName("field53", "ClassName.java");
073 fireEvent("field53", "blur");
074 Assert.assertTrue(getAttributeByName("field53","class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
075 fireEvent("field54","focus");
076 waitAndTypeByName("field54", "aaaaa");
077 fireEvent("field54", "blur");
078 Assert.assertTrue(getAttributeByName("field54","class").matches("^[\\s\\S]*error[\\s\\S]*$"));
079 fireEvent("field54","focus");
080 waitAndTypeByName("field54", "aaaaa@kuali.org");
081 fireEvent("field54", "blur");
082 Assert.assertTrue(getAttributeByName("field54","class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
083 fireEvent("field84","focus");
084 waitAndTypeByName("field84", "aaaaa");
085 fireEvent("field84", "blur");
086 Assert.assertTrue(getAttributeByName("field84","class").matches("^[\\s\\S]*error[\\s\\S]*$"));
087 fireEvent("field84","focus");
088 waitAndTypeByName("field84", "http://www.kuali.org");
089 fireEvent("field84", "blur");
090 Assert.assertTrue(getAttributeByName("field84","class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
091 fireEvent("field55","focus");
092 waitAndTypeByName("field55", "023512");
093 fireEvent("field55", "blur");
094 Assert.assertTrue(getAttributeByName("field55","class").matches("^[\\s\\S]*error[\\s\\S]*$"));
095 fireEvent("field55","focus");
096 waitAndTypeByName("field55", "022812");
097 fireEvent("field55", "blur");
098 Assert.assertTrue(getAttributeByName("field55","class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
099 fireEvent("field75","focus");
100 waitAndTypeByName("field75", "02/35/12");
101 fireEvent("field75", "blur");
102 Assert.assertTrue(getAttributeByName("field75","class").matches("^[\\s\\S]*error[\\s\\S]*$"));
103 fireEvent("field75","focus");
104 waitAndTypeByName("field75", "02/28/12");
105 fireEvent("field75", "blur");
106 Assert.assertTrue(getAttributeByName("field75","class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
107 fireEvent("field82","focus");
108 waitAndTypeByName("field82", "13:22");
109 fireEvent("field82", "blur");
110 Assert.assertTrue(getAttributeByName("field82","class").matches("^[\\s\\S]*error[\\s\\S]*$"));
111 fireEvent("field82","focus");
112 waitAndTypeByName("field82", "02:33");
113 fireEvent("field82", "blur");
114 Assert.assertTrue(getAttributeByName("field82","class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
115 fireEvent("field83","focus");
116 waitAndTypeByName("field83", "25:22");
117 fireEvent("field83", "blur");
118 Assert.assertTrue(getAttributeByName("field83","class").matches("^[\\s\\S]*error[\\s\\S]*$"));
119 fireEvent("field83","focus");
120 waitAndTypeByName("field83", "14:33");
121 fireEvent("field83", "blur");
122 Assert.assertTrue(getAttributeByName("field83","class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
123 fireEvent("field57","focus");
124 waitAndTypeByName("field57", "0");
125 fireEvent("field57", "blur");
126 Assert.assertTrue(getAttributeByName("field57","class").matches("^[\\s\\S]*error[\\s\\S]*$"));
127 fireEvent("field57","focus");
128 waitAndTypeByName("field57", "2020");
129 fireEvent("field57", "blur");
130 Assert.assertTrue(getAttributeByName("field57","class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
131 fireEvent("field58","focus");
132 waitAndTypeByName("field58", "13");
133 fireEvent("field58", "blur");
134 Assert.assertTrue(getAttributeByName("field58","class").matches("^[\\s\\S]*error[\\s\\S]*$"));
135 fireEvent("field58","focus");
136 waitAndTypeByName("field58", "12");
137 fireEvent("field58", "blur");
138 Assert.assertTrue(getAttributeByName("field58","class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
139 fireEvent("field61","focus");
140 waitAndTypeByName("field61", "5555-444");
141 fireEvent("field61", "blur");
142 Assert.assertTrue(getAttributeByName("field61","class").matches("^[\\s\\S]*error[\\s\\S]*$"));
143 fireEvent("field61","focus");
144 waitAndTypeByName("field61", "55555-4444");
145 fireEvent("field61", "blur");
146 Assert.assertTrue(getAttributeByName("field61","class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
147 fireEvent("field62","focus");
148 waitAndTypeByName("field62", "aa5bb6_a");
149 fireEvent("field62", "blur");
150 Assert.assertTrue(getAttributeByName("field62","class").matches("^[\\s\\S]*error[\\s\\S]*$"));
151 fireEvent("field62","focus");
152 waitAndTypeByName("field62", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890");
153 fireEvent("field62", "blur");
154 Assert.assertTrue(getAttributeByName("field62","class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
155 fireEvent("field63","focus");
156 waitAndTypeByName("field63", "fff555$");
157 fireEvent("field63", "blur");
158 Assert.assertTrue(getAttributeByName("field63","class").matches("^[\\s\\S]*error[\\s\\S]*$"));
159 fireEvent("field63","focus");
160 waitAndTypeByName("field63", "aa22 _/");
161 fireEvent("field63", "blur");
162 Assert.assertTrue(getAttributeByName("field63","class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
163 fireEvent("field64","focus");
164 waitAndTypeByName("field64", "AABB55");
165 fireEvent("field64", "blur");
166 Assert.assertTrue(getAttributeByName("field64","class").matches("^[\\s\\S]*error[\\s\\S]*$"));
167 fireEvent("field64","focus");
168 waitAndTypeByName("field64", "ABCDEFGHIJKLMNOPQRSTUVWXY,Z abcdefghijklmnopqrstuvwxy,z");
169 fireEvent("field64", "blur");
170 Assert.assertTrue(getAttributeByName("field64","class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
171 fireEvent("field76","focus");
172 waitAndTypeByName("field76", "AA~BB%");
173 fireEvent("field76", "blur");
174 Assert.assertTrue(getAttributeByName("field76","class").matches("^[\\s\\S]*error[\\s\\S]*$"));
175 fireEvent("field76","focus");
176 waitAndTypeByName("field76", "abcABC %$#@&<>\\{}[]*-+!=.()/\"\"',:;?");
177 fireEvent("field76", "blur");
178 Assert.assertTrue(getAttributeByName("field76","class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
179 fireEvent("field65","focus");
180 waitAndTypeByName("field65", "sdfs$#$# dsffs");
181 fireEvent("field65", "blur");
182 Assert.assertTrue(getAttributeByName("field65","class").matches("^[\\s\\S]*error[\\s\\S]*$"));
183 fireEvent("field65","focus");
184 waitAndTypeByName("field65", "sdfs$#$#sffs");
185 fireEvent("field65", "blur");
186 Assert.assertTrue(getAttributeByName("field65","class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
187 fireEvent("field66","focus");
188 waitAndTypeByName("field66", "abcABCD");
189 fireEvent("field66", "blur");
190 Assert.assertTrue(getAttributeByName("field66","class").matches("^[\\s\\S]*error[\\s\\S]*$"));
191 fireEvent("field66","focus");
192 waitAndTypeByName("field66", "ABCabc");
193 fireEvent("field66", "blur");
194 Assert.assertTrue(getAttributeByName("field66","class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
195 fireEvent("field67","focus");
196 waitAndTypeByName("field67", "(111)B-(222)A");
197 fireEvent("field67", "blur");
198 Assert.assertTrue(getAttributeByName("field67","class").matches("^[\\s\\S]*error[\\s\\S]*$"));
199 fireEvent("field67","focus");
200 waitAndTypeByName("field67", "(12345)-(67890)");
201 fireEvent("field67", "blur");
202 Assert.assertTrue(getAttributeByName("field67","class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
203 fireEvent("field68","focus");
204 waitAndTypeByName("field68", "A.66");
205 fireEvent("field68", "blur");
206 Assert.assertTrue(getAttributeByName("field68","class").matches("^[\\s\\S]*error[\\s\\S]*$"));
207 fireEvent("field68","focus");
208 waitAndTypeByName("field68", "a.4");
209 fireEvent("field68", "blur");
210 Assert.assertTrue(getAttributeByName("field68","class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
211 fireEvent("field56","focus");
212 waitAndTypeByName("field56", "2020-06-02");
213 fireEvent("field56", "blur");
214 Assert.assertTrue(getAttributeByName("field56","class").matches("^[\\s\\S]*error[\\s\\S]*$"));
215 fireEvent("field56","focus");
216 waitAndTypeByName("field56", "2020-06-02 03:30:30.22");
217 fireEvent("field56", "blur");
218 Assert.assertTrue(getAttributeByName("field56","class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
219 passed();
220 }
221 }