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                    focus("name=field50");
035                    waitAndType("name=field50", "12.333");
036                    fireEvent("name=field50", "blur");
037                    Assert.assertTrue(getAttribute("name=field50@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
038                    focus("name=field50");
039                    waitAndType("name=field50", "123.33");
040                    fireEvent("name=field50", "blur");
041                    Assert.assertTrue(getAttribute("name=field50@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
042                    focus("name=field51");
043                    waitAndType("name=field51", "A");
044                    fireEvent("name=field51", "blur");
045                    Assert.assertTrue(getAttribute("name=field51@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
046                    focus("name=field51");
047                    waitAndType("name=field51", "-123.33");
048                    fireEvent("name=field51", "blur");
049                    Assert.assertTrue(getAttribute("name=field51@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
050                    focus("name=field77");
051                    waitAndType("name=field77", "1.1");
052                    fireEvent("name=field77", "blur");
053                    Assert.assertTrue(getAttribute("name=field77@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
054                    focus("name=field77");
055                    waitAndType("name=field77", "12");
056                    fireEvent("name=field77", "blur");
057                    Assert.assertTrue(getAttribute("name=field77@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
058                    focus("name=field52");
059                    waitAndType("name=field52", "5551112222");
060                    fireEvent("name=field52", "blur");
061                    Assert.assertTrue(getAttribute("name=field52@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
062                    focus("name=field52");
063                    waitAndType("name=field52", "555-111-1111");
064                    fireEvent("name=field52", "blur");
065                    Assert.assertTrue(getAttribute("name=field52@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
066                    focus("name=field53");
067                    waitAndType("name=field53", "1ClassName.java");
068                    fireEvent("name=field53", "blur");
069                    Assert.assertTrue(getAttribute("name=field53@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
070                    focus("name=field53");
071                    waitAndType("name=field53", "ClassName.java");
072                    fireEvent("name=field53", "blur");
073                    Assert.assertTrue(getAttribute("name=field53@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
074                    focus("name=field54");
075                    waitAndType("name=field54", "aaaaa");
076                    fireEvent("name=field54", "blur");
077                    Assert.assertTrue(getAttribute("name=field54@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
078                    focus("name=field54");
079                    waitAndType("name=field54", "aaaaa@kuali.org");
080                    fireEvent("name=field54", "blur");
081                    Assert.assertTrue(getAttribute("name=field54@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
082                    focus("name=field84");
083                    waitAndType("name=field84", "aaaaa");
084                    fireEvent("name=field84", "blur");
085                    Assert.assertTrue(getAttribute("name=field84@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
086                    focus("name=field84");
087                    waitAndType("name=field84", "http://www.kuali.org");
088                    fireEvent("name=field84", "blur");
089                    Assert.assertTrue(getAttribute("name=field84@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
090                    focus("name=field55");
091                    waitAndType("name=field55", "023512");
092                    fireEvent("name=field55", "blur");
093                    Assert.assertTrue(getAttribute("name=field55@class").matches("^[\\s\\S]*error[\\s\\S]*$"));
094                    focus("name=field55");
095                    waitAndType("name=field55", "022812");
096                    fireEvent("name=field55", "blur");
097                    Assert.assertTrue(getAttribute("name=field55@class").matches("^[\\s\\S]*valid[\\s\\S]*$"));
098                    focus("name=field75");
099                    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    }