001 /**
002 * Copyright 2005-2013 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016 package edu.samplu.krad.library.layoutmanagers;
017
018 import org.junit.Test;
019
020 import org.kuali.rice.testtools.selenium.Failable;
021 import org.kuali.rice.testtools.selenium.ITUtil;
022 import org.kuali.rice.testtools.selenium.SmokeTestBase;
023 import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
024
025 /**
026 * @author Kuali Rice Team (rice.collab@kuali.org)
027 */
028 public class DemoLibraryLayoutManagersBoxLayoutSmokeTest extends SmokeTestBase {
029
030 /**
031 * /kr-krad/kradsampleapp?viewId=Demo-BoxLayoutManager-View&methodToCall=start
032 */
033 public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-BoxLayoutManager-View&methodToCall=start";
034
035 @Override
036 protected String getBookmarkUrl() {
037 return BOOKMARK_URL;
038 }
039
040 @Override
041 protected void navigate() throws Exception {
042 waitAndClickById("Demo-LibraryLink", "");
043 waitAndClickByLinkText("Layout Managers");
044 waitAndClickByLinkText("Box Layout");
045 }
046
047 protected void testLayoutManagersVerticalBoxLayout() throws Exception {
048 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example1']/div/div/span/label");
049 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example1']/div/div/input[@name='inputField1']");
050 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example1']/div/div[2]/span/label");
051 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example1']/div/div[2]/input[@name='inputField2']");
052 }
053
054 protected void testLayoutManagersHorizontalBoxLayout() throws Exception {
055 selectByName("exampleShown","Horizontal Box Layout");
056 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example2']/div/div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutHorizontalItem']/span/label");
057 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example2']/div/div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutHorizontalItem']/input[@name='inputField5']");
058 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example2']/div/div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutHorizontalItem'][2]/span/label");
059 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example2']/div/div[@class='uif-inputField uif-inputField-labelTop uif-boxLayoutHorizontalItem'][2]/input[@name='inputField6']");
060 }
061
062 protected void testLayoutManagersNestedExample1() throws Exception {
063 selectByName("exampleShown","Nested Example 1");
064 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example3']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='uif-horizontalBoxLayout clearfix']/div/span/label");
065 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example3']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='uif-horizontalBoxLayout clearfix']/div/input[@name='inputField9']");
066 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example3']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='uif-horizontalBoxLayout clearfix']/div[2]/span/label");
067 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example3']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='uif-horizontalBoxLayout clearfix']/div[2]/input[@name='inputField10']");
068 }
069
070 protected void testLayoutManagersNestedExample2() throws Exception {
071 selectByName("exampleShown","Nested Example 2");
072 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example4']/div[@class='uif-horizontalBoxLayout clearfix']/div/div[@class='uif-verticalBoxLayout clearfix']/div/span/label");
073 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example4']/div[@class='uif-horizontalBoxLayout clearfix']/div/div[@class='uif-verticalBoxLayout clearfix']/div/input[@name='inputField13']");
074 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example4']/div[@class='uif-horizontalBoxLayout clearfix']/div/div[@class='uif-verticalBoxLayout clearfix']/div[2]/span/label");
075 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example4']/div[@class='uif-horizontalBoxLayout clearfix']/div/div[@class='uif-verticalBoxLayout clearfix']/div[2]/input[@name='inputField14']");
076 }
077
078 protected void testLayoutManagersBoxLayoutPadding() throws Exception {
079 selectByName("exampleShown","Padding");
080 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example5']/div/div[@style='padding-bottom: 50px;']/span/label");
081 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example5']/div/div[@style='padding-bottom: 50px;']/input[@name='inputField17']");
082 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example5']/div/div[@style='padding-bottom: 50px;'][2]/span/label");
083 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example5']/div/div[@style='padding-bottom: 50px;'][2]/input[@name='inputField18']");
084 }
085
086 protected void testLayoutManagersBoxLayoutItemCSS() throws Exception {
087 selectByName("exampleShown","Item CSS");
088 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example6']/div/div/span[@class='uif-labelTop uif-labelBlock']");
089 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example6']/div/div/input[@name='inputField21' and @class='uif-textControl']");
090 }
091
092 protected void testLayoutManagersBoxLayoutItemStyle() throws Exception {
093 selectByName("exampleShown","Item style");
094 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example7']/div/div[@style='background-color: #99FF99; margin-right: 5px; padding: 5px;']/span");
095 assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example7']/div/div[@style='background-color: #99FF99; margin-right: 5px; padding: 5px;']/input[@name='inputField24']");
096 }
097
098 @Test
099 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 }