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 LibraryValidationDatePatternConstraintsAft extends WebDriverLegacyITBase {
27  
28      /**
29       * /kr-krad/kradsampleapp?viewId=Demo-DatePatternConstraintView&methodToCall=start
30       */
31      public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-DatePatternConstraintView&methodToCall=start";
32  
33      @Override
34      protected String getBookmarkUrl() {
35          return BOOKMARK_URL;
36      }
37  
38      @Override
39      protected void navigate() throws Exception {
40          waitAndClickLibraryLink();
41          waitAndClickByLinkText("Validation");
42          waitAndClickByLinkText("Date Constraint");
43      }
44  
45      protected void testValidationDatePatternConstraints() throws Exception {
46          waitAndClickByLinkText("Default");
47  
48          //Scenario-1
49          assertFocusTypeBlurError("inputField1","2 June 2012");
50      }
51      
52      protected void testValidationDatePatternConstraintsBasicDate() throws Exception {
53          waitAndClickByLinkText("Basic Date");
54          
55          //Scenario-1
56          waitAndTypeByName("inputField3","07/2/13");
57          waitAndTypeByName("inputField2","2 July 2013");
58          isNotVisible(By.xpath("//div[@class='uif-clientMessageItems uif-clientErrorDiv']"));
59          waitAndTypeByName("inputField2","");
60          isVisible(By.xpath("//div[@class='uif-clientMessageItems uif-clientErrorDiv']"));
61      }
62      
63      protected void testValidationDatePatternCustomize() throws Exception {
64          waitAndClickByLinkText("Customize");
65         
66          //Scenario-1
67          waitAndTypeByName("inputField4","23/12/13");
68          typeTab();
69          isVisible(By.xpath("//div[@class='uif-clientMessageItems uif-clientErrorDiv']"));
70      }
71      
72      @Test
73      public void testValidationDatePatternConstraintsBookmark() throws Exception {
74          testValidationDatePatternConstraints();
75          testValidationDatePatternConstraintsBasicDate();
76          testValidationDatePatternCustomize();
77          passed();
78      }
79  
80      @Test
81      public void testValidationDatePatternConstraintsNav() throws Exception {
82          testValidationDatePatternConstraints();
83          testValidationDatePatternConstraintsBasicDate();
84          testValidationDatePatternCustomize();
85          passed();
86      }
87  }