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 LibraryValidationCaseConstraintsAft extends WebDriverLegacyITBase {
27
28
29
30
31 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-CaseConstraintView&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("Case Constraint");
43 }
44
45 protected void testValidationCaseConstraintsBasic() throws Exception {
46 waitAndClickByLinkText("Basic Examples");
47
48
49 waitAndClickByXpath("//input[@type='radio' and @value='case1']");
50 waitAndTypeByName("inputField1","");
51 waitAndTypeByName("inputField2","");
52 isVisible(By.xpath("//li[@class='uif-errorMessageItem-field']"));
53
54
55 waitAndClickByXpath("//input[@type='radio' and @value='case2']");
56 waitAndTypeByName("inputField1","a_+");
57 waitAndTypeByName("inputField2","");
58 fireMouseOverEventByName("inputField1");
59 isVisible(By.xpath("//li[@class='uif-errorMessageItem-field']"));
60
61
62 waitAndClickByXpath("//input[@type='radio' and @value='case3']");
63 waitAndTypeByName("inputField2","567823");
64 waitAndTypeByName("inputField1","");
65 fireMouseOverEventByName("inputField2");
66 isVisible(By.xpath("//li[@class='uif-errorMessageItem-field']"));
67
68
69 waitAndClickByXpath("//input[@type='radio' and @value='case4']");
70 waitAndTypeByName("inputField3","a");
71 waitAndTypeByName("inputField4","");
72 waitAndTypeByName("inputField3","");
73 fireMouseOverEventByName("inputField4");
74 isVisible(By.xpath("//li[@class='uif-errorMessageItem-field']"));
75 }
76
77 protected void testValidationCaseConstraintsNested() throws Exception {
78 waitAndClickByLinkText("Nested Example");
79
80
81 waitAndTypeByName("inputField5","a");
82 waitAndTypeByName("inputField6","");
83 String id = waitAndTypeByName("inputField7","").getAttribute("id");
84 fireEvent("inputField7", "blur");
85 fireMouseOverEventByName("inputField7");
86 Thread.sleep(1000);
87 assertTrue(findElement(By.id(id)).getAttribute("class").contains("error"));
88 }
89
90 @Test
91 public void testValidationCaseConstraintsBookmark() throws Exception {
92 testValidationCaseConstraintsBasic();
93 testValidationCaseConstraintsNested();
94 passed();
95 }
96
97 @Test
98 public void testValidationCaseConstraintsNav() throws Exception {
99 testValidationCaseConstraintsBasic();
100 testValidationCaseConstraintsNested();
101 passed();
102 }
103 }