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 LibraryCollectionFeaturesServerPagingAft extends WebDriverLegacyITBase {
26
27
28
29
30 public static final String BOOKMARK_URL = "/kr-krad/serverpaging";
31
32 @Override
33 protected String getBookmarkUrl() {
34 return BOOKMARK_URL;
35 }
36
37 @Override
38 protected void navigate() throws Exception {
39 waitAndClickLibraryLink();
40 waitAndClickByLinkText("Collection Features");
41 waitAndClickByLinkText("Server Paging");
42 }
43
44 protected void testCollectionFeaturesServerPagingRichTableCollection() throws Exception {
45 if(isElementPresentByXpath("//table[@class='table table-condensed table-bordered uif-tableCollectionLayout uif-hasAddLine dataTable']/tbody/tr[12]")) {
46 fail("More than 10 Elements Present.");
47 }
48 selectByXpath("//div[@class='dataTables_length']/label/select", "25");
49 waitForElementPresentByXpath("//table[@class='table table-condensed table-bordered uif-tableCollectionLayout uif-hasAddLine dataTable']/tbody/tr[12]");
50 if(isElementPresentByXpath("//table[@class='table table-condensed table-bordered uif-tableCollectionLayout uif-hasAddLine dataTable']/tbody/tr[27]")) {
51 fail("More than 25 Elements Present.");
52 }
53 waitAndClickByLinkText("2");
54 assertTextPresent("50");
55 }
56
57 protected void testCollectionFeaturesServerPagingStackedCollection() throws Exception {
58 selectByName("exampleShown","Stacked Collection with server-side paging");
59 if(isElementPresentByXpath("//div[@class='uif-stackedCollectionLayout']/div[7]")) {
60 fail("More than 6 Stack present.");
61 }
62 if(isElementPresentByXpath("//input[@name='collection2[9].field1']")) {
63 fail("Element for second page is present.");
64 }
65 waitAndClickByLinkText("»");
66 waitForElementPresentByXpath("//input[@name='collection2[9].field1']");
67 }
68
69 protected void testCollectionFeaturesServerPagingBasicTableCollection() throws Exception {
70 selectByName("exampleShown","Table Collection with server-side Paging (Basic)");
71 if(isElementPresentByXpath("//table[@class='table table-condensed table-bordered uif-tableCollectionLayout uif-hasAddLine']/tbody/tr[12]")) {
72 fail("More than 10 Rows present.");
73 }
74 waitAndClickByLinkText("Last");
75 assertTextPresent("999");
76 }
77
78 protected void testCollectionFeaturesStackedCollectionWithNextPager() throws Exception {
79 selectByName("exampleShown","Stacked Collection with NextPager");
80 waitAndTypeByName("newCollectionLines['collection4'].field1","Z");
81 waitAndTypeByName("newCollectionLines['collection4'].field2","999");
82 waitAndTypeByName("newCollectionLines['collection4'].field3","999");
83 waitAndTypeByName("newCollectionLines['collection4'].field4","999");
84 waitAndClickByXpath("//div[@data-parent='Demo-CollectionServerPaging-Example4']/section/div/button[contains(text(),'Add')]");
85 waitForElementPresentByXpath("//input[@value='Z']");
86 waitForElementPresentByXpath("//input[@value='999']");
87 waitForElementPresentByXpath("//li[@class='previous disabled']");
88 waitAndClickByXpath("//a[contains(text(),'Next →')]");
89 waitForElementPresentByXpath("//li[@class='previous']");
90 waitAndClickByXpath("//a[contains(text(),'← Previous')]");
91 waitForElementPresentByXpath("//li[@class='previous disabled']");
92 }
93
94 @Test
95 public void testCollectionFeaturesServerPagingBookmark() throws Exception {
96 testCollectionFeaturesServerPagingRichTableCollection();
97 testCollectionFeaturesServerPagingStackedCollection();
98 testCollectionFeaturesServerPagingBasicTableCollection();
99 testCollectionFeaturesStackedCollectionWithNextPager();
100 passed();
101 }
102
103 @Test
104 public void testCollectionFeaturesServerPagingNav() throws Exception {
105 testCollectionFeaturesServerPagingRichTableCollection();
106 testCollectionFeaturesServerPagingStackedCollection();
107 testCollectionFeaturesServerPagingBasicTableCollection();
108 testCollectionFeaturesStackedCollectionWithNextPager();
109 passed();
110 }
111 }