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.layoutmanagers;
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 DemoLibraryLayoutManagersStackedLayoutSmokeTest extends SmokeTestBase {
26  
27      /**
28       * /kr-krad/kradsampleapp?viewId=Demo-StackedLayoutManager-View&methodToCall=start
29       */
30      public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-StackedLayoutManager-View&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         waitForElementPresentByXpath("//div[@class='uif-collectionItem uif-gridCollectionItem uif-collectionAddItem']/div[@class='uif-footer']/div/button[contains(text(),'add')]");
46         assertElementPresentByXpath("//div[@class='uif-collectionItem uif-gridCollectionItem']/div[@class='uif-footer']/div/button[contains(text(),'delete')]");
47         assertElementPresentByXpath("//div[@class='uif-collectionItem uif-gridCollectionItem'][35]/div[@class='uif-footer']/div/button[contains(text(),'delete')]");
48      }
49      
50      protected void testLayoutManagersStackedWithTableSubCollectionLayout() throws Exception {
51          selectByName("exampleShown","Stacked Collection With Table Sub-Collection");
52          waitForElementPresentByXpath("//div[@id='Demo-StackedLayoutManager-Collection2']/div[2]/div[2]/div/table/tbody/tr/td/div/input");
53          assertElementPresentByXpath("//div[@id='Demo-StackedLayoutManager-Collection2']/div[2]/div[2]/div[@class='uif-collectionItem uif-gridCollectionItem']/table");
54  //        assertElementPresentByXpath("//div[@id='Demo-StackedLayoutManager-Collection2']/div[2]/div[3]/table/tbody/tr/td/div/input[@name='collection4[1].field1']");
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]/div[@class='uif-collectionItem uif-gridCollectionItem']/table/tbody/tr/td/div/input");
60          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");
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-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']"))
71          {
72              fail("Ajax Disclosure Not working!");
73          }
74          waitAndClickByLinkText("Item 100");
75          Thread.sleep(3000);
76          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']");
77      }
78      
79      @Test
80      public void testLayoutManagersStackedLayoutBookmark() throws Exception {
81          testLayoutManagersStackedLayout();
82          testLayoutManagersStackedWithTableSubCollectionLayout();
83          testLayoutManagersStackedWithStackedSubCollectionLayout();
84          testLayoutManagersStackedCollectionWithServersidePaging();
85          testLayoutManagersStackedCollectionAjaxDisclosures();
86          passed();
87      }
88  
89      @Test
90      public void testLayoutManagersStackedLayoutNav() throws Exception {
91          testLayoutManagersStackedLayout();
92          testLayoutManagersStackedWithTableSubCollectionLayout();
93          testLayoutManagersStackedWithStackedSubCollectionLayout();
94          testLayoutManagersStackedCollectionWithServersidePaging();
95          testLayoutManagersStackedCollectionAjaxDisclosures();
96          passed();
97      }  
98  }