1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.labs.kitchensink;
17
18 import org.junit.Test;
19
20
21
22
23 public class LabsValidationAft extends LabsKitchenSinkBase {
24
25
26
27
28 public static final String BOOKMARK_URL = "/kr-krad/uicomponents?viewId=UifCompView&pageId=UifCompView-Page3#UifCompView-Page3";
29
30 @Override
31 protected String getBookmarkUrl() {
32 return BOOKMARK_URL;
33 }
34
35 @Override
36 protected void navigate() throws Exception {
37 navigateToKitchenSink("Validation");
38 }
39
40 @Test
41 public void testValidationBookmark() throws Exception {
42 testValidation();
43 passed();
44 }
45
46 @Test
47 public void testValidationNav() throws Exception {
48 testValidation();
49 passed();
50 }
51
52 protected void testValidation() throws InterruptedException
53 {
54
55 waitAndTypeByName("field9","a");
56 waitAndTypeByName("field10","1");
57 fireMouseOverEventByName("field9");
58 assertTextPresent(" Please enter at least 2 characters.");
59 waitAndTypeByName("field9","");
60 fireMouseOverEventByName("field10");
61 assertTextPresent(" Value must be greater than 2");
62 waitAndTypeByName("field10","51");
63
64 waitAndTypeByName("field9","");
65 fireMouseOverEventByName("field10");
66 assertTextPresent(" Value cannot be greater than 50");
67
68
69 assertElementPresentByXpath("//textarea[@name='field3' and @aria-required='true']");
70 assertElementPresentByXpath("//input[@name='field4' and @aria-required='true']");
71 assertElementPresentByXpath("//select[@name='field5' and @aria-required='true']");
72
73
74 waitAndTypeByName("field6","a");
75 waitAndClickSaveByText();
76 waitForElementPresentByXpath("//input[@name='field7' and @class='form-control input-sm uif-textControl dependsOn-field6 required error']");
77 waitForElementPresentByXpath("//input[@name='field8' and @class='form-control input-sm uif-textControl dependsOn-field6 prConstraint-field81 required error']");
78
79
80 waitAndTypeByName("field14","a");
81 fireMouseOverEventByName("field14");
82 waitAndTypeByName("field18","a");
83 assertTextPresent(" 1-2 of the following must occur: (Field 1A) OR (Field 2A and Field 2B)");
84 waitAndTypeByName("field15","a");
85 waitAndTypeByName("field16","a");
86 waitAndTypeByName("field17","a");
87 waitAndTypeByName("field18","");
88 fireMouseOverEventByName("field18");
89 assertTextPresent(" The following must occur: (Field 3A) OR (Field 4A and Field 4B)");
90
91
92 waitAndClickByXpath("//input[@name='field24' and @value='case1']");
93 waitAndTypeByName("field25","");
94 waitAndTypeByName("field26","");
95 assertElementPresentByXpath("//input[@name='field25' and @class='form-control input-sm uif-textControl dependsOn-field24 required error']");
96 }
97 }