1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.labs.lookups;
17
18 import org.junit.Test;
19 import org.openqa.selenium.By;
20
21
22
23
24 public class LabsLookUpConditionalCriteriaAft extends LabsLookupBase {
25
26
27
28
29 public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=start&viewId=LabsLookup-ConditionalCriteriaView&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_LABEL="Date Created:";
55
56
57
58
59 private static final String DATE_REQUIRED_MESSAGE="Date Created is a required field.";
60
61
62
63
64 private static final String LOOKUP_CRITERIA_NAME_NAME="lookupCriteria[name]";
65
66 @Override
67 protected String getBookmarkUrl() {
68 return BOOKMARK_URL;
69 }
70
71 @Override
72 protected void navigate() throws Exception {
73 navigateToLookup("Lookup Conditional Criteria");
74 }
75
76
77 protected void testLookUpConditionalCriteria() throws InterruptedException {
78
79
80 waitAndTypeByName(LOOKUP_CRITERIA_NUMBER_NAME, "a1");
81 waitAndClickByName("lookupCriteria[name]");
82 waitForElementPresent(By.className("uif-requiredMessage"));
83 checkForIncidentReport();
84
85
86 clearTextByName(LOOKUP_CRITERIA_NUMBER_NAME);
87 waitAndTypeByName(LOOKUP_CRITERIA_NUMBER_NAME, "a2");
88 waitAndClickByName("lookupCriteria[name]");
89 Thread.sleep(3000);
90 checkForIncidentReport();
91 if(isElementPresentByName(LOOKUP_CRITERIA_DATE_NAME)) {
92 fail(FAILURE_MESSAGE);
93 }
94
95
96 clearTextByName(LOOKUP_CRITERIA_NUMBER_NAME);
97 waitAndTypeByName(LOOKUP_CRITERIA_NUMBER_NAME, "a3");
98 waitAndClickByName("lookupCriteria[name]");
99 Thread.sleep(3000);
100 checkForIncidentReport();
101 assertTrue(isNotVisible(By.name(LOOKUP_CRITERIA_DATE_NAME)));
102 assertTrue(isNotVisible(By.name("lookupCriteria[createDate]")));
103 }
104
105
106 @Test
107 public void testLookUpConditionalCriteriaBookmark() throws Exception {
108 testLookUpConditionalCriteria();
109 passed();
110 }
111
112 @Test
113 public void testLookUpConditionalCriteriaNav() throws Exception {
114 testLookUpConditionalCriteria();
115 passed();
116 }
117 }