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.layoutmanagers;
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 DemoLibraryLayoutManagersStackedLayoutSmokeTest extends SmokeTestBase {
026
027 /**
028 * /kr-krad/kradsampleapp?viewId=Demo-StackedLayoutManager-View&methodToCall=start
029 */
030 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-StackedLayoutManager-View&methodToCall=start";
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("Layout Managers");
041 waitAndClickByLinkText("Stacked Layout");
042 }
043
044 protected void testLayoutManagersStackedLayout() throws Exception {
045 waitForElementPresentByXpath("//div[@class='uif-collectionItem uif-gridCollectionItem uif-collectionAddItem']/div[@class='uif-footer']/div/button[contains(text(),'add')]");
046 assertElementPresentByXpath("//div[@class='uif-collectionItem uif-gridCollectionItem']/div[@class='uif-footer']/div/button[contains(text(),'delete')]");
047 assertElementPresentByXpath("//div[@class='uif-collectionItem uif-gridCollectionItem'][35]/div[@class='uif-footer']/div/button[contains(text(),'delete')]");
048 }
049
050 protected void testLayoutManagersStackedWithTableSubCollectionLayout() throws Exception {
051 selectByName("exampleShown","Stacked Collection With Table Sub-Collection");
052 waitForElementPresentByXpath("//div[@id='Demo-StackedLayoutManager-Collection2']/div[2]/div[2]/div/table/tbody/tr/td/div/input");
053 assertElementPresentByXpath("//div[@id='Demo-StackedLayoutManager-Collection2']/div[2]/div[2]/div[@class='uif-collectionItem uif-gridCollectionItem']/table");
054 // assertElementPresentByXpath("//div[@id='Demo-StackedLayoutManager-Collection2']/div[2]/div[3]/table/tbody/tr/td/div/input[@name='collection4[1].field1']");
055 }
056
057 protected void testLayoutManagersStackedWithStackedSubCollectionLayout() throws Exception {
058 selectByName("exampleShown","Stacked Collection with a Stacked Sub-Collection");
059 waitForElementPresentByXpath("//div[@id='Demo-StackedLayoutManager-Collection3']/div[2]/div[2]/div[@class='uif-collectionItem uif-gridCollectionItem']/table/tbody/tr/td/div/input");
060 assertElementPresentByXpath("//div[@id='Demo-StackedLayoutManager-Collection3']/div[2]/div[2]/div[@class='uif-collectionItem uif-gridCollectionItem']/table/tbody/tr[5]/td/div/fieldset/div/div[3]/div/table");
061 }
062
063 protected void testLayoutManagersStackedCollectionWithServersidePaging() throws Exception {
064 selectByName("exampleShown","Stacked Collection with server-side paging");
065 assertElementPresentByXpath("//ul[@class='pagination']");
066 }
067
068 protected void testLayoutManagersStackedCollectionAjaxDisclosures() throws Exception {
069 selectByName("exampleShown","Stacked Collection Ajax Disclosures");
070 if(isElementPresentByXpath("//div[@id='Demo-StackedLayoutManager-Example5']/div[@class='uif-verticalBoxLayout clearfix']/div/div[3]/div[@class='uif-collectionItem uif-gridCollectionItem']/div[@class='uif-disclosureContent']/table/tbody/tr/td/div/input[@name='groupedCollection3[0].field1']"))
071 {
072 fail("Ajax Disclosure Not working!");
073 }
074 waitAndClickByLinkText("Item 100");
075 Thread.sleep(3000);
076 waitForElementPresentByXpath("//div[@id='Demo-StackedLayoutManager-Example5']/div[@class='uif-verticalBoxLayout clearfix']/div/div[3]/div[@class='uif-collectionItem uif-gridCollectionItem']/div[@class='uif-disclosureContent']/table/tbody/tr/td/div/input[@name='groupedCollection3[0].field1']");
077 }
078
079 @Test
080 public void testLayoutManagersStackedLayoutBookmark() throws Exception {
081 testLayoutManagersStackedLayout();
082 testLayoutManagersStackedWithTableSubCollectionLayout();
083 testLayoutManagersStackedWithStackedSubCollectionLayout();
084 testLayoutManagersStackedCollectionWithServersidePaging();
085 testLayoutManagersStackedCollectionAjaxDisclosures();
086 passed();
087 }
088
089 @Test
090 public void testLayoutManagersStackedLayoutNav() throws Exception {
091 testLayoutManagersStackedLayout();
092 testLayoutManagersStackedWithTableSubCollectionLayout();
093 testLayoutManagersStackedWithStackedSubCollectionLayout();
094 testLayoutManagersStackedCollectionWithServersidePaging();
095 testLayoutManagersStackedCollectionAjaxDisclosures();
096 passed();
097 }
098 }