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