001    /**
002     * Copyright 2005-2014 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.sampleu.krad.screenelement;
017    
018    import org.junit.Test;
019    import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
020    import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
021    import org.kuali.rice.testtools.selenium.WebDriverUtils;
022    import org.openqa.selenium.By;
023    
024    /**
025     * @author Kuali Rice Team (rice.collab@kuali.org)
026     */
027    public class ClientSideDisableAft extends WebDriverLegacyITBase {
028    
029        /**
030         * /kr-krad/uicomponents?viewId=ClientDisableView&methodToCall=start
031         */
032        public static final String BOOKMARK_URL ="/kr-krad/uicomponents?viewId=ClientDisableView&methodToCall=start";
033    
034        @Override
035        protected String getBookmarkUrl() {
036            return BOOKMARK_URL;
037        }
038    
039        @Override
040        protected void navigate() throws InterruptedException {
041            waitAndClickKRAD();
042            waitAndClickByLinkText("Client-side disable");
043            switchToWindow("Kuali :: Client-side Disable");
044        }
045        
046        private void testClientSideDisable() throws Exception{
047            waitAndClickByXpath("//input[@name='field118' and @value='disable']");
048            waitForElementPresentByXpath("//input[@name='field2' and @disabled]");
049            waitForElementPresentByXpath("//textarea[@name='field3' and @disabled]");
050            waitForElementPresentByXpath("//select[@name='field3' and @disabled]");
051            waitForElementPresentByXpath("//select[@name='field114' and @disabled]");
052            waitForElementPresentByXpath("//input[@name='field117' and @type='radio' and @disabled]");
053            waitForElementPresentByXpath("//input[@name='bField1' and @type='checkbox' and @disabled]");
054            waitForElementPresentByXpath("//input[@name='field115' and @type='checkbox' and @disabled]");
055            waitForElementPresentByXpath("//button[contains(text(),'Action Button') and @disabled]");
056            waitAndClickByXpath("//input[@name='field118' and @value='enable']");
057            waitForElementNotPresent(By.xpath("//input[@name='field2' and @disabled]"));
058            waitForElementNotPresent(By.xpath("//textarea[@name='field3' and @disabled]"));
059            waitForElementNotPresent(By.xpath("//select[@name='field3' and @disabled]"));
060            waitForElementNotPresent(By.xpath("//select[@name='field114' and @disabled]"));
061            waitForElementNotPresent(By.xpath("//input[@name='field117' and @type='radio' and @disabled]"));
062            waitForElementNotPresent(By.xpath("//input[@name='bField1' and @type='checkbox' and @disabled]"));
063            waitForElementNotPresent(By.xpath("//input[@name='field115' and @type='checkbox' and @disabled]"));
064            waitAndTypeByName("field50","hi");
065            waitAndTypeByName("field51","hello");
066            waitForElementPresentByXpath("//input[@name='field54' and @disabled]");
067            waitAndTypeByName("field52","hello");
068            waitForElementPresentByXpath("//input[@name='field54']");
069            waitAndTypeByName("field53","disable");
070            waitForElementPresentByXpath("//button[contains(text(),'Action Button (change)') and @disabled]");
071            waitAndTypeByName("field52","");
072            waitForElementPresentByXpath("//button[contains(text(),'Action Button (keyUp)') and @disabled]");
073            waitForElementPresentByXpath("//button[@id='Demo-DisableSection4_add' and @disabled]");
074            waitForElementPresentByXpath("//input[@name='field12' and @disabled]");
075            waitForElementNotPresent(By.xpath("//input[@name='field10' and @disabled]"));
076            waitAndClickByXpath("//input[@name='stringList2' and @value='1']");
077            waitForElementPresentByXpath("//input[@name='field10' and @disabled]");
078            waitForElementNotPresent(By.xpath("//input[@name='field12' and @disabled]"));
079            waitAndClickByXpath("//input[@name='stringList2' and @value='2']");
080            waitAndClickByXpath("//input[@name='stringList2' and @value='3']");
081            waitForElementPresentByXpath("//input[@name='field11' and @disabled]");
082        }
083        
084        @Test
085        public void testClientSideDisableBookmark() throws Exception {
086            testClientSideDisable();
087            passed();
088        }
089    
090        @Test
091        public void testClientSideDisableNav() throws Exception {
092            testClientSideDisable();
093            passed();
094        }
095        
096    }