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 DemoValidationPrerequisiteConstraintsAft extends WebDriverLegacyITBase {
27  
28      /**
29       * /kr-krad/kradsampleapp?viewId=Demo-PrerequisiteConstraintView&methodToCall=start
30       */
31      public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-PrerequisiteConstraintView&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("Prerequisite Constraint");
43      }
44  
45      protected void testValidationPrerequisiteConstraintsRequired() throws Exception {
46          waitAndClickByLinkText("Basic Example");
47  
48          waitAndTypeByName("inputField1","a");
49          waitAndTypeByName("inputField2","");
50          waitAndTypeByName("inputField3","");
51          waitAndTypeByName("inputField1","");
52          String id2 = findElement(By.name("inputField2")).getAttribute("id");
53          assertTrue(findElement(By.id(id2)).getAttribute("class").contains("error"));
54          String id3 = findElement(By.name("inputField3")).getAttribute("id");
55          assertTrue(findElement(By.id(id3)).getAttribute("class").contains("error"));
56          clearTextByName("inputField1");
57          waitAndTypeByName("inputField3","a");
58          waitAndTypeByName("inputField1","");
59          String id1 = findElement(By.name("inputField1")).getAttribute("id");
60          assertTrue(findElement(By.id(id1)).getAttribute("class").contains("error"));
61      }
62      
63      @Test
64      public void testValidationPrerequisiteConstraintsBookmark() throws Exception {
65          testValidationPrerequisiteConstraintsRequired();
66          passed();
67      }
68  
69      @Test
70      public void testValidationPrerequisiteConstraintsNav() throws Exception {
71          testValidationPrerequisiteConstraintsRequired();
72          passed();
73      }
74  }