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 DemoLibraryValidationCaseConstraintsSmokeTest extends SmokeTestBase {
27  
28      /**
29       * /kr-krad/kradsampleapp?viewId=Demo-CaseConstraint-View&methodToCall=start
30       */
31      public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-CaseConstraint-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("Case Constraint");
43      }
44  
45      protected void testValidationCaseConstraintsBasic() throws Exception {
46         //Scenario-1
47         waitAndClickByXpath("//input[@type='radio' and @value='case1']");
48         waitAndTypeByName("inputField1","");
49         waitAndTypeByName("inputField2","");
50         isVisible(By.xpath("//li[@class='uif-errorMessageItem-field']"));
51        
52         //Scenario-2
53         waitAndClickByXpath("//input[@type='radio' and @value='case2']");
54         waitAndTypeByName("inputField1","a_+");
55         waitAndTypeByName("inputField2","");
56         fireMouseOverEventByName("inputField1");
57         isVisible(By.xpath("//li[@class='uif-errorMessageItem-field']"));
58         
59         //Scenario-3
60         waitAndClickByXpath("//input[@type='radio' and @value='case3']");
61         waitAndTypeByName("inputField2","567823");
62         waitAndTypeByName("inputField1","");
63         fireMouseOverEventByName("inputField2");
64          isVisible(By.xpath("//li[@class='uif-errorMessageItem-field']"));
65         
66         //Scenario-4
67         waitAndClickByXpath("//input[@type='radio' and @value='case4']");
68         waitAndTypeByName("inputField3","a");
69         waitAndTypeByName("inputField4","");
70         waitAndTypeByName("inputField3","");
71         fireMouseOverEventByName("inputField4");
72         isVisible(By.xpath("//li[@class='uif-errorMessageItem-field']"));
73      }
74      
75      protected void testValidationCaseConstraintsNested() throws Exception {
76         waitAndClickByLinkText("Nested Example");
77         
78         //Scenario-1
79         waitAndTypeByName("inputField5","a");
80         waitAndTypeByName("inputField7","");
81         waitAndTypeByName("inputField6","");
82         assertElementPresentByXpath("//input[@name='inputField7' and @class='uif-textControl dependsOn-inputField5 dependsOn-inputField6 error']");
83      }
84      
85      @Test
86      public void testValidationCaseConstraintsBookmark() throws Exception {
87          testValidationCaseConstraintsBasic();
88          testValidationCaseConstraintsNested();
89          passed();
90      }
91  
92      @Test
93      public void testValidationCaseConstraintsNav() throws Exception {
94          testValidationCaseConstraintsBasic();
95          testValidationCaseConstraintsNested();
96          passed();
97      }
98  }