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