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.layoutmanagers;
17  
18  import org.junit.Test;
19  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
20  import org.openqa.selenium.By;
21  
22  /**
23   * @author Kuali Rice Team (rice.collab@kuali.org)
24   */
25  public class DemoLayoutManagersStackedLayoutAft extends WebDriverLegacyITBase {
26  
27      /**
28       * /kr-krad/kradsampleapp?viewId=Demo-StackedLayoutManagerView&methodToCall=start
29       */
30      public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-StackedLayoutManagerView&methodToCall=start";
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("Layout Managers");
41          waitAndClickByLinkText("Stacked Layout");
42      }
43  
44      protected void testLayoutManagersStackedLayout() throws Exception {
45          selectByName("exampleShown","Stacked Layout Manager");
46          waitForElementPresentByXpath("//button[@id='Demo-StackedLayoutManager-Collection1_add']");
47          assertElementPresentByXpath("//button[@id='Demo-StackedLayoutManager-Collection1_del_line0']");
48          assertElementPresentByXpath("//button[@id='Demo-StackedLayoutManager-Collection1_del_line35']");
49      }
50      
51      protected void testLayoutManagersStackedWithTableSubCollectionLayout() throws Exception {
52          selectByName("exampleShown","Stacked Collection With Table Sub-Collection");
53          waitForElementPresentByXpath("//input[@name='collection4[0].field1' and @value='A']");
54          assertElementPresentByXpath("//table[@class='table table-condensed table-bordered uif-tableCollectionLayout uif-hasAddLine dataTable']");
55      }
56      
57      protected void testLayoutManagersStackedWithStackedSubCollectionLayout() throws Exception {
58          selectByName("exampleShown","Stacked Collection with a Stacked Sub-Collection");
59          waitForElementPresentByXpath("//div[@id='Demo-StackedLayoutManager-Collection3']/div[2]/div[2]/table/tbody/tr/td/div/input");
60          assertElementPresentByXpath("//section[@data-parent='Demo-StackedLayoutManager-Collection3']/table/tbody/tr[5]/td/div/fieldset/section/div/table");
61      }
62      
63      protected void testLayoutManagersStackedCollectionWithServersidePaging() throws Exception {
64          selectByName("exampleShown","Stacked Collection with server-side paging");
65          assertElementPresentByXpath("//ul[@class='pagination']");
66      }
67      
68      protected void testLayoutManagersStackedCollectionAjaxDisclosures() throws Exception {
69          selectByName("exampleShown","Stacked Collection Ajax Disclosures");
70          if(isElementPresentByXpath("//div[@id='Demo-StackedLayoutManager-Example5']/div[@class='uif-stackedCollectionSection uif-boxLayoutVerticalItem clearfix']/div[3]/div[2]/table/tbody/tr/td/div/input")) {
71              jiraAwareFail("Ajax Disclosure Not working!");
72          }
73          waitAndClickByLinkText("Item 100");
74          waitForTextPresent("Loading...");
75          waitForElementPresentByXpath("//div[@id='Demo-StackedLayoutManager-Example5']/div[@class='uif-stackedCollectionSection uif-boxLayoutVerticalItem clearfix']/div[3]/div[2]/table/tbody/tr/td/div/input");
76      }
77      
78      protected void testLayoutManagersStackedList() throws Exception {
79          selectByName("exampleShown","Stacked List");
80          waitForElementPresentByXpath("//input[@name='names[0].field1' and @value='Jack']");
81          waitForElementPresentByXpath("//input[@name='names[1].field1' and @value='Joe']");
82          waitForElementPresentByXpath("//input[@name='names[2].field1' and @value='John']");
83          waitForElementPresentByXpath("//input[@name='names[3].field1' and @value='Jim']");
84          waitForElementNotPresent(By.xpath("//input[@name='names[4].field1']"));
85          waitAndClickButtonByText("Add Line");
86          waitForTextPresent("Loading...");
87          waitForElementPresentByXpath("//input[@name='names[4].field1']");
88      }
89      
90      @Test
91      public void testLayoutManagersStackedLayoutBookmark() throws Exception {
92          testLayoutManagersStackedLayout();
93          testLayoutManagersStackedWithTableSubCollectionLayout();
94          testLayoutManagersStackedWithStackedSubCollectionLayout();
95          testLayoutManagersStackedCollectionWithServersidePaging();
96          testLayoutManagersStackedCollectionAjaxDisclosures();
97          testLayoutManagersStackedList();
98          passed();
99      }
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 }