View Javadoc
1   /**
2    * Copyright 2005-2015 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package edu.sampleu.krad.screenelement;
17  
18  import org.junit.Test;
19  import org.kuali.rice.testtools.selenium.AutomatedFunctionalTestUtils;
20  import org.kuali.rice.testtools.selenium.WebDriverLegacyITBase;
21  import org.kuali.rice.testtools.selenium.WebDriverUtils;
22  import org.openqa.selenium.By;
23  
24  /**
25   * @author Kuali Rice Team (rice.collab@kuali.org)
26   */
27  public class ClientSideDisableAft extends WebDriverLegacyITBase {
28  
29      /**
30       * /kr-krad/uicomponents?viewId=ClientDisableView&methodToCall=start
31       */
32      public static final String BOOKMARK_URL ="/kr-krad/uicomponents?viewId=ClientDisableView&methodToCall=start";
33  
34      @Override
35      protected String getBookmarkUrl() {
36          return BOOKMARK_URL;
37      }
38  
39      @Override
40      protected void navigate() throws InterruptedException {
41          waitAndClickKRAD();
42          waitAndClickByLinkText("Client-side disable");
43          switchToWindow("Kuali :: Client-side Disable");
44      }
45      
46      private void testClientSideDisable() throws Exception{
47          waitAndClickByXpath("//input[@name='field118' and @value='disable']");
48          waitForElementPresentByXpath("//input[@name='field2' and @disabled]");
49          waitForElementPresentByXpath("//textarea[@name='field3' and @disabled]");
50          waitForElementPresentByXpath("//select[@name='field3' and @disabled]");
51          waitForElementPresentByXpath("//select[@name='field114' and @disabled]");
52          waitForElementPresentByXpath("//input[@name='field117' and @type='radio' and @disabled]");
53          waitForElementPresentByXpath("//input[@name='bField1' and @type='checkbox' and @disabled]");
54          waitForElementPresentByXpath("//input[@name='field115' and @type='checkbox' and @disabled]");
55          waitForElementPresentByXpath("//button[contains(text(),'Action Button') and @disabled]");
56          waitAndClickByXpath("//input[@name='field118' and @value='enable']");
57          waitForElementNotPresent(By.xpath("//input[@name='field2' and @disabled]"));
58          waitForElementNotPresent(By.xpath("//textarea[@name='field3' and @disabled]"));
59          waitForElementNotPresent(By.xpath("//select[@name='field3' and @disabled]"));
60          waitForElementNotPresent(By.xpath("//select[@name='field114' and @disabled]"));
61          waitForElementNotPresent(By.xpath("//input[@name='field117' and @type='radio' and @disabled]"));
62          waitForElementNotPresent(By.xpath("//input[@name='bField1' and @type='checkbox' and @disabled]"));
63          waitForElementNotPresent(By.xpath("//input[@name='field115' and @type='checkbox' and @disabled]"));
64          waitAndTypeByName("field50","hi");
65          waitAndTypeByName("field51","hello");
66          waitForElementPresentByXpath("//input[@name='field54' and @disabled]");
67          waitAndTypeByName("field52","hello");
68          waitForElementPresentByXpath("//input[@name='field54']");
69          waitAndTypeByName("field53","disable");
70          waitForElementPresentByXpath("//button[contains(text(),'Action Button (change)') and @disabled]");
71          waitAndTypeByName("field52","");
72          waitForElementPresentByXpath("//button[contains(text(),'Action Button (keyUp)') and @disabled]");
73          waitForElementPresentByXpath("//button[@id='Demo-DisableSection4_add' and @disabled]");
74          waitForElementPresentByXpath("//input[@name='field12' and @disabled]");
75          waitForElementNotPresent(By.xpath("//input[@name='field10' and @disabled]"));
76          waitAndClickByXpath("//input[@name='stringList2' and @value='1']");
77          waitForElementPresentByXpath("//input[@name='field10' and @disabled]");
78          waitForElementNotPresent(By.xpath("//input[@name='field12' and @disabled]"));
79          waitAndClickByXpath("//input[@name='stringList2' and @value='2']");
80          waitAndClickByXpath("//input[@name='stringList2' and @value='3']");
81          waitForElementPresentByXpath("//input[@name='field11' and @disabled]");
82      }
83      
84      @Test
85      public void testClientSideDisableBookmark() throws Exception {
86          testClientSideDisable();
87          passed();
88      }
89  
90      @Test
91      public void testClientSideDisableNav() throws Exception {
92          testClientSideDisable();
93          passed();
94      }
95      
96  }