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 DemoCollectionFeaturesServerPagingAft 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 waitAndClickById("Demo-LibraryLink", "");
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 @Test
79 public void testCollectionFeaturesServerPagingBookmark() throws Exception {
80 testCollectionFeaturesServerPagingRichTableCollection();
81 testCollectionFeaturesServerPagingStackedCollection();
82 testCollectionFeaturesServerPagingBasicTableCollection();
83 passed();
84 }
85
86 @Test
87 public void testCollectionFeaturesServerPagingNav() throws Exception {
88 testCollectionFeaturesServerPagingRichTableCollection();
89 testCollectionFeaturesServerPagingStackedCollection();
90 testCollectionFeaturesServerPagingBasicTableCollection();
91 passed();
92 }
93 }