1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
25
26 public class DemoValidationPrerequisiteConstraintsAft extends WebDriverLegacyITBase {
27
28
29
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 }