View Javadoc
1   /**
2    * Copyright 2005-2013 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 edu.samplu.krad.library.validation;
17  
18  import org.junit.Test;
19  
20  import edu.samplu.common.SmokeTestBase;
21  import org.openqa.selenium.By;
22  
23  /**
24   * @author Kuali Rice Team (rice.collab@kuali.org)
25   */
26  public class DemoLibraryValidationDatePatternConstraintsSmokeTest extends SmokeTestBase {
27  
28      /**
29       * /kr-krad/kradsampleapp?viewId=Demo-DatePatternConstraint-View&methodToCall=start
30       */
31      public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-DatePatternConstraint-View&methodToCall=start";
32  
33      @Override
34      protected String getBookmarkUrl() {
35          return BOOKMARK_URL;
36      }
37  
38      @Override
39      protected void navigate() throws Exception {
40          waitAndClickById("Demo-LibraryLink", "");
41          waitAndClickByLinkText("Validation");
42          waitAndClickByLinkText("Date Constraint");
43      }
44  
45      protected void testValidationDatePatternConstraints() throws Exception {
46         //Scenario-1
47         waitAndTypeByName("inputField1","2 June 2012");
48         waitAndClickByLinkText("Usage");
49         assertElementPresentByXpath("//input[@name='inputField1' and @class='uif-textControl validChar-inputField10 dirty error']");
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         waitAndClickByLinkText("Usage");
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  }