1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.krad.demo.uif.library.collections;
17
18 import org.junit.Test;
19
20 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
21
22
23
24
25 public class DemoCollectionFeaturesRowGroupingAft extends WebDriverLegacyITBase {
26
27
28
29
30 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-TableLayoutGroupingView";
31
32 @Override
33 protected String getBookmarkUrl() {
34 return BOOKMARK_URL;
35 }
36
37 @Override
38 protected void navigate() throws Exception {
39 waitAndClickById("Demo-LibraryLink", "");
40 waitAndClickByLinkText("Collection Features");
41 waitAndClickByLinkText("Row Grouping");
42 }
43
44 protected void testCollectionFeaturesRowGroupingBaseFunctionality() throws Exception {
45 waitForElementPresentByXpath("//div[@id='Demo-TableLayoutGrouping-Section1']/div[@class='dataTables_wrapper']/table/tbody/tr[@class='uif-groupRow a']");
46 assertElementPresentByXpath("//div[@id='Demo-TableLayoutGrouping-Section1']/div[@class='dataTables_wrapper']/table/tbody/tr[@data-group='a']");
47 assertElementPresentByXpath("//div[@id='Demo-TableLayoutGrouping-Section1']/div[@class='dataTables_wrapper']/table/tbody/tr[@class='uif-groupRow b']");
48 assertElementPresentByXpath("//div[@id='Demo-TableLayoutGrouping-Section1']/div[@class='dataTables_wrapper']/table/tbody/tr[@data-group='b']");
49 assertElementPresentByXpath("//div[@id='Demo-TableLayoutGrouping-Section1']/div[@class='dataTables_wrapper']/table/tbody/tr[@class='uif-groupRow c']");
50 assertElementPresentByXpath("//div[@id='Demo-TableLayoutGrouping-Section1']/div[@class='dataTables_wrapper']/table/tbody/tr[@data-group='c']");
51 }
52
53 protected void testCollectionFeaturesRowGrouping2FieldGrouping() throws Exception {
54 selectByName("exampleShown", "2 Field Grouping");
55 waitForElementPresentByXpath("//div[@id='Demo-TableLayoutGrouping-Section2']/div[@class='dataTables_wrapper']/table/tbody/tr[@class='uif-groupRow 2001-fall']");
56 assertElementPresentByXpath("//div[@id='Demo-TableLayoutGrouping-Section2']/div[@class='dataTables_wrapper']/table/tbody/tr[@data-groupvalue='2001-fall']");
57 assertElementPresentByXpath("//div[@id='Demo-TableLayoutGrouping-Section2']/div[@class='dataTables_wrapper']/table/tbody/tr[@class='uif-groupRow 2001-spring']");
58 assertElementPresentByXpath("//div[@id='Demo-TableLayoutGrouping-Section2']/div[@class='dataTables_wrapper']/table/tbody/tr[@data-groupvalue='2001-spring']");
59 assertElementPresentByXpath("//div[@id='Demo-TableLayoutGrouping-Section2']/div[@class='dataTables_wrapper']/table/tbody/tr[@class='uif-groupRow 2002-fall']");
60 assertElementPresentByXpath("//div[@id='Demo-TableLayoutGrouping-Section2']/div[@class='dataTables_wrapper']/table/tbody/tr[@data-groupvalue='2002-fall']");
61 }
62
63 protected void testCollectionFeaturesRowGroupingOmitGroupField() throws Exception {
64 selectByName("exampleShown", "Omit Group Field");
65 waitForElementPresentByXpath("//div[@id='Demo-TableLayoutGrouping-Section3']/div[@class='dataTables_wrapper']/table/tbody/tr[@class='uif-groupRow a']");
66 assertElementPresentByXpath("//div[@id='Demo-TableLayoutGrouping-Section3']/div[@class='dataTables_wrapper']/table/tbody/tr[@data-group='a']");
67 assertElementPresentByXpath("//div[@id='Demo-TableLayoutGrouping-Section3']/div[@class='dataTables_wrapper']/table/tbody/tr[@class='uif-groupRow b']");
68 assertElementPresentByXpath("//div[@id='Demo-TableLayoutGrouping-Section3']/div[@class='dataTables_wrapper']/table/tbody/tr[@data-group='b']");
69 assertElementPresentByXpath("//div[@id='Demo-TableLayoutGrouping-Section3']/div[@class='dataTables_wrapper']/table/tbody/tr[@class='uif-groupRow c']");
70 assertElementPresentByXpath("//div[@id='Demo-TableLayoutGrouping-Section3']/div[@class='dataTables_wrapper']/table/tbody/tr[@data-group='c']");
71 if(isElementPresentByXpath("//div[@id='Demo-TableLayoutGrouping-Section3']/div[@class='dataTables_wrapper']/table/tbody/tr[@data-groupvalue]"))
72 {
73 fail("Group Field Not Omited.");
74 }
75 }
76
77 protected void testCollectionFeaturesRowGroupingAddToGrouped() throws Exception {
78 selectByName("exampleShown", "Add to Grouped");
79 waitForElementPresentByXpath("//div[@id='Demo-TableLayoutGrouping-Section4']/div[@class='dataTables_wrapper']/table/tbody/tr[@class='uif-groupRow a']");
80
81 }
82
83 protected void testCollectionFeaturesRowGroupingPrefixOption() throws Exception {
84 selectByName("exampleShown", "Prefix option");
85 waitForElementPresentByXpath("//div[@id='Demo-TableLayoutGrouping-Section5']/div[@class='dataTables_wrapper']/table/tbody/tr[@class='uif-groupRow a']/td[contains(text(),'Lines with value A')]");
86 }
87
88 protected void testCollectionFeaturesRowGroupingCustomGroupTitle() throws Exception {
89 selectByName("exampleShown", "Custom Group title");
90 waitForElementPresentByXpath("//div[@id='Demo-TableLayoutGrouping-Section6']/div[@class='dataTables_wrapper']/table/tbody/tr[@class='uif-groupRow letter-a-in-item']/td[contains(text(),'Letter A in item')]");
91 }
92
93 @Test
94 public void testCollectionFeaturesRowGroupingBookmark() throws Exception {
95 testCollectionFeaturesRowGroupingBaseFunctionality();
96 testCollectionFeaturesRowGrouping2FieldGrouping();
97 testCollectionFeaturesRowGroupingOmitGroupField();
98 testCollectionFeaturesRowGroupingAddToGrouped();
99 testCollectionFeaturesRowGroupingPrefixOption();
100 testCollectionFeaturesRowGroupingCustomGroupTitle();
101 passed();
102 }
103
104 @Test
105 public void testCollectionFeaturesRowGroupingNav() throws Exception {
106 testCollectionFeaturesRowGroupingBaseFunctionality();
107 testCollectionFeaturesRowGrouping2FieldGrouping();
108 testCollectionFeaturesRowGroupingOmitGroupField();
109 testCollectionFeaturesRowGroupingAddToGrouped();
110 testCollectionFeaturesRowGroupingPrefixOption();
111 testCollectionFeaturesRowGroupingCustomGroupTitle();
112 passed();
113 }
114 }