1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.samplu.krad.library.validation;
17
18 import org.junit.Test;
19
20 import edu.samplu.common.SmokeTestBase;
21 import org.openqa.selenium.By;
22
23
24
25
26 public class DemoLibraryValidationCaseConstraintsSmokeTest extends SmokeTestBase {
27
28
29
30
31 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-CaseConstraint-View&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("Case Constraint");
43 }
44
45 protected void testValidationCaseConstraintsBasic() throws Exception {
46
47 waitAndClickByXpath("//input[@type='radio' and @value='case1']");
48 waitAndTypeByName("inputField1","");
49 waitAndTypeByName("inputField2","");
50 isVisible(By.xpath("//li[@class='uif-errorMessageItem-field']"));
51
52
53 waitAndClickByXpath("//input[@type='radio' and @value='case2']");
54 waitAndTypeByName("inputField1","a_+");
55 waitAndTypeByName("inputField2","");
56 fireMouseOverEventByName("inputField1");
57 isVisible(By.xpath("//li[@class='uif-errorMessageItem-field']"));
58
59
60 waitAndClickByXpath("//input[@type='radio' and @value='case3']");
61 waitAndTypeByName("inputField2","567823");
62 waitAndTypeByName("inputField1","");
63 fireMouseOverEventByName("inputField2");
64 isVisible(By.xpath("//li[@class='uif-errorMessageItem-field']"));
65
66
67 waitAndClickByXpath("//input[@type='radio' and @value='case4']");
68 waitAndTypeByName("inputField3","a");
69 waitAndTypeByName("inputField4","");
70 waitAndTypeByName("inputField3","");
71 fireMouseOverEventByName("inputField4");
72 isVisible(By.xpath("//li[@class='uif-errorMessageItem-field']"));
73 }
74
75 protected void testValidationCaseConstraintsNested() throws Exception {
76 waitAndClickByLinkText("Nested Example");
77
78
79 waitAndTypeByName("inputField5","a");
80 waitAndTypeByName("inputField7","");
81 waitAndTypeByName("inputField6","");
82 assertElementPresentByXpath("//input[@name='inputField7' and @class='uif-textControl dependsOn-inputField5 dependsOn-inputField6 error']");
83 }
84
85 @Test
86 public void testValidationCaseConstraintsBookmark() throws Exception {
87 testValidationCaseConstraintsBasic();
88 testValidationCaseConstraintsNested();
89 passed();
90 }
91
92 @Test
93 public void testValidationCaseConstraintsNav() throws Exception {
94 testValidationCaseConstraintsBasic();
95 testValidationCaseConstraintsNested();
96 passed();
97 }
98 }