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 LibraryLayoutManagersBoxLayoutAft extends WebDriverLegacyITBase {
26  
27      /**
28       * /kr-krad/kradsampleapp?viewId=Demo-BoxLayoutManagerView&methodToCall=start
29       */
30      public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-BoxLayoutManagerView&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("Box Layout");
42      }
43  
44      protected void testLayoutManagersVerticalBoxLayout() throws Exception {
45         assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example1']/div/label");
46         assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example1']/div/input[@name='inputField1']");
47         assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example1']/div[2]/label");
48         assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example1']/div[2]/input[@name='inputField2']");
49      }
50      
51      protected void testLayoutManagersHorizontalBoxLayout() throws Exception {
52          selectByName("exampleShown","Horizontal Box Layout");
53          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example2']/div/label");
54          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example2']/div/input[@name='inputField5']");
55          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example2']/div[2]/label");
56          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example2']/div[2]/input[@name='inputField6']");
57      }
58      
59      protected void testLayoutManagersNestedExample1() throws Exception {
60          selectByName("exampleShown","Nested Example 1");
61          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example3']/div/div/label");
62          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example3']/div/div/input[@name='inputField9']");
63          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example3']/div/div[2]/label");
64          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example3']/div/div[2]/input[@name='inputField10']");
65      }
66      
67      protected void testLayoutManagersNestedExample2() throws Exception {
68          selectByName("exampleShown","Nested Example 2");
69          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example4']/div/div/label");
70          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example4']/div/div/input[@name='inputField13']");
71          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example4']/div/div[2]/label");
72          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example4']/div/div[2]/input[@name='inputField14']");
73      }
74      
75      protected void testLayoutManagersBoxLayoutPadding() throws Exception {
76          selectByName("exampleShown","Padding");
77          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example5']/div[@style='padding-bottom: 50px;']/label");
78          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example5']/div[@style='padding-bottom: 50px;']/input[@name='inputField17']");
79          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example5']/div[@style='padding-bottom: 50px;'][2]/label");
80          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example5']/div[@style='padding-bottom: 50px;'][2]/input[@name='inputField18']");
81      }
82      
83      protected void testLayoutManagersBoxLayoutItemCSS() throws Exception {
84          selectByName("exampleShown","Item CSS");
85          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example6']/div[@class='uif-inputField uif-boxLayoutVerticalItem pull-left demo-borderBottom clearfix']");
86          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example6']/div/label[@class='clearfix uif-label uif-labelBlock']");
87          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example6']/div/input[@name='inputField21']");
88      }
89      
90      protected void testLayoutManagersBoxLayoutItemStyle() throws Exception {
91          selectByName("exampleShown","Item style");
92          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example7']/div[@style='background-color: #99FF99; margin-right: 5px; padding: 5px;']/label");
93          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example7']/div[@style='background-color: #99FF99; margin-right: 5px; padding: 5px;']/input[@name='inputField24']");
94      }
95      
96      @Test
97      public void testLayoutManagersBoxLayoutBookmark() throws Exception {
98          testLayoutManagersVerticalBoxLayout();
99          testLayoutManagersHorizontalBoxLayout();
100         testLayoutManagersNestedExample1();
101         testLayoutManagersNestedExample2();
102         testLayoutManagersBoxLayoutPadding();
103         testLayoutManagersBoxLayoutItemCSS();
104         testLayoutManagersBoxLayoutItemStyle();
105         passed();
106     }
107 
108     @Test
109     public void testLayoutManagersBoxLayoutNav() throws Exception {
110         testLayoutManagersVerticalBoxLayout();
111         testLayoutManagersHorizontalBoxLayout();
112         testLayoutManagersNestedExample1();
113         testLayoutManagersNestedExample2();
114         testLayoutManagersBoxLayoutPadding();
115         testLayoutManagersBoxLayoutItemCSS();
116         testLayoutManagersBoxLayoutItemStyle();
117         passed();
118     }  
119 }