1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.samplu.krad.demo.lookupviews.lookup.conditionalcriteria;
17
18 import edu.samplu.common.SmokeTestBase;
19 import org.junit.Test;
20
21
22
23
24 public class DemoLookUpConditionalCriteriaSmokeTest extends SmokeTestBase {
25
26
27
28
29 public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=start&viewId=LookupSampleViewConditionalCriteria&hideReturnLink=true";
30
31
32
33
34 private static final String LOOKUP_CRITERIA_NUMBER_NAME="lookupCriteria[number]";
35
36
37
38
39 private static final String SEARCH="Search";
40
41
42
43
44 private static final String LOOKUP_CRITERIA_DATE_NAME="lookupCriteria[rangeLowerBoundKeyPrefix_createDate]";
45
46
47
48
49 private static final String FAILURE_MESSAGE="Not read only. Date input field present.";
50
51
52
53
54 private static final String DATE_CREATED_MESSAGE="Date Created:";
55
56
57
58
59 private static final String DATE_REQUIRED_MESSAGE="Date Created is a required field.";
60
61 @Override
62 public String getBookmarkUrl() {
63 return BOOKMARK_URL;
64 }
65
66 @Override
67 protected void navigate() throws Exception {
68 waitAndClickById("Demo-DemoLink", "");
69 waitAndClickByLinkText("Lookup Conditional Criteria");
70 }
71
72 protected void testLookUpConditionalCriteria() throws InterruptedException {
73
74
75 waitAndTypeByName(LOOKUP_CRITERIA_NUMBER_NAME,"a1");
76 waitAndClickButtonByText(SEARCH);
77 waitAndClickButtonByText(SEARCH);
78 Thread.sleep(3000);
79 assertTextPresent(DATE_REQUIRED_MESSAGE);
80
81
82 clearTextByName(LOOKUP_CRITERIA_NUMBER_NAME);
83 waitAndTypeByName(LOOKUP_CRITERIA_NUMBER_NAME,"a2");
84 waitAndClickButtonByText(SEARCH);
85 Thread.sleep(3000);
86 if(isElementPresentByName(LOOKUP_CRITERIA_DATE_NAME))
87 {
88 fail(FAILURE_MESSAGE);
89 }
90
91
92 clearTextByName(LOOKUP_CRITERIA_NUMBER_NAME);
93 waitAndTypeByName(LOOKUP_CRITERIA_NUMBER_NAME,"a3");
94 waitAndClickButtonByText(SEARCH);
95 Thread.sleep(3000);
96 assertTextNotPresent(DATE_CREATED_MESSAGE);
97 }
98
99 @Test
100 public void testLookUpConditionalCriteriaBookmark() throws Exception {
101 testLookUpConditionalCriteria();
102 passed();
103 }
104
105 @Test
106 public void testLookUpConditionalCriteriaNav() throws Exception {
107 testLookUpConditionalCriteria();
108 passed();
109 }
110 }