1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.samplu.krad.demo.lookupviews.lookup.conditionalresults;
17
18 import org.junit.Assert;
19 import org.kuali.rice.testtools.selenium.SmokeTestBase;
20 import org.junit.Test;
21
22 import static org.junit.Assert.assertEquals;
23
24
25
26
27 public class DemoLookUpConditionalResultsSmokeTest extends SmokeTestBase {
28
29
30
31
32 public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=start&viewId=LookupSampleViewConditionalResults";
33
34
35
36
37 private static final String LOOKUP_CRITERIA_NUMBER_NAME = "lookupCriteria[number]";
38
39
40
41
42 private static final String SEARCH = "Search";
43
44
45
46
47 private static final String TRAVEL_ACCOUNT_NAME_COLUMN_NAME = "Travel Account Number";
48
49
50
51
52 private static final String ACCOUNT_NAME_COLUMN_NAME = "Account Name";
53
54
55
56
57 private static final String DATE_CREATED_COLUMN_NAME = "Date Created";
58
59 @Override
60 public String getBookmarkUrl() {
61 return BOOKMARK_URL;
62 }
63
64 @Override
65 protected void navigate() throws Exception {
66 waitAndClickById("Demo-DemoLink", "");
67 waitAndClickByLinkText("Lookup Conditional Results");
68 }
69
70 protected void testLookUpConditionalResults() throws InterruptedException {
71
72 waitAndTypeByName(LOOKUP_CRITERIA_NUMBER_NAME, "a1");
73 waitAndClickButtonByText(SEARCH);
74 Thread.sleep(3000);
75 Assert.assertEquals(1, getCssCount("div#uLookupResults thead th"));
76 assertElementPresent("div#uLookupResults thead th:nth-child(1)");
77 assertTextPresent(TRAVEL_ACCOUNT_NAME_COLUMN_NAME, "div#uLookupResults thead th:nth-child(1) label",
78 "Travel Account Name column not present");
79
80
81 clearTextByName(LOOKUP_CRITERIA_NUMBER_NAME);
82 waitAndClickButtonByText(SEARCH);
83 Thread.sleep(3000);
84 Assert.assertEquals(3, getCssCount("div#uLookupResults thead th"));
85 assertElementPresent("div#uLookupResults thead th:nth-child(1)");
86 assertTextPresent(TRAVEL_ACCOUNT_NAME_COLUMN_NAME, "div#uLookupResults thead th:nth-child(1) label",
87 "Travel Account Name column not present");
88 assertElementPresent("div#uLookupResults thead th:nth-child(2)");
89 assertTextPresent(ACCOUNT_NAME_COLUMN_NAME, "div#uLookupResults thead th:nth-child(2) label",
90 "Account Name column not present");
91 assertElementPresent("div#uLookupResults thead th:nth-child(3)");
92 assertTextPresent(DATE_CREATED_COLUMN_NAME, "div#uLookupResults thead th:nth-child(3) label",
93 "Date Created column not present");
94 }
95
96 @Test
97 public void testLookUpConditionalResultsBookmark() throws Exception {
98 testLookUpConditionalResults();
99 passed();
100 }
101
102 @Test
103 public void testLookUpConditionalResultsNav() throws Exception {
104 testLookUpConditionalResults();
105 passed();
106 }
107 }