001/**
002 * Copyright 2005-2015 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 */
016package org.kuali.rice.krad.demo.uif.library.layoutmanagers;
017
018import org.junit.Test;
019
020import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
021
022/**
023 * @author Kuali Rice Team (rice.collab@kuali.org)
024 */
025public class LibraryLayoutManagersBoxLayoutAft extends WebDriverLegacyITBase {
026
027    /**
028     * /kr-krad/kradsampleapp?viewId=Demo-BoxLayoutManagerView&methodToCall=start
029     */
030    public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-BoxLayoutManagerView&methodToCall=start";
031
032    @Override
033    protected String getBookmarkUrl() {
034        return BOOKMARK_URL;
035    }
036
037    @Override
038    protected void navigate() throws Exception {
039        waitAndClickLibraryLink();
040        waitAndClickByLinkText("Layout Managers");
041        waitAndClickByLinkText("Box Layout");
042    }
043
044    protected void testLayoutManagersVerticalBoxLayout() throws Exception {
045       assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example1']/div/label");
046       assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example1']/div/input[@name='inputField1']");
047       assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example1']/div[2]/label");
048       assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example1']/div[2]/input[@name='inputField2']");
049    }
050    
051    protected void testLayoutManagersHorizontalBoxLayout() throws Exception {
052        selectByName("exampleShown","Horizontal Box Layout");
053        assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example2']/div/label");
054        assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example2']/div/input[@name='inputField5']");
055        assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example2']/div[2]/label");
056        assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example2']/div[2]/input[@name='inputField6']");
057    }
058    
059    protected void testLayoutManagersNestedExample1() throws Exception {
060        selectByName("exampleShown","Nested Example 1");
061        assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example3']/div/div/label");
062        assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example3']/div/div/input[@name='inputField9']");
063        assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example3']/div/div[2]/label");
064        assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example3']/div/div[2]/input[@name='inputField10']");
065    }
066    
067    protected void testLayoutManagersNestedExample2() throws Exception {
068        selectByName("exampleShown","Nested Example 2");
069        assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example4']/div/div/label");
070        assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example4']/div/div/input[@name='inputField13']");
071        assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example4']/div/div[2]/label");
072        assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example4']/div/div[2]/input[@name='inputField14']");
073    }
074    
075    protected void testLayoutManagersBoxLayoutPadding() throws Exception {
076        selectByName("exampleShown","Padding");
077        assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example5']/div[@style='padding-bottom: 50px;']/label");
078        assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example5']/div[@style='padding-bottom: 50px;']/input[@name='inputField17']");
079        assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example5']/div[@style='padding-bottom: 50px;'][2]/label");
080        assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example5']/div[@style='padding-bottom: 50px;'][2]/input[@name='inputField18']");
081    }
082    
083    protected void testLayoutManagersBoxLayoutItemCSS() throws Exception {
084        selectByName("exampleShown","Item CSS");
085        assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example6']/div[@class='uif-inputField uif-boxLayoutVerticalItem pull-left demo-borderBottom clearfix']");
086        assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example6']/div/label[@class='clearfix uif-label uif-labelBlock']");
087        assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example6']/div/input[@name='inputField21']");
088    }
089    
090    protected void testLayoutManagersBoxLayoutItemStyle() throws Exception {
091        selectByName("exampleShown","Item style");
092        assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example7']/div[@style='background-color: #99FF99; margin-right: 5px; padding: 5px;']/label");
093        assertElementPresentByXpath("//div[@data-parent='Demo-BoxLayoutManager-Example7']/div[@style='background-color: #99FF99; margin-right: 5px; padding: 5px;']/input[@name='inputField24']");
094    }
095    
096    @Test
097    public void testLayoutManagersBoxLayoutBookmark() throws Exception {
098        testLayoutManagersVerticalBoxLayout();
099        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}