1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package edu.samplu.krad.library.collections;
17
18 import org.junit.Test;
19
20 import org.kuali.rice.testtools.selenium.SmokeTestBase;
21
22
23
24
25 public class DemoLibraryCollectionFeaturesServerPagingSmokeTest extends SmokeTestBase {
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 {
47 fail("More than 10 Elements Present.");
48 }
49 selectByXpath("//div[@class='dataTables_length']/label/select", "25");
50 assertElementPresentByXpath("//table[@class='table table-condensed table-bordered uif-tableCollectionLayout uif-hasAddLine dataTable']/tbody/tr[12]");
51 if(isElementPresentByXpath("//table[@class='table table-condensed table-bordered uif-tableCollectionLayout uif-hasAddLine dataTable']/tbody/tr[27]"))
52 {
53 fail("More than 25 Elements Present.");
54 }
55 waitAndClickByLinkText("2");
56 assertTextPresent("50");
57 }
58
59 protected void testCollectionFeaturesServerPagingStackedCollection() throws Exception {
60 selectByName("exampleShown","Stacked Collection with server-side paging");
61 if(isElementPresentByXpath("//div[@class='uif-stackedCollectionLayout']/div[7]"))
62 {
63 fail("More than 6 Stack present.");
64 }
65 if(isElementPresentByXpath("//input[@name='collection2[9].field1']"))
66 {
67 fail("Element for second page is present.");
68 }
69 waitAndClickByLinkText("ยป");
70 assertElementPresentByXpath("//input[@name='collection2[9].field1']");
71 }
72
73 protected void testCollectionFeaturesServerPagingBasicTableCollection() throws Exception {
74 selectByName("exampleShown","Table Collection with server-side Paging (Basic)");
75 if(isElementPresentByXpath("//table[@class='table table-condensed table-bordered uif-tableCollectionLayout uif-hasAddLine']/tbody/tr[12]"))
76 {
77 fail("More than 10 Rows present.");
78 }
79 waitAndClickByLinkText("Last");
80 assertTextPresent("999");
81 }
82
83 @Test
84 public void testCollectionFeaturesServerPagingBookmark() throws Exception {
85 testCollectionFeaturesServerPagingRichTableCollection();
86 testCollectionFeaturesServerPagingStackedCollection();
87 testCollectionFeaturesServerPagingBasicTableCollection();
88 passed();
89 }
90
91 @Test
92 public void testCollectionFeaturesServerPagingNav() throws Exception {
93 testCollectionFeaturesServerPagingRichTableCollection();
94 testCollectionFeaturesServerPagingStackedCollection();
95 testCollectionFeaturesServerPagingBasicTableCollection();
96 passed();
97 }
98 }