001 /** 002 * Copyright 2005-2013 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package edu.samplu.krad.library.collections; 017 018 import org.junit.Test; 019 020 import org.kuali.rice.testtools.selenium.SmokeTestBase; 021 022 /** 023 * @author Kuali Rice Team (rice.collab@kuali.org) 024 */ 025 public class DemoLibraryCollectionFeaturesServerPagingSmokeTest extends SmokeTestBase { 026 027 /** 028 * /kr-krad/serverpaging 029 */ 030 public static final String BOOKMARK_URL = "/kr-krad/serverpaging"; 031 032 @Override 033 protected String getBookmarkUrl() { 034 return BOOKMARK_URL; 035 } 036 037 @Override 038 protected void navigate() throws Exception { 039 waitAndClickById("Demo-LibraryLink", ""); 040 waitAndClickByLinkText("Collection Features"); 041 waitAndClickByLinkText("Server Paging"); 042 } 043 044 protected void testCollectionFeaturesServerPagingRichTableCollection() throws Exception { 045 if(isElementPresentByXpath("//table[@class='table table-condensed table-bordered uif-tableCollectionLayout uif-hasAddLine dataTable']/tbody/tr[12]")) 046 { 047 fail("More than 10 Elements Present."); 048 } 049 selectByXpath("//div[@class='dataTables_length']/label/select", "25"); 050 assertElementPresentByXpath("//table[@class='table table-condensed table-bordered uif-tableCollectionLayout uif-hasAddLine dataTable']/tbody/tr[12]"); 051 if(isElementPresentByXpath("//table[@class='table table-condensed table-bordered uif-tableCollectionLayout uif-hasAddLine dataTable']/tbody/tr[27]")) 052 { 053 fail("More than 25 Elements Present."); 054 } 055 waitAndClickByLinkText("2"); 056 assertTextPresent("50"); 057 } 058 059 protected void testCollectionFeaturesServerPagingStackedCollection() throws Exception { 060 selectByName("exampleShown","Stacked Collection with server-side paging"); 061 if(isElementPresentByXpath("//div[@class='uif-stackedCollectionLayout']/div[7]")) 062 { 063 fail("More than 6 Stack present."); 064 } 065 if(isElementPresentByXpath("//input[@name='collection2[9].field1']")) 066 { 067 fail("Element for second page is present."); 068 } 069 waitAndClickByLinkText("ยป"); 070 assertElementPresentByXpath("//input[@name='collection2[9].field1']"); 071 } 072 073 protected void testCollectionFeaturesServerPagingBasicTableCollection() throws Exception { 074 selectByName("exampleShown","Table Collection with server-side Paging (Basic)"); 075 if(isElementPresentByXpath("//table[@class='table table-condensed table-bordered uif-tableCollectionLayout uif-hasAddLine']/tbody/tr[12]")) 076 { 077 fail("More than 10 Rows present."); 078 } 079 waitAndClickByLinkText("Last"); 080 assertTextPresent("999"); 081 } 082 083 @Test 084 public void testCollectionFeaturesServerPagingBookmark() throws Exception { 085 testCollectionFeaturesServerPagingRichTableCollection(); 086 testCollectionFeaturesServerPagingStackedCollection(); 087 testCollectionFeaturesServerPagingBasicTableCollection(); 088 passed(); 089 } 090 091 @Test 092 public void testCollectionFeaturesServerPagingNav() throws Exception { 093 testCollectionFeaturesServerPagingRichTableCollection(); 094 testCollectionFeaturesServerPagingStackedCollection(); 095 testCollectionFeaturesServerPagingBasicTableCollection(); 096 passed(); 097 } 098 }