View Javadoc
1   /**
2    * Copyright 2005-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
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   * @author Kuali Rice Team (rice.collab@kuali.org)
24   */
25  public class DemoCollectionFeaturesServerPagingAft extends WebDriverLegacyITBase {
26  
27      /**
28       * /kr-krad/serverpaging
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  }