View Javadoc

1   /**
2    * Copyright 2005-2013 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 edu.samplu.krad.library.collections;
17  
18  import org.junit.Test;
19  
20  import org.kuali.rice.testtools.selenium.SmokeTestBase;
21  
22  /**
23   * @author Kuali Rice Team (rice.collab@kuali.org)
24   */
25  public class DemoLibraryCollectionFeaturesServerPagingSmokeTest extends SmokeTestBase {
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        {
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  }