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.krad.demo.ViewDemoAftBase;
20 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
21 import org.junit.Test;
22
23 import static org.junit.Assert.assertEquals;
24
25
26
27
28 public class DemoLookUpConditionalResultsAft extends ViewDemoAftBase {
29
30
31
32
33 public static final String BOOKMARK_URL = "/kr-krad/lookup?methodToCall=start&viewId=LookupSampleViewConditionalResults";
34
35
36
37
38 private static final String LOOKUP_CRITERIA_NUMBER_NAME = "lookupCriteria[number]";
39
40
41
42
43 private static final String SEARCH = "Search";
44
45
46
47
48 private static final String TRAVEL_ACCOUNT_NUMBER_COLUMN_NAME = "Travel Account Number";
49
50
51
52
53 private static final String ACCOUNT_NAME_COLUMN_NAME = "Account Name";
54
55
56
57
58 private static final String DATE_CREATED_COLUMN_NAME = "Date Created";
59
60 @Override
61 public String getBookmarkUrl() {
62 return BOOKMARK_URL;
63 }
64
65 @Override
66 protected void navigate() throws Exception {
67 waitAndClickDemoLink();
68 waitAndClickByLinkText("Lookup Conditional Results");
69 }
70
71 protected void testLookUpConditionalResults() throws InterruptedException {
72
73 waitAndTypeByName(LOOKUP_CRITERIA_NUMBER_NAME, "a1");
74 waitAndClickButtonByText(SEARCH);
75 Thread.sleep(3000);
76 Assert.assertEquals(2, getCssCount(DATA_TABLE_TH_CSS));
77 assertElementPresent(DATA_TABLE_TH_CSS + ":nth-child(1)");
78
79
80 assertTextNotPresent(ACCOUNT_NAME_COLUMN_NAME, DATA_TABLE_TH_CSS + ":nth-child(1)" + " label",
81 ACCOUNT_NAME_COLUMN_NAME + " column not present");
82
83
84 clearTextByName(LOOKUP_CRITERIA_NUMBER_NAME);
85 waitAndClickButtonByText(SEARCH);
86 waitForTextPresent("Showing 1 to 10 of");
87 Assert.assertEquals(4, getCssCount(DATA_TABLE_TH_CSS));
88 assertElementPresent(DATA_TABLE_TH_CSS + ":nth-child(2)");
89 assertTextPresent(TRAVEL_ACCOUNT_NUMBER_COLUMN_NAME, DATA_TABLE_TH_CSS + ":nth-child(2) label",
90 TRAVEL_ACCOUNT_NUMBER_COLUMN_NAME + " column not present");
91 assertElementPresent(DATA_TABLE_TH_CSS + ":nth-child(3)");
92 assertTextPresent(ACCOUNT_NAME_COLUMN_NAME, DATA_TABLE_TH_CSS + ":nth-child(3) label",
93 ACCOUNT_NAME_COLUMN_NAME + " column not present");
94 assertElementPresent(DATA_TABLE_TH_CSS + ":nth-child(4)");
95 assertTextPresent(DATE_CREATED_COLUMN_NAME, DATA_TABLE_TH_CSS + ":nth-child(4) label",
96 DATE_CREATED_COLUMN_NAME + " column not present");
97 }
98
99 @Test
100 public void testLookUpConditionalResultsBookmark() throws Exception {
101 testLookUpConditionalResults();
102 passed();
103 }
104
105 @Test
106 public void testLookUpConditionalResultsNav() throws Exception {
107 testLookUpConditionalResults();
108 passed();
109 }
110 }