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 DemoLibraryLayoutManagersCssGridLayoutSmokeTest extends SmokeTestBase {
029    
030        /**
031         * /kr-krad/kradsampleapp?viewId=Demo-CssGridLayoutManager-View&methodToCall=start
032         */
033        public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-CssGridLayoutManager-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("Css Grid Layout");
045        }
046    
047        protected void testLayoutManagersCssGridLayoutDefault() throws Exception {
048            waitForElementPresentByXpath("//div[@id='Demo-CssGridLayoutManager-Example1']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='uif-cssGridLayout']/div/div/div/input");
049            assertElementPresentByXpath("//div[@id='Demo-CssGridLayoutManager-Example1']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='uif-cssGridLayout']/div/div[2]/div/input");
050            assertElementPresentByXpath("//div[@id='Demo-CssGridLayoutManager-Example1']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='uif-cssGridLayout']/div/div[3]/div/input");
051            assertElementPresentByXpath("//div[@id='Demo-CssGridLayoutManager-Example1']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='uif-cssGridLayout']/div[2]/div/div/input");
052            assertElementPresentByXpath("//div[@id='Demo-CssGridLayoutManager-Example1']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='uif-cssGridLayout']/div[2]/div[2]/div/input");
053        }
054        
055        protected void testLayoutManagersCssGridLayoutDefaultWidthBehaviour() throws Exception {
056            selectByName("exampleShown", "Default width behavior");
057            waitForElementPresentByXpath("//div[@id='Demo-CssGridLayoutManager-Example2']/div[@class='uif-verticalBoxLayout clearfix']/div/div/div/div/div/input");
058            assertElementPresentByXpath("//div[@id='Demo-CssGridLayoutManager-Example2']/div[@class='uif-verticalBoxLayout clearfix']/div/div/div[2]/div/div/input");
059            assertElementPresentByXpath("//div[@id='Demo-CssGridLayoutManager-Example2']/div[@class='uif-verticalBoxLayout clearfix']/div/div/div[2]/div[2]/div/input");
060         }
061        
062        protected void testLayoutManagersCssGridLayoutRowCss() throws Exception {
063            selectByName("exampleShown", "Row Css");
064            waitForElementPresentByXpath("//div[@class='row demo-odd demo-border']/div/div/input[@name='inputField17']");
065            assertElementPresentByXpath("//div[@class='row demo-odd demo-border']/div/div/input[@name='inputField18']");
066            assertElementPresentByXpath("//div[@class='row demo-odd demo-border']/div/div/input[@name='inputField19']");
067            assertElementPresentByXpath("//div[@class='row demo-even demo-border']/div/div/input[@name='inputField20']");
068            assertElementPresentByXpath("//div[@class='row demo-even demo-border']/div/div/input[@name='inputField21']");
069         }
070        
071        protected void testLayoutManagersCssGridLayoutDefaultColspan() throws Exception {
072            selectByName("exampleShown", "Default ColSpan");
073            waitForElementPresentByXpath("//div[@id='Demo-CssGridLayoutManager-Example6']/div[@class='uif-verticalBoxLayout clearfix']/div/div/div/div/div/input[@name='inputField22']");
074            assertElementPresentByXpath("//div[@id='Demo-CssGridLayoutManager-Example6']/div[@class='uif-verticalBoxLayout clearfix']/div/div/div/div/div/input[@name='inputField23']");
075            assertElementPresentByXpath("//div[@id='Demo-CssGridLayoutManager-Example6']/div[@class='uif-verticalBoxLayout clearfix']/div/div/div/div/div/input[@name='inputField24']");
076            assertElementPresentByXpath("//div[@id='Demo-CssGridLayoutManager-Example6']/div[@class='uif-verticalBoxLayout clearfix']/div/div/div/div/div/input[@name='inputField25']");
077            assertElementPresentByXpath("//div[@id='Demo-CssGridLayoutManager-Example6']/div[@class='uif-verticalBoxLayout clearfix']/div/div/div/div/div/input[@name='inputField26']");
078        }
079        
080        protected void testLayoutManagersCssGridLayoutGroupLayout() throws Exception {
081            selectByName("exampleShown", "Group Layout");
082            waitForElementPresentByXpath("//div[@id='Demo-CssGridLayoutManager-Example7']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='uif-cssGridLayout']/div/div/div[@class='uif-boxSection' and @style='background-color: #00CC66; height: 200px;']");
083            assertElementPresentByXpath("//div[@id='Demo-CssGridLayoutManager-Example7']/div[@class='uif-verticalBoxLayout clearfix']/div/div[@class='uif-cssGridLayout']/div/div/div[@class='uif-boxSection' and @style='background-color: #00CCFF; height: 200px;']");
084         }
085        
086        @Test
087        public void testLayoutManagersCssGridLayoutBookmark() throws Exception {
088            testLayoutManagersCssGridLayoutDefault();
089            testLayoutManagersCssGridLayoutDefaultWidthBehaviour();
090            testLayoutManagersCssGridLayoutRowCss();
091            testLayoutManagersCssGridLayoutDefaultColspan();
092            testLayoutManagersCssGridLayoutGroupLayout();
093            passed();
094        }
095    
096        @Test
097        public void testLayoutManagersCssGridLayoutNav() throws Exception {
098            testLayoutManagersCssGridLayoutDefault();
099            testLayoutManagersCssGridLayoutDefaultWidthBehaviour();
100            testLayoutManagersCssGridLayoutRowCss();
101            testLayoutManagersCssGridLayoutDefaultColspan();
102            testLayoutManagersCssGridLayoutGroupLayout();
103            passed();
104        }  
105    }