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
20
21
22
23 public class LabsLookupValidateSearchParamsAft extends LabsLookupBase {
24
25
26
27
28 public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=search&dataObjectClassName=edu.sampleu.travel.dataobject.TravelPerDiemExpense&viewId=LabsLookup-PerDiemExpenseDisabledWildcardsView";
29
30
31
32
33 private static final String WILDCARD_WARNING_MSG="are treated literally";
34
35
36
37
38 private static final String NEGATIVE_WARNING_MSG="Negative values are not allowed";
39
40
41
42
43 private static final String WILDCARD_INPUT="_)(*";
44
45
46
47
48 private static final String NEGATIVE_WILDCARD_INPUT="-9_)(*";
49
50
51 @Override
52 protected String getBookmarkUrl() {
53 return BOOKMARK_URL;
54 }
55
56 @Override
57 protected void navigate() throws Exception {
58 navigateToLookup("Lookup Validate Search Parms");
59 }
60
61 @Test
62 public void testLabsValidateSearchParamsBookmark() throws Exception {
63 testLabsValidateSearchParams();
64 passed();
65 }
66
67 @Test
68 public void testLabsValidateSearchParamsNav() throws Exception {
69 testLabsValidateSearchParams();
70 passed();
71 }
72
73 protected void testLabsValidateSearchParams()throws Exception {
74 waitAndTypeByName("lookupCriteria[travelPerDiemExpenseId]",WILDCARD_INPUT);
75 assertWarningPresent(Boolean.TRUE,Boolean.FALSE);
76 waitAndTypeByName("lookupCriteria[travelAuthorizationDocumentId]",WILDCARD_INPUT);
77 assertWarningPresent(Boolean.TRUE,Boolean.FALSE);
78 waitAndTypeByName("lookupCriteria[breakfastValue]",NEGATIVE_WILDCARD_INPUT);
79 assertWarningPresent(Boolean.TRUE,Boolean.TRUE);
80 waitAndTypeByName("lookupCriteria[lunchValue]",NEGATIVE_WILDCARD_INPUT);
81 assertWarningPresent(Boolean.TRUE,Boolean.TRUE);
82 waitAndTypeByName("lookupCriteria[dinnerValue]",NEGATIVE_WILDCARD_INPUT);
83 assertWarningPresent(Boolean.TRUE,Boolean.TRUE);
84 waitAndTypeByName("lookupCriteria[incidentalsValue]",NEGATIVE_WILDCARD_INPUT);
85 assertWarningPresent(Boolean.TRUE,Boolean.TRUE);
86 waitAndTypeByName("lookupCriteria[estimatedMileage]",NEGATIVE_WILDCARD_INPUT);
87 }
88
89 private void assertWarningPresent(Boolean isWildCardWarningPresent , Boolean isNegativeWarningPresent) throws Exception {
90 waitAndClickSearch3();
91 if(isWildCardWarningPresent){
92 waitForTextPresent(WILDCARD_WARNING_MSG);
93 }
94 if(isNegativeWarningPresent){
95 waitForTextPresent(NEGATIVE_WARNING_MSG);
96 }
97 }
98 }