1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.demo.lookup.conditionalresults;
17
18 import org.junit.Assert;
19 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
20 import org.junit.Test;
21
22 import static org.junit.Assert.assertEquals;
23
24
25
26
27 public class DemoLookUpConditionalResultsBasedOnCriteriaAft extends WebDriverLegacyITBase {
28
29
30
31
32 public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=start&viewId=LookupSampleViewConditionalResultsBasedOnCriteria";
33
34
35
36
37 private static final String LOOKUP_CRITERIA_TYPE_CODE="lookupCriteria[typeCode]";
38
39
40
41
42 private static final String SEARCH="Search";
43
44
45
46
47 private static final String PRINCIPAL_NAME_COLUMN_NAME = "Principal Name";
48
49
50
51
52 private static final String GROUP_NAME_COLUMN_NAME = "Group Name";
53
54
55
56
57 private static final String ROLE_NAME_COLUMN_NAME = "Role Name";
58
59
60
61
62 private static final String DESCRIPTION_COLUMN_NAME = "Description";
63
64 @Override
65 public String getBookmarkUrl() {
66 return BOOKMARK_URL;
67 }
68
69 @Override
70 protected void navigate() throws Exception {
71 waitAndClickDemoLink();
72 waitAndClickByLinkText("Lookup Conditional Results Based On Criteria");
73 }
74
75 protected void testLookUpConditionalResultsBasedOnCriteria() throws InterruptedException {
76
77 waitAndTypeByName(LOOKUP_CRITERIA_TYPE_CODE,"P");
78 waitAndClickButtonByText(SEARCH);
79 Thread.sleep(3000);
80 Assert.assertEquals(2, getCssCount(DATA_TABLE_TH_CSS));
81 assertElementPresent(DATA_TABLE_TH_CSS + ":nth-child(2)");
82 assertTextPresent(PRINCIPAL_NAME_COLUMN_NAME, DATA_TABLE_TH_CSS + ":nth-child(2) label",
83 "Principal Name column not present");
84
85
86 waitAndTypeByName(LOOKUP_CRITERIA_TYPE_CODE, "G");
87 waitAndClickButtonByText(SEARCH);
88 Thread.sleep(3000);
89 Assert.assertEquals(3, getCssCount(DATA_TABLE_TH_CSS));
90 assertElementPresent(DATA_TABLE_TH_CSS + ":nth-child(2)");
91 assertTextPresent(GROUP_NAME_COLUMN_NAME, DATA_TABLE_TH_CSS + ":nth-child(2) label",
92 "Group Name column not present");
93 assertElementPresent(DATA_TABLE_TH_CSS + ":nth-child(3)");
94 assertTextPresent(DESCRIPTION_COLUMN_NAME, DATA_TABLE_TH_CSS + ":nth-child(3) label",
95 "Description column not present");
96
97
98 waitAndTypeByName(LOOKUP_CRITERIA_TYPE_CODE, "R");
99 waitAndClickButtonByText(SEARCH);
100 Thread.sleep(3000);
101 Assert.assertEquals(3, getCssCount(DATA_TABLE_TH_CSS));
102 assertTextPresent(ROLE_NAME_COLUMN_NAME, DATA_TABLE_TH_CSS + ":nth-child(2) label",
103 "Role Name column not present");
104 assertElementPresent(DATA_TABLE_TH_CSS + ":nth-child(3)");
105 assertTextPresent(DESCRIPTION_COLUMN_NAME, DATA_TABLE_TH_CSS + ":nth-child(3) label",
106 "Description column not present");
107 }
108
109 @Test
110 public void testLookUpConditionalResultsBasedOnCriteriaBookmark() throws Exception {
111 testLookUpConditionalResultsBasedOnCriteria();
112 passed();
113 }
114
115 @Test
116 public void testLookUpConditionalResultsBasedOnCriteriaNav() throws Exception {
117 testLookUpConditionalResultsBasedOnCriteria();
118 passed();
119 }
120 }