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 DemoLibraryValidationDatePatternConstraintsSmokeTest extends SmokeTestBase {
27
28
29
30
31 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-DatePatternConstraint-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("Date Constraint");
43 }
44
45 protected void testValidationDatePatternConstraints() throws Exception {
46
47 waitAndTypeByName("inputField1","2 June 2012");
48 waitAndClickByLinkText("Usage");
49 assertElementPresentByXpath("//input[@name='inputField1' and @class='uif-textControl validChar-inputField10 dirty error']");
50 }
51
52 protected void testValidationDatePatternConstraintsBasicDate() throws Exception {
53 waitAndClickByLinkText("Basic Date");
54
55
56 waitAndTypeByName("inputField3","07/2/13");
57 waitAndTypeByName("inputField2","2 July 2013");
58 isNotVisible(By.xpath("//div[@class='uif-clientMessageItems uif-clientErrorDiv']"));
59 waitAndTypeByName("inputField2","");
60 isVisible(By.xpath("//div[@class='uif-clientMessageItems uif-clientErrorDiv']"));
61 }
62
63 protected void testValidationDatePatternCustomize() throws Exception {
64 waitAndClickByLinkText("Customize");
65
66
67 waitAndTypeByName("inputField4","23/12/13");
68 waitAndClickByLinkText("Usage");
69 isVisible(By.xpath("//div[@class='uif-clientMessageItems uif-clientErrorDiv']"));
70 }
71
72 @Test
73 public void testValidationDatePatternConstraintsBookmark() throws Exception {
74 testValidationDatePatternConstraints();
75 testValidationDatePatternConstraintsBasicDate();
76 testValidationDatePatternCustomize();
77 passed();
78 }
79
80 @Test
81 public void testValidationDatePatternConstraintsNav() throws Exception {
82 testValidationDatePatternConstraints();
83 testValidationDatePatternConstraintsBasicDate();
84 testValidationDatePatternCustomize();
85 passed();
86 }
87 }