View Javadoc
1   /**
2    * Copyright 2005-2015 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  
20  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
21  
22  /**
23   * @author Kuali Rice Team (rice.collab@kuali.org)
24   */
25  public class LibraryLayoutManagersGridLayoutAft extends WebDriverLegacyITBase {
26  
27      /**
28       * /kr-krad/kradsampleapp?viewId=Demo-GridLayoutManagerView&methodToCall=start
29       */
30      public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-GridLayoutManagerView&methodToCall=start";
31  
32      @Override
33      protected String getBookmarkUrl() {
34          return BOOKMARK_URL;
35      }
36  
37      @Override
38      protected void navigate() throws Exception {
39          waitAndClickLibraryLink();
40          waitAndClickByLinkText("Layout Managers");
41          waitAndClickByLinkText("Grid Layout");
42      }
43  
44      protected void testLayoutManagersGridLayout() throws Exception {
45         assertElementPresentByXpath("//div[@data-parent='Demo-GridLayoutManager-Example1']/table/tbody/tr/th/label");
46         assertElementPresentByXpath("//div[@data-parent='Demo-GridLayoutManager-Example1']/table/tbody/tr/td/div/input");
47         assertElementPresentByXpath("//div[@data-parent='Demo-GridLayoutManager-Example1']/table/tbody/tr[2]/th/label");
48         assertElementPresentByXpath("//div[@data-parent='Demo-GridLayoutManager-Example1']/table/tbody/tr[2]/td/div/input");
49         assertElementPresentByXpath("//div[@data-parent='Demo-GridLayoutManager-Example1']/table/tbody/tr[3]/th/label");
50         assertElementPresentByXpath("//div[@data-parent='Demo-GridLayoutManager-Example1']/table/tbody/tr[3]/td/div/input");
51      }
52      
53      protected void testLayoutManagersGridLayouMultipleColumns() throws Exception {
54          selectByName("exampleShown","# of Columns");
55          assertElementPresentByXpath("//div[@data-parent='Demo-GridLayoutManager-Example2']/table/tbody/tr/th/label");
56          assertElementPresentByXpath("//div[@data-parent='Demo-GridLayoutManager-Example2']/table/tbody/tr/td/div/input[@name='inputField4']");
57          assertElementPresentByXpath("//div[@data-parent='Demo-GridLayoutManager-Example2']/table/tbody/tr/th[2]/label");
58          assertElementPresentByXpath("//div[@data-parent='Demo-GridLayoutManager-Example2']/table/tbody/tr/td[2]/div/input[@name='inputField5']");
59      }
60      
61      protected void testLayoutManagersGridLayoutColumnSpan() throws Exception {
62          selectByName("exampleShown","Column Span");
63          assertElementPresentByXpath("//div[@data-parent='Demo-GridLayoutManager-Example3']/table/tbody/tr/th[@colspan='2']/label");
64          assertElementPresentByXpath("//div[@data-parent='Demo-GridLayoutManager-Example3']/table/tbody/tr/td[@colspan='2']/div/input[@name='inputField8']");
65          assertElementPresentByXpath("//div[@data-parent='Demo-GridLayoutManager-Example3']/table/tbody/tr/th[@colspan='1']/label");
66          assertElementPresentByXpath("//div[@data-parent='Demo-GridLayoutManager-Example3']/table/tbody/tr/td[@colspan='1']/div/input[@name='inputField9']");
67          assertElementPresentByXpath("//div[@data-parent='Demo-GridLayoutManager-Example3']/table/tbody/tr/th[@colspan='1'][2]/label");
68          assertElementPresentByXpath("//div[@data-parent='Demo-GridLayoutManager-Example3']/table/tbody/tr/td[@colspan='1'][2]/div/input[@name='inputField10']");
69      }
70      
71      protected void testLayoutManagersGridLayoutRenderTHColumn() throws Exception {
72          selectByName("exampleShown","Render TH Column");
73          assertElementPresentByXpath("//div[@data-parent='Demo-GridLayoutManager-Example4']/table/tbody/tr/td/label");
74          assertElementPresentByXpath("//div[@data-parent='Demo-GridLayoutManager-Example4']/table/tbody/tr/td/div/input[@name='inputField12']");
75      }
76      
77      protected void testLayoutManagersGridLayoutRowSpan() throws Exception {
78          selectByName("exampleShown","Row Span");
79          assertElementPresentByXpath("//div[@data-parent='Demo-GridLayoutManager-Example5']/table/tbody/tr/td[@rowspan='2']");
80          assertElementPresentByXpath("//div[@data-parent='Demo-GridLayoutManager-Example5']/table/tbody/tr/td[@rowspan='1']");
81          assertElementPresentByXpath("//div[@data-parent='Demo-GridLayoutManager-Example5']/table/tbody/tr/td[@rowspan='3']");
82      }
83      
84      protected void testLayoutManagersGridLayoutFieldGroup() throws Exception {
85          selectByName("exampleShown","Field Group");
86          assertElementPresentByXpath("//div[@data-parent='Demo-GridLayoutManager-Example6']/table/tbody/tr/td/label");
87          assertElementPresentByXpath("//div[@data-parent='Demo-GridLayoutManager-Example6']/table/tbody/tr/td/div[@class='uif-horizontalFieldGroup']");
88      }
89      
90      protected void testLayoutManagersGridLayoutNestedLayout() throws Exception {
91          selectByName("exampleShown","Nested Layout");
92          assertElementPresentByXpath("//section[@id='Demo-GridLayoutManager-Example7']/div/table/tbody/tr/th[@class='uif-gridLayoutCell']/section/table");
93          assertElementPresentByXpath("//section[@id='Demo-GridLayoutManager-Example7']/div/table/tbody/tr/td[@class='uif-gridLayoutCell']/section/table");
94      }
95      
96      @Test
97      public void testLayoutManagersGridLayoutBookmark() throws Exception {
98      	testLayoutManagersGridLayoutAll();
99      }
100 
101     @Test
102     public void testLayoutManagersGridLayoutNav() throws Exception {
103     	testLayoutManagersGridLayoutAll();
104     }  
105     
106     private void testLayoutManagersGridLayoutAll() throws Exception {
107     	testLayoutManagersGridLayout();
108         testLayoutManagersGridLayouMultipleColumns();
109         testLayoutManagersGridLayoutColumnSpan();
110         testLayoutManagersGridLayoutRenderTHColumn();
111         testLayoutManagersGridLayoutRowSpan();
112         testLayoutManagersGridLayoutFieldGroup();
113         testLayoutManagersGridLayoutNestedLayout();
114         passed();
115     }
116 }