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.clientresponsiveness;
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 LibraryClientResponsivenessConditionalRefreshAft extends WebDriverLegacyITBase {
026
027    /**
028     * /kr-krad/kradsampleapp?viewId=Demo-ConditionalRefreshView&methodToCall=start
029     */
030    public static final String BOOKMARK_URL = "/kr-krad/kradsampleapp?viewId=Demo-ConditionalRefreshView&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("Client Responsiveness");
041        waitAndClickByLinkText("Conditional Refresh");
042    }
043
044    protected void testClientResponsivenessConditionalRefresh() throws Exception {
045       //Scenario-1
046      assertIsVisibleByXpath("//input[@name='inputField1']", "Is Visible");
047      waitAndClickByName("booleanField1");
048      assertIsVisibleByXpath("//input[@name='inputField1']","Visible");
049    }
050    
051    protected void testClientResponsivenessConditionalRefreshWhenChanged() throws Exception {
052        waitAndClickByLinkText("Refresh when Changed");
053        assertElementPresentByXpath("//input[@name='inputField3']", "element");
054        waitAndClickByXpath("//input[@name='inputField2' and @value='input']");
055        waitAndTypeByName("inputField3","asd");
056        waitAndClickByXpath("//input[@name='inputField2' and @value='readOnly']");
057        isTextPresent("asd");
058    }
059    
060    protected void testClientResponsivenessConditionalRefreshRefreshAdvancedExample() throws Exception {
061        waitAndClickByLinkText("Advanced Example");
062        selectByName("inputField5","Apple");
063        waitAndSelectByName("inputField4","Vegetables");
064        waitAndSelectByName("inputField5","Beans");
065    }
066    
067    @Test
068    public void testClientResponsivenessConditionalRefreshBookmark() throws Exception {
069        testClientResponsivenessConditionalRefresh();
070        testClientResponsivenessConditionalRefreshWhenChanged();
071        testClientResponsivenessConditionalRefreshRefreshAdvancedExample();
072        passed();
073    }
074
075    @Test
076    public void testClientResponsivenessConditionalRefreshNav() throws Exception {
077        testClientResponsivenessConditionalRefresh();
078        testClientResponsivenessConditionalRefreshWhenChanged();
079        testClientResponsivenessConditionalRefreshRefreshAdvancedExample();
080        passed();
081    }  
082}