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.clientresponsiveness;
017    
018    import org.junit.Test;
019    
020    import edu.samplu.common.Failable;
021    import edu.samplu.common.ITUtil;
022    import edu.samplu.common.SmokeTestBase;
023    import edu.samplu.common.WebDriverLegacyITBase;
024    
025    /**
026     * @author Kuali Rice Team (rice.collab@kuali.org)
027     */
028    public class LibraryClientResponsivenessConditionalRefreshSmokeTest extends SmokeTestBase {
029    
030        /**
031         * /kr-krad/kradsampleapp?viewId=Demo-ConditionalRefresh-View&methodToCall=start
032         */
033        public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-ConditionalRefresh-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("Client Responsiveness");
044            waitAndClickByLinkText("Conditional Refresh");
045        }
046    
047        protected void testClientResponsivenessConditionalRefresh() throws Exception {
048           //Scenario-1
049          assertIsVisibleByXpath("//input[@name='inputField1']", "Is Visible");
050          waitAndClickByName("booleanField1");
051          assertIsVisibleByXpath("//input[@name='inputField1']","Visible");
052        }
053        
054        protected void testClientResponsivenessConditionalRefreshWhenChanged() throws Exception {
055            waitAndClickByLinkText("Refresh when Changed");
056            assertElementPresentByXpath("//input[@name='inputField3']", "element");
057            waitAndClickByXpath("//input[@name='inputField2' and @value='input']");
058            waitAndTypeByName("inputField3","asd");
059            waitAndClickByXpath("//input[@name='inputField2' and @value='readOnly']");
060            isTextPresent("asd");
061        }
062        
063        protected void testClientResponsivenessConditionalRefreshRefreshAdvancedExample() throws Exception {
064            waitAndClickByLinkText("Advanced Example");
065            selectByName("inputField5","Apple");
066            selectByName("inputField4","Vegetables");
067            selectByName("inputField5","Beans");
068        }
069        
070        @Test
071        public void testClientResponsivenessConditionalRefreshBookmark() throws Exception {
072            testClientResponsivenessConditionalRefresh();
073            testClientResponsivenessConditionalRefreshWhenChanged();
074            testClientResponsivenessConditionalRefreshRefreshAdvancedExample();
075            passed();
076        }
077    
078        @Test
079        public void testClientResponsivenessConditionalRefreshNav() throws Exception {
080            testClientResponsivenessConditionalRefresh();
081            testClientResponsivenessConditionalRefreshWhenChanged();
082            testClientResponsivenessConditionalRefreshRefreshAdvancedExample();
083            passed();
084        }  
085    }