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 org.kuali.rice.testtools.selenium.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 Thread.sleep(10000);
78 checkForIncidentReport(SEARCH, "DemoLookUpConditionalCriteriaSmokeTest testLookUpConditionalCriteria");
79 waitAndClickButtonByText(SEARCH);
80 Thread.sleep(3000);
81 checkForIncidentReport();
82 assertTextPresent(DATE_REQUIRED_MESSAGE);
83
84
85 clearTextByName(LOOKUP_CRITERIA_NUMBER_NAME);
86 waitAndTypeByName(LOOKUP_CRITERIA_NUMBER_NAME,"a2");
87 waitAndClickButtonByText(SEARCH);
88 Thread.sleep(3000);
89 if(isElementPresentByName(LOOKUP_CRITERIA_DATE_NAME)) {
90 fail(FAILURE_MESSAGE);
91 }
92
93
94 clearTextByName(LOOKUP_CRITERIA_NUMBER_NAME);
95 waitAndTypeByName(LOOKUP_CRITERIA_NUMBER_NAME,"a3");
96 waitAndClickButtonByText(SEARCH);
97 Thread.sleep(3000);
98 assertTextNotPresent(DATE_CREATED_MESSAGE);
99 }
100
101 @Test
102 public void testLookUpConditionalCriteriaBookmark() throws Exception {
103 testLookUpConditionalCriteria();
104 passed();
105 }
106
107 @Test
108 public void testLookUpConditionalCriteriaNav() throws Exception {
109 testLookUpConditionalCriteria();
110 passed();
111 }
112 }