View Javadoc
1   /**
2    * Copyright 2005-2014 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  package org.kuali.rice.krad.demo.uif.library.validation;
17  
18  import org.junit.Test;
19  
20  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
21  import org.openqa.selenium.By;
22  
23  /**
24   * @author Kuali Rice Team (rice.collab@kuali.org)
25   */
26  public class LibraryValidationAlphaConstraintsAft extends WebDriverLegacyITBase {
27  
28      /**
29       * /kr-krad/kradsampleapp?viewId=Demo-AlphaPatternConstraintView&methodToCall=start
30       */
31      public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-AlphaPatternConstraintView&methodToCall=start";
32  
33      /**
34       *  Can only be alpha characters, whitespace, newlines, periods, parentheses, forward slashes, double quotes, apostrophes, colons, semi-colons, question marks, exclaimation marks, dashes
35       */
36      private static final String ERROR_MSG= "  Can only be alpha characters, whitespace, newlines, periods, parentheses, forward slashes, double quotes, apostrophes, colons, semi-colons, question marks, exclaimation marks, dashes";
37      
38      @Override
39      protected String getBookmarkUrl() {
40          return BOOKMARK_URL;
41      }
42  
43      @Override
44      protected void navigate() throws Exception {
45          waitAndClickLibraryLink();
46          waitAndClickByLinkText("Validation");
47          waitAndClickByLinkText("Alpha Constraint");
48      }
49  
50      protected void testValidationAlphaConstraints() throws Exception {
51          //Scenario-1
52          assertFocusTypeTabError("inputField1", "12");
53      }
54      
55      protected void testValidationAlphaConstraintsFlags() throws Exception {
56          waitAndClickByLinkText("Flags");
57          
58          //Scenario-2
59          assertFocusTypeTabError("inputField2", "1 2");
60          assertFocusTypeTabError("inputField3", "1,2");
61      }
62      
63      protected void testValidationAlphaConstraintsPreconfiguredBeans() throws Exception {
64          waitAndClickByLinkText("Preconfigured Bean(s)");
65          
66          //Scenario-3
67          waitAndTypeByName("inputField4","as=-0");
68          typeTab();
69          fireMouseOverEventByName("inputField4");
70          assertTextPresent(ERROR_MSG);
71       }
72      
73      @Test
74      public void testValidationAlphaConstraintsBookmark() throws Exception {
75          testValidationAlphaConstraints();
76          testValidationAlphaConstraintsFlags();
77          testValidationAlphaConstraintsPreconfiguredBeans();
78          passed();
79      }
80  
81      @Test
82      public void testValidationAlphaConstraintsNav() throws Exception {
83          testValidationAlphaConstraints();
84          testValidationAlphaConstraintsFlags();
85          testValidationAlphaConstraintsPreconfiguredBeans();
86          passed();
87      }  
88  }