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.Failable;
21  import org.kuali.rice.testtools.selenium.ITUtil;
22  import org.kuali.rice.testtools.selenium.SmokeTestBase;
23  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
24  
25  /**
26   * @author Kuali Rice Team (rice.collab@kuali.org)
27   */
28  public class DemoLibraryLayoutManagersBoxLayoutSmokeTest extends SmokeTestBase {
29  
30      /**
31       * /kr-krad/kradsampleapp?viewId=Demo-BoxLayoutManager-View&methodToCall=start
32       */
33      public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-BoxLayoutManager-View&methodToCall=start";
34  
35      @Override
36      protected String getBookmarkUrl() {
37          return BOOKMARK_URL;
38      }
39  
40      @Override
41      protected void navigate() throws Exception {
42          waitAndClickById("Demo-LibraryLink", "");
43          waitAndClickByLinkText("Layout Managers");
44          waitAndClickByLinkText("Box Layout");
45      }
46  
47      protected void testLayoutManagersVerticalBoxLayout() throws Exception {
48         assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example1']/div/div/span/label");
49         assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example1']/div/div/input[@name='inputField1']");
50         assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example1']/div/div[2]/span/label");
51         assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example1']/div/div[2]/input[@name='inputField2']");
52      }
53      
54      protected void testLayoutManagersHorizontalBoxLayout() throws Exception {
55          selectByName("exampleShown","Horizontal Box Layout");
56          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example2']/div/div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutHorizontalItem']/span/label");
57          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example2']/div/div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutHorizontalItem']/input[@name='inputField5']");
58          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example2']/div/div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutHorizontalItem'][2]/span/label");
59          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example2']/div/div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutHorizontalItem'][2]/input[@name='inputField6']");
60      }
61      
62      protected void testLayoutManagersNestedExample1() throws Exception {
63          selectByName("exampleShown","Nested Example 1");
64          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example3']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='uif-horizontalBoxLayout clearfix']/div/span/label");
65          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example3']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='uif-horizontalBoxLayout clearfix']/div/input[@name='inputField9']");
66          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example3']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='uif-horizontalBoxLayout clearfix']/div[2]/span/label");
67          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example3']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='uif-horizontalBoxLayout clearfix']/div[2]/input[@name='inputField10']");
68      }
69      
70      protected void testLayoutManagersNestedExample2() throws Exception {
71          selectByName("exampleShown","Nested Example 2");
72          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example4']/div[@class='uif-horizontalBoxLayout clearfix']/div/div[@class='uif-verticalBoxLayout clearfix']/div/span/label");
73          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example4']/div[@class='uif-horizontalBoxLayout clearfix']/div/div[@class='uif-verticalBoxLayout clearfix']/div/input[@name='inputField13']");
74          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example4']/div[@class='uif-horizontalBoxLayout clearfix']/div/div[@class='uif-verticalBoxLayout clearfix']/div[2]/span/label");
75          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example4']/div[@class='uif-horizontalBoxLayout clearfix']/div/div[@class='uif-verticalBoxLayout clearfix']/div[2]/input[@name='inputField14']");
76      }
77      
78      protected void testLayoutManagersBoxLayoutPadding() throws Exception {
79          selectByName("exampleShown","Padding");
80          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example5']/div/div[@style='padding-bottom: 50px;']/span/label");
81          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example5']/div/div[@style='padding-bottom: 50px;']/input[@name='inputField17']");
82          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example5']/div/div[@style='padding-bottom: 50px;'][2]/span/label");
83          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example5']/div/div[@style='padding-bottom: 50px;'][2]/input[@name='inputField18']");
84      }
85      
86      protected void testLayoutManagersBoxLayoutItemCSS() throws Exception {
87          selectByName("exampleShown","Item CSS");
88          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example6']/div/div/span[@class='uif-labelTop uif-labelBlock']");
89          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example6']/div/div/input[@name='inputField21' and @class='uif-textControl']");
90      }
91      
92      protected void testLayoutManagersBoxLayoutItemStyle() throws Exception {
93          selectByName("exampleShown","Item style");
94          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example7']/div/div[@style='background-color: #99FF99; margin-right: 5px; padding: 5px;']/span");
95          assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example7']/div/div[@style='background-color: #99FF99; margin-right: 5px; padding: 5px;']/input[@name='inputField24']");
96      }
97      
98      @Test
99      public void testLayoutManagersBoxLayoutBookmark() throws Exception {
100         testLayoutManagersVerticalBoxLayout();
101         testLayoutManagersHorizontalBoxLayout();
102         testLayoutManagersNestedExample1();
103         testLayoutManagersNestedExample2();
104         testLayoutManagersBoxLayoutPadding();
105         testLayoutManagersBoxLayoutItemCSS();
106         testLayoutManagersBoxLayoutItemStyle();
107         passed();
108     }
109 
110     @Test
111     public void testLayoutManagersBoxLayoutNav() throws Exception {
112         testLayoutManagersVerticalBoxLayout();
113         testLayoutManagersHorizontalBoxLayout();
114         testLayoutManagersNestedExample1();
115         testLayoutManagersNestedExample2();
116         testLayoutManagersBoxLayoutPadding();
117         testLayoutManagersBoxLayoutItemCSS();
118         testLayoutManagersBoxLayoutItemStyle();
119         passed();
120     }  
121 }