1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package edu.samplu.krad.compview;
18
19 import edu.samplu.common.WebDriverLegacyITBase;
20
21 import junit.framework.Assert;
22 import org.junit.Test;
23
24
25
26
27 public class ValidCharsConstraintLegacyIT extends WebDriverLegacyITBase {
28 @Override
29 public String getTestUrl() {
30 return "/kr-krad/uicomponents?viewId=UifCompView&methodToCall=start&pageId=UifCompView-Page4";
31 }
32
33 @Test
34 public void testValidCharsConstraintIT() throws Exception {
35 fireEvent("field50","focus");
36 waitAndTypeByName("field50", "12.333");
37 fireEvent("field50", "blur");
38 Assert.assertTrue(getAttributeByName("field50","class").matches("^[\\s\\S]*error[\\s\\S]*$"));
39 fireEvent("field50","focus");
40 waitAndTypeByName("field50", "123.33");
41 fireEvent("field50", "blur");
42 Assert.assertTrue(getAttributeByName("field50","class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
43 fireEvent("field51","focus");
44 waitAndTypeByName("field51", "A");
45 fireEvent("field51", "blur");
46 Assert.assertTrue(getAttributeByName("field51","class").matches("^[\\s\\S]*error[\\s\\S]*$"));
47 fireEvent("field51","focus");
48 waitAndTypeByName("field51", "-123.33");
49 fireEvent("field51", "blur");
50 Assert.assertTrue(getAttributeByName("field51","class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
51 fireEvent("field77","focus");
52 waitAndTypeByName("field77", "1.1");
53 fireEvent("field77", "blur");
54 Assert.assertTrue(getAttributeByName("field77","class").matches("^[\\s\\S]*error[\\s\\S]*$"));
55 fireEvent("field77","focus");
56 waitAndTypeByName("field77", "12");
57 fireEvent("field77", "blur");
58 Assert.assertTrue(getAttributeByName("field77","class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
59 fireEvent("field52","focus");
60 waitAndTypeByName("field52", "5551112222");
61 fireEvent("field52", "blur");
62 Assert.assertTrue(getAttributeByName("field52","class").matches("^[\\s\\S]*error[\\s\\S]*$"));
63 fireEvent("field52","focus");
64 waitAndTypeByName("field52", "555-111-1111");
65 fireEvent("field52", "blur");
66 Assert.assertTrue(getAttributeByName("field52","class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
67 fireEvent("field53","focus");
68 waitAndTypeByName("field53", "1ClassName.java");
69 fireEvent("field53", "blur");
70 Assert.assertTrue(getAttributeByName("field53","class").matches("^[\\s\\S]*error[\\s\\S]*$"));
71 fireEvent("field53","focus");
72 waitAndTypeByName("field53", "ClassName.java");
73 fireEvent("field53", "blur");
74 Assert.assertTrue(getAttributeByName("field53","class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
75 fireEvent("field54","focus");
76 waitAndTypeByName("field54", "aaaaa");
77 fireEvent("field54", "blur");
78 Assert.assertTrue(getAttributeByName("field54","class").matches("^[\\s\\S]*error[\\s\\S]*$"));
79 fireEvent("field54","focus");
80 waitAndTypeByName("field54", "aaaaa@kuali.org");
81 fireEvent("field54", "blur");
82 Assert.assertTrue(getAttributeByName("field54","class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
83 fireEvent("field84","focus");
84 waitAndTypeByName("field84", "aaaaa");
85 fireEvent("field84", "blur");
86 Assert.assertTrue(getAttributeByName("field84","class").matches("^[\\s\\S]*error[\\s\\S]*$"));
87 fireEvent("field84","focus");
88 waitAndTypeByName("field84", "http://www.kuali.org");
89 fireEvent("field84", "blur");
90 Assert.assertTrue(getAttributeByName("field84","class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
91 fireEvent("field55","focus");
92 waitAndTypeByName("field55", "023512");
93 fireEvent("field55", "blur");
94 Assert.assertTrue(getAttributeByName("field55","class").matches("^[\\s\\S]*error[\\s\\S]*$"));
95 fireEvent("field55","focus");
96 waitAndTypeByName("field55", "022812");
97 fireEvent("field55", "blur");
98 Assert.assertTrue(getAttributeByName("field55","class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
99 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 }