View Javadoc

1   /*
2    * Copyright 2006-2012 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package edu.samplu.krad.compview;
18  
19  import edu.samplu.common.UpgradedSeleniumITBase;
20  import junit.framework.Assert;
21  import org.junit.Test;
22  
23  /**
24   * @author Kuali Rice Team (rice.collab@kuali.org)
25   */
26  public class ValidCharsConstraintIT extends UpgradedSeleniumITBase {
27      @Override
28      public String getTestUrl() {
29          return "/kr-krad/uicomponents?viewId=UifCompView&methodToCall=start&pageId=UifCompView-Page4";
30      }
31  
32  	@Test
33  	public void testValidCharsConstraintIT() throws Exception {
34  		focus("name=field50");
35  		waitAndType("name=field50", "12.333");
36  		fireEvent("name=field50", "blur");
37  		Assert.assertTrue(getAttribute("name=field50@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
38  		focus("name=field50");
39  		waitAndType("name=field50", "123.33");
40  		fireEvent("name=field50", "blur");
41  		Assert.assertTrue(getAttribute("name=field50@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
42  		focus("name=field51");
43  		waitAndType("name=field51", "A");
44  		fireEvent("name=field51", "blur");
45  		Assert.assertTrue(getAttribute("name=field51@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
46  		focus("name=field51");
47  		waitAndType("name=field51", "-123.33");
48  		fireEvent("name=field51", "blur");
49  		Assert.assertTrue(getAttribute("name=field51@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
50  		focus("name=field77");
51  		waitAndType("name=field77", "1.1");
52  		fireEvent("name=field77", "blur");
53  		Assert.assertTrue(getAttribute("name=field77@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
54  		focus("name=field77");
55  		waitAndType("name=field77", "12");
56  		fireEvent("name=field77", "blur");
57  		Assert.assertTrue(getAttribute("name=field77@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
58  		focus("name=field52");
59  		waitAndType("name=field52", "5551112222");
60  		fireEvent("name=field52", "blur");
61  		Assert.assertTrue(getAttribute("name=field52@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
62  		focus("name=field52");
63  		waitAndType("name=field52", "555-111-1111");
64  		fireEvent("name=field52", "blur");
65  		Assert.assertTrue(getAttribute("name=field52@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
66  		focus("name=field53");
67  		waitAndType("name=field53", "1ClassName.java");
68  		fireEvent("name=field53", "blur");
69  		Assert.assertTrue(getAttribute("name=field53@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
70  		focus("name=field53");
71  		waitAndType("name=field53", "ClassName.java");
72  		fireEvent("name=field53", "blur");
73  		Assert.assertTrue(getAttribute("name=field53@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
74  		focus("name=field54");
75  		waitAndType("name=field54", "aaaaa");
76  		fireEvent("name=field54", "blur");
77  		Assert.assertTrue(getAttribute("name=field54@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
78  		focus("name=field54");
79  		waitAndType("name=field54", "aaaaa@kuali.org");
80  		fireEvent("name=field54", "blur");
81  		Assert.assertTrue(getAttribute("name=field54@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
82  		focus("name=field84");
83  		waitAndType("name=field84", "aaaaa");
84  		fireEvent("name=field84", "blur");
85  		Assert.assertTrue(getAttribute("name=field84@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
86  		focus("name=field84");
87  		waitAndType("name=field84", "http://www.kuali.org");
88  		fireEvent("name=field84", "blur");
89  		Assert.assertTrue(getAttribute("name=field84@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
90  		focus("name=field55");
91  		waitAndType("name=field55", "023512");
92  		fireEvent("name=field55", "blur");
93  		Assert.assertTrue(getAttribute("name=field55@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
94  		focus("name=field55");
95  		waitAndType("name=field55", "022812");
96  		fireEvent("name=field55", "blur");
97  		Assert.assertTrue(getAttribute("name=field55@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
98  		focus("name=field75");
99  		waitAndType("name=field75", "02/35/12");
100 		fireEvent("name=field75", "blur");
101 		Assert.assertTrue(getAttribute("name=field75@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
102 		focus("name=field75");
103 		waitAndType("name=field75", "02/28/12");
104 		fireEvent("name=field75", "blur");
105 		Assert.assertTrue(getAttribute("name=field75@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
106 		focus("name=field82");
107 		waitAndType("name=field82", "13:22");
108 		fireEvent("name=field82", "blur");
109 		Assert.assertTrue(getAttribute("name=field82@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
110 		focus("name=field82");
111 		waitAndType("name=field82", "02:33");
112 		fireEvent("name=field82", "blur");
113 		Assert.assertTrue(getAttribute("name=field82@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
114 		focus("name=field83");
115 		waitAndType("name=field83", "25:22");
116 		fireEvent("name=field83", "blur");
117 		Assert.assertTrue(getAttribute("name=field83@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
118 		focus("name=field83");
119 		waitAndType("name=field83", "14:33");
120 		fireEvent("name=field83", "blur");
121 		Assert.assertTrue(getAttribute("name=field83@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
122 		focus("name=field57");
123 		waitAndType("name=field57", "0");
124 		fireEvent("name=field57", "blur");
125 		Assert.assertTrue(getAttribute("name=field57@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
126 		focus("name=field57");
127 		waitAndType("name=field57", "2020");
128 		fireEvent("name=field57", "blur");
129 		Assert.assertTrue(getAttribute("name=field57@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
130 		focus("name=field58");
131 		waitAndType("name=field58", "13");
132 		fireEvent("name=field58", "blur");
133 		Assert.assertTrue(getAttribute("name=field58@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
134 		focus("name=field58");
135 		waitAndType("name=field58", "12");
136 		fireEvent("name=field58", "blur");
137 		Assert.assertTrue(getAttribute("name=field58@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
138 		focus("name=field61");
139 		waitAndType("name=field61", "5555-444");
140 		fireEvent("name=field61", "blur");
141 		Assert.assertTrue(getAttribute("name=field61@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
142 		focus("name=field61");
143 		waitAndType("name=field61", "55555-4444");
144 		fireEvent("name=field61", "blur");
145 		Assert.assertTrue(getAttribute("name=field61@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
146 		focus("name=field62");
147 		waitAndType("name=field62", "aa5bb6_a");
148 		fireEvent("name=field62", "blur");
149 		Assert.assertTrue(getAttribute("name=field62@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
150 		focus("name=field62");
151 		waitAndType("name=field62", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890");
152 		fireEvent("name=field62", "blur");
153 		Assert.assertTrue(getAttribute("name=field62@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
154 		focus("name=field63");
155 		waitAndType("name=field63", "fff555$");
156 		fireEvent("name=field63", "blur");
157 		Assert.assertTrue(getAttribute("name=field63@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
158 		focus("name=field63");
159 		waitAndType("name=field63", "aa22 _/");
160 		fireEvent("name=field63", "blur");
161 		Assert.assertTrue(getAttribute("name=field63@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
162 		focus("name=field64");
163 		waitAndType("name=field64", "AABB55");
164 		fireEvent("name=field64", "blur");
165 		Assert.assertTrue(getAttribute("name=field64@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
166 		focus("name=field64");
167 		waitAndType("name=field64", "ABCDEFGHIJKLMNOPQRSTUVWXY,Z abcdefghijklmnopqrstuvwxy,z");
168 		fireEvent("name=field64", "blur");
169 		Assert.assertTrue(getAttribute("name=field64@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
170 		focus("name=field76");
171 		waitAndType("name=field76", "AA~BB%");
172 		fireEvent("name=field76", "blur");
173 		Assert.assertTrue(getAttribute("name=field76@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
174 		focus("name=field76");
175 		waitAndType("name=field76", "abcABC %$#@&<>\\{}[]*-+!=.()/\"\"',:;?");
176 		fireEvent("name=field76", "blur");
177 		Assert.assertTrue(getAttribute("name=field76@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
178 		focus("name=field65");
179 		waitAndType("name=field65", "sdfs$#$# dsffs");
180 		fireEvent("name=field65", "blur");
181 		Assert.assertTrue(getAttribute("name=field65@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
182 		focus("name=field65");
183 		waitAndType("name=field65", "sdfs$#$#sffs");
184 		fireEvent("name=field65", "blur");
185 		Assert.assertTrue(getAttribute("name=field65@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
186 		focus("name=field66");
187 		waitAndType("name=field66", "abcABCD");
188 		fireEvent("name=field66", "blur");
189 		Assert.assertTrue(getAttribute("name=field66@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
190 		focus("name=field66");
191 		waitAndType("name=field66", "ABCabc");
192 		fireEvent("name=field66", "blur");
193 		Assert.assertTrue(getAttribute("name=field66@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
194 		focus("name=field67");
195 		waitAndType("name=field67", "(111)B-(222)A");
196 		fireEvent("name=field67", "blur");
197 		Assert.assertTrue(getAttribute("name=field67@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
198 		focus("name=field67");
199 		waitAndType("name=field67", "(12345)-(67890)");
200 		fireEvent("name=field67", "blur");
201 		Assert.assertTrue(getAttribute("name=field67@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
202 		focus("name=field68");
203 		waitAndType("name=field68", "A.66");
204 		fireEvent("name=field68", "blur");
205 		Assert.assertTrue(getAttribute("name=field68@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
206 		focus("name=field68");
207 		waitAndType("name=field68", "a.4");
208 		fireEvent("name=field68", "blur");
209 		Assert.assertTrue(getAttribute("name=field68@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
210 		focus("name=field56");
211 		waitAndType("name=field56", "2020-06-02");
212 		fireEvent("name=field56", "blur");
213 		Assert.assertTrue(getAttribute("name=field56@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
214 		focus("name=field56");
215 		waitAndType("name=field56", "2020-06-02 03:30:30.22");
216 		fireEvent("name=field56", "blur");
217 		Assert.assertTrue(getAttribute("name=field56@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
218 	}
219 }