1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.demo.lookup.conditionalcriteria;
17
18 import org.kuali.rice.krad.demo.ViewDemoAftBase;
19 import org.junit.Test;
20 import org.openqa.selenium.By;
21 import org.openqa.selenium.Dimension;
22
23
24
25
26 public class DemoLookUpConditionalCriteriaAft extends ViewDemoAftBase {
27
28
29
30
31 public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=start&viewId=LookupSampleViewConditionalCriteria&hideReturnLink=true";
32
33
34
35
36 private static final String LOOKUP_CRITERIA_NUMBER_NAME="lookupCriteria[number]";
37
38
39
40
41 private static final String LOOKUP_CRITERIA_DATE_LOWER_BOUND_NAME="lookupCriteria[rangeLowerBoundKeyPrefix_createDate]";
42
43
44
45
46 private static final String LOOKUP_CRITERIA_DATE_UPPER_BOUND_NAME="lookupCriteria[createDate]";
47
48 @Override
49 public String getBookmarkUrl() {
50 return BOOKMARK_URL;
51 }
52
53 @Override
54 protected void navigate() throws Exception {
55 waitAndClickDemoLink();
56 waitAndClickByLinkText("Lookup Conditional Criteria");
57 }
58
59 protected void testLookUpConditionalCriteria() throws InterruptedException {
60
61 waitAndTypeByName(LOOKUP_CRITERIA_NUMBER_NAME, "a1");
62 fireEvent(LOOKUP_CRITERIA_NUMBER_NAME, "blur");
63 waitAndClickSearch3();
64 waitForElementPresentByClassName("uif-requiredMessage");
65 assertTrue(isElementPresentByName(LOOKUP_CRITERIA_DATE_LOWER_BOUND_NAME));
66 assertTrue(isElementPresentByName(LOOKUP_CRITERIA_DATE_UPPER_BOUND_NAME));
67
68 clearTextByName(LOOKUP_CRITERIA_NUMBER_NAME);
69
70
71 waitAndTypeByName(LOOKUP_CRITERIA_NUMBER_NAME, "a2");
72 fireEvent(LOOKUP_CRITERIA_NUMBER_NAME, "focus");
73 fireEvent(LOOKUP_CRITERIA_NUMBER_NAME, "blur");
74 waitAndClickSearch3();
75 waitForElementNotPresent(By.name(LOOKUP_CRITERIA_DATE_LOWER_BOUND_NAME));
76 assertFalse(isElementPresentByName(LOOKUP_CRITERIA_DATE_UPPER_BOUND_NAME));
77
78 clearTextByName(LOOKUP_CRITERIA_NUMBER_NAME);
79
80
81 waitAndTypeByName(LOOKUP_CRITERIA_NUMBER_NAME, "a3");
82 fireEvent(LOOKUP_CRITERIA_NUMBER_NAME, "focus");
83 fireEvent(LOOKUP_CRITERIA_NUMBER_NAME, "blur");
84 waitAndClickSearch3();
85 waitForElementPresentByName(LOOKUP_CRITERIA_DATE_LOWER_BOUND_NAME);
86 assertTrue(isNotVisible(By.name(LOOKUP_CRITERIA_DATE_LOWER_BOUND_NAME)));
87 waitForElementPresentByName(LOOKUP_CRITERIA_DATE_UPPER_BOUND_NAME);
88 assertTrue(isNotVisible(By.name(LOOKUP_CRITERIA_DATE_UPPER_BOUND_NAME)));
89 }
90
91 protected void testAutoTruncateColumns() throws InterruptedException {
92 waitForElementPresentByName(LOOKUP_CRITERIA_NUMBER_NAME);
93 jiraAwareClearAndTypeByName(LOOKUP_CRITERIA_NUMBER_NAME, "a3");
94 fireEvent(LOOKUP_CRITERIA_NUMBER_NAME, "blur");
95 waitAndClickSearch3();
96
97
98 jGrowl("Verifying auto truncate is enabled");
99 waitForElementPresent("#resultsName_line0.uif-truncate");
100
101
102 jGrowl("Verifying text is not truncated");
103 assertEquals("Travel Account 3", getText(By.cssSelector("#resultsName_line0_control")));
104
105
106 jGrowl("Fire MouseOver event to show tooltip, and validate tooltip is not present");
107 fireMouseOverEventById("resultsName_line0_control");
108 waitForElementNotPresent(By.cssSelector(".popover.top.in"));
109
110 jGrowl("Resizing the window width");
111 int width = 560;
112 int height = driver.manage().window().getSize().getHeight();
113 driver.manage().window().setSize(new Dimension(width, height));
114
115
116
117 jGrowl("Verifying text is still displayed");
118 assertEquals("Travel Account 3", getText(By.cssSelector("#resultsName_line0_control")));
119
120
121 jGrowl("Fire MouseOver event to show tooltip, and validate tooltip is present");
122 fireMouseOverEventById("resultsName_line0_control");
123 waitForToolTipTextPresent("Travel Account 3");
124 }
125
126 @Test
127 public void testAutoTruncateColumnsBookmark() throws Exception {
128 testAutoTruncateColumns();
129 passed();
130 }
131
132 @Test
133 public void testAutoTruncateColumnsNav() throws Exception {
134 testAutoTruncateColumns();
135 passed();
136 }
137
138 @Test
139 public void testLookUpConditionalCriteriaBookmark() throws Exception {
140 testLookUpConditionalCriteria();
141 passed();
142 }
143
144 @Test
145 public void testLookUpConditionalCriteriaNav() throws Exception {
146 testLookUpConditionalCriteria();
147 passed();
148 }
149
150 }