001 /**
002 * Copyright 2005-2014 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 org.kuali.rice.krad.demo.uif.library.layoutmanagers;
017
018 import org.junit.Test;
019 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
020 import org.openqa.selenium.By;
021
022 /**
023 * @author Kuali Rice Team (rice.collab@kuali.org)
024 */
025 public class DemoLayoutManagersStackedLayoutAft extends WebDriverLegacyITBase {
026
027 /**
028 * /kr-krad/kradsampleapp?viewId=Demo-StackedLayoutManagerView&methodToCall=start
029 */
030 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-StackedLayoutManagerView&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 selectByName("exampleShown","Stacked Layout Manager");
046 waitForElementPresentByXpath("//button[@id='Demo-StackedLayoutManager-Collection1_add']");
047 assertElementPresentByXpath("//button[@id='Demo-StackedLayoutManager-Collection1_del_line0']");
048 assertElementPresentByXpath("//button[@id='Demo-StackedLayoutManager-Collection1_del_line35']");
049 }
050
051 protected void testLayoutManagersStackedWithTableSubCollectionLayout() throws Exception {
052 selectByName("exampleShown","Stacked Collection With Table Sub-Collection");
053 waitForElementPresentByXpath("//input[@name='collection4[0].field1' and @value='A']");
054 assertElementPresentByXpath("//table[@class='table table-condensed table-bordered uif-tableCollectionLayout uif-hasAddLine dataTable']");
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]/table/tbody/tr/td/div/input");
060 assertElementPresentByXpath("//section[@data-parent='Demo-StackedLayoutManager-Collection3']/table/tbody/tr[5]/td/div/fieldset/section/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-stackedCollectionSection uif-boxLayoutVerticalItem clearfix']/div[3]/div[2]/table/tbody/tr/td/div/input")) {
071 jiraAwareFail("Ajax Disclosure Not working!");
072 }
073 waitAndClickByLinkText("Item 100");
074 waitForTextPresent("Loading...");
075 waitForElementPresentByXpath("//div[@id='Demo-StackedLayoutManager-Example5']/div[@class='uif-stackedCollectionSection uif-boxLayoutVerticalItem clearfix']/div[3]/div[2]/table/tbody/tr/td/div/input");
076 }
077
078 protected void testLayoutManagersStackedList() throws Exception {
079 selectByName("exampleShown","Stacked List");
080 waitForElementPresentByXpath("//input[@name='names[0].field1' and @value='Jack']");
081 waitForElementPresentByXpath("//input[@name='names[1].field1' and @value='Joe']");
082 waitForElementPresentByXpath("//input[@name='names[2].field1' and @value='John']");
083 waitForElementPresentByXpath("//input[@name='names[3].field1' and @value='Jim']");
084 waitForElementNotPresent(By.xpath("//input[@name='names[4].field1']"));
085 waitAndClickButtonByText("Add Line");
086 waitForTextPresent("Loading...");
087 waitForElementPresentByXpath("//input[@name='names[4].field1']");
088 }
089
090 @Test
091 public void testLayoutManagersStackedLayoutBookmark() throws Exception {
092 testLayoutManagersStackedLayout();
093 testLayoutManagersStackedWithTableSubCollectionLayout();
094 testLayoutManagersStackedWithStackedSubCollectionLayout();
095 testLayoutManagersStackedCollectionWithServersidePaging();
096 testLayoutManagersStackedCollectionAjaxDisclosures();
097 testLayoutManagersStackedList();
098 passed();
099 }
100
101 @Test
102 public void testLayoutManagersStackedLayoutNav() throws Exception {
103 testLayoutManagersStackedLayout();
104 testLayoutManagersStackedWithTableSubCollectionLayout();
105 testLayoutManagersStackedWithStackedSubCollectionLayout();
106 testLayoutManagersStackedCollectionWithServersidePaging();
107 testLayoutManagersStackedCollectionAjaxDisclosures();
108 testLayoutManagersStackedList();
109 passed();
110 }
111 }